Repository navigation
Description
Problem
The sequence-order oracle reverses each allOf and compares the two compiles' diagnostics without
their message text, so it reads a report of the member fold by its severity, code, place and the
member it names. What the report is about (a type, a bound by its keyword, a default, docs) is
written in the message alone. That leaves the oracle wrong in two directions.
Two reports told apart by their message cancel. Where the reversal moves one report to a place
another report holds in the other order, the two are one to the oracle, the moved one is left
unpaired, the tie it states is not read, and a valid document is judged order-dependent:
openapi: 3.0.3
info: {title: t, version: "1"}
paths: {}
components:
schemas:
D0: {type: object, properties: {p: {type: array, maxItems: 5, items: {type: string, maxLength: 3}, deprecated: true}}}
D1: {type: object, properties: {p: {type: array, maxItems: 5, items: {type: string, maxLength: 3}, default: 3}}}
D3: {type: object, properties: {p: {type: array, minItems: 1, items: {type: string}, writeOnly: true}}}
D4: {type: object, properties: {p: {type: array, minItems: 1, items: {type: string}, description: da}}}
M0: {allOf: [{$ref: '#/components/schemas/D3'}, {$ref: '#/components/schemas/D4'}, {$ref: '#/components/schemas/D1'}, {$ref: '#/components/schemas/D0'}]}As written, morphic compile --verify --diag-limit 0 exits 0 with, in full:
info openapi/degraded-construct spec.yaml#/components/schemas/M0/allOf/2: declarations of field "p" give types t/anon/components/schemas/D0/properties/p and t/anon/components/schemas/D1/properties/p whose values overlap but that the merge does not narrow to one; kept the type the declaration at /components/schemas/D0/properties/p gives over the one at /components/schemas/D1/properties/p, which stays declared on its model
warning pass/default-outside-type spec.yaml#/components/schemas/D1/properties/p: default is a number, and t/anon/components/schemas/D1/properties/p holds a listWith M0's entries reversed, [D0, D1, D4, D3]:
info openapi/degraded-construct spec.yaml#/components/schemas/M0/allOf/1: the merge cannot show that the type the declarations of field "p" merge to admits the default the declaration at /components/schemas/D1/properties/p gives; not adopted, and that declaration stays declared on its model
info openapi/degraded-construct spec.yaml#/components/schemas/M0/allOf/2: declarations of field "p" give types t/anon/components/schemas/D3/properties/p and t/anon/components/schemas/D4/properties/p whose values overlap but that the merge does not narrow to one; kept the type the declaration at /components/schemas/D3/properties/p gives over the one at /components/schemas/D4/properties/p, which stays declared on its model
warning pass/default-outside-type spec.yaml#/components/schemas/D1/properties/p: default is a number, and t/anon/components/schemas/D1/properties/p holds a listM0.p takes t/composed/components/schemas/M0/allOf/properties/p in both. Both orders follow the
documented tie (docs/compilers/openapi.md#allof-redeclared-property: "Of those holding as many,
the later wins"; a default the merged type may not admit is reported). Read back into the source as
written, the reversed default report sits at allOf/2, where the as-written overlap report sits,
and the oracle pairs those two, which agree but for their message. The reversed overlap report is
left over, and morphic-harness spec.yaml reports:
spec.yaml sequence-order-dependent diagnostics depend on sequence order (-as-written +reversed):
+"info\x00openapi/degraded-construct\x00/components/schemas/M0/allOf/1\x00false\x00p/composed/components/schemas/M0/allOf/properties/p\x000\x000\x00"
document depends on sequence order (-as-written +reversed):
-225: "docs": {
-226: "description": "da"
-227: },
+225: "docs": {},sequence-order-invariance 1 1 0.
A tie over a bound and one over a type are one to the oracle. It reads a tie from a mirrored
pair of openapi/conflicting-redeclaration reports, and finds it contradicted only where the
member takes, in each order, the type its report says lost; a member holding the same type in both
orders while its reports trade places passes. That is right where the tie is over a bound:
openapi: 3.0.3
info: {title: t, version: "1"}
paths: {}
components:
schemas:
A: {type: object, properties: {p: {type: string, pattern: "^a"}}}
B: {type: object, properties: {p: {type: string, format: uuid, pattern: "^b"}}}
M: {allOf: [{$ref: '#/components/schemas/A'}, {$ref: '#/components/schemas/B'}]}M.p is t/prim/uuid in both orders and draws one warning, as written
declarations of field "p" disagree: conflicting pattern ("^b" and "^a"); kept what the declaration at /components/schemas/B/properties/p says over the one at /components/schemas/A/properties/p, which stays declared on its model,
reversed the same with A and B swapped; the oracle passes it (1 0 0), as the rule documents.
But a compiler defect reporting a type conflict as following the entries while choosing the type by
other means draws the same two reports over the same unmoved type, and passes too: the code is one
for a conflict of types and of bounds, and the related entries name the places and the member,
not what the declarations disagree over. Treating an unmoved type as a contradiction would flag the
valid document above.
Cause
difference in internal/harness/sequenceorder.go takes the two compiles' reports as multisets of
diagnosticKey (internal/harness/order.go), which leaves the message out, before movedReports
reads what is left; the tie reading (tiedBy, keptTypes, internal/harness/ties.go) has the
same key and the related entries, nothing more (morphic @512f3ee46).
Direction
A draft, with the choice open:
- give the fold's reports a structured member saying what its declarations disagree over (the
type, a bound by its keyword, a default, a detail by its field), filled where the fold already
knows it. The key tells the two reports above apart, and the oracle reads a tie over a type as
contradicted where the type is unmoved and a tie over a bound by that bound. A change of a
diagnostic's shape movesIRVersionand the JSON findings report's schema version; - compare the message with every place it names erased. This splits the first pair but brings back
a sensitivity to wording the oracle dropped on purpose, and it does not settle the second, whose
messages also swap the values they quote; - state both limits beside
differenceandtiedBy.
A judge of types in the harness, the other way to read the second case, repeats the compiler's
narrowing rule in a second place that cannot stay in step with it.
Out of scope
- The order dependence the tie itself documents, which the oracle forgives once it reads the tie.
- The dependence of a member settled from a tied one (openapi: a member redeclared by two object schemas written alike and others that lose names whichever comes later #2099).
Priority: P4, rule 1 (a test oracle's verdict and reach; it changes no lowering, validation, IR or
emitted output until the first direction's shape change is taken up). morphic-harness on the
first spec → sequence-order-invariance 1 1 0, on the second 1 0 0 (morphic @512f3ee46).
Activity
OmarAlJarrah commentedon Nov 29, 2026
#2354 closes this at its merge on the first problem, which
bfb46546ffixes. Each member fold report now sits where the declaration it is about is written and names no node of its own. It lists every member it decided (decided) and, where it is about two declarations, the place of the one whose say was kept (kept, the first written of those agreeing with it). So two reports that differ only in their message no longer meet with the same site and related entries. At this issue'sD1/properties/p, the overlap reported as written keepsD0's place, and the refusal ofD1's default reported reversed keeps none.The sequence-order oracle reads a report by its code, site and related entries:
decidedErased);keptplace, one in each order with the two places the other way round (tiedBy). Stated by a report other than a conflict, it decides what the member folds over every declaration; stated by conflicts alone, it leaves the member's deprecation, docs, name and XML hints compared (statedAlone);keptplace ties nothing, whether or not the reversal moves it (7bc855725). It is forgiven, itself alone, only where it is about a member a tie decided or a model holding one, or sits at or beneath such a member's pointer (untied);TestCheck_SequenceOrderOracleHoldsOnTheRealCompiler/a_tie_whose_report_leaves_a_declaration_that_reports_its_default_reversed(940aff2af) shows the cancellation alone.M0composesD0,D1andD2, andD1's andD2's lists ofpoverlap and hold as many declarations, so the later wins. As written, the tie's report sits atD1/properties/p, keepingD2's place. Reversed, it sits atD2/properties/p, keepingD1's, andD1/properties/palso reports giving its default up toD0's, keepingD0's place. The two reports atD1agree in severity, code, site and decided member and differ in theirkeptplace, so neither cancels the other. The oracle reads the mirrored tie, forgivesp, and passes (1 0 0), andptakes the default[a]in either order.The second problem remains a stated limit. No message is read, so a tie over a bound and one over a type at the same places look the same, and a tie over one detail decides every detail the member folds. This is written beside
difference,tiedByandtiedByConflictsAloneand inCLAUDE.md; #2340 tracks it.The first reproduction is still found, for another reason:
morphic-harnessgives sequence-order-invariance1 1 0ata18eb82e4. Of the overlapping lists, the fold keepsD0's overD1's as written andD3's overD4's reversed, so the composed node holdsD4's description in one order only. The refusal ofD1's default, a report with nokeptplace at a member no tie decided, is found with it. That is the order-dependent winner #1931 records, with its spec, not a report the oracle misreads.docs: cite the open limit of the sequence-order oracle as #2340
test(compilers/openapi): pin the fold's minted keys and its selection