Repository navigation
test(compilers/openapi): pin the composed hints of an empty name - #1518
Open
fuad-daoud wants to merge 9 commits into
Open
fuad-daoud wants to merge 9 commits into
fuad-daoud wants to merge 9 commits into
Conversation
An empty name reaches three composition sites with no row in composedHints: a property's contentSchema, and a media type's itemSchema through a header keyed "" and through a parameter named "". A defect on the parameter's branch moved the hint from empty_item to item_schema with the compiler suite green. The empty-names spec gains a schema or a $ref for each, its golden is regenerated, and composedHints holds a row for each. The comment that said itemSchema could not need a row is gone, because a $ref reaches it under a header or a parameter. The validation oracle gains three rows for the spec's new lines: the two itemSchema lines are a later minor's field, classified version-gate, and the parameter's empty name is classified empty-is-missing.
…napi-empty-name-hints
The first commit's three composition sites are now five. A header keyed "" and a parameter named "" each hold a schema directly, and the hint of the items of an array there is composed from that empty name. ownerOf has a branch of its own for each, which no composedHints row reached: with either branch changed to refuse an empty name, the hint moved from empty_item to schema_item and the compiler suite stayed green for the header, and reddened only the owner-reading test for the parameter. The empty-names spec gains a response and a parameter holding an array of objects, and a $ref to each one's items, because only a reference reaches an anonymous node. Its golden is regenerated, and composedHints holds a row for each. The validation oracle gains four rows in all, three from the first commit and one here: the two itemSchema lines are a later minor's field, classified version-gate, and the two parameters' empty names are classified empty-is-missing.
The composition sites are now seven. A schema under the content of a header keyed "" or of a parameter named "" composes its hint through ownerOf's media-type fall-through, which no composedHints row reached. With that arm changed to refuse an empty hint, the items of an array there moved from empty_item to schema_item and the whole module stayed green. The empty-names spec gains a response and a parameter holding that shape, and a $ref to each one's items, because no operation mounts them and only a reference lowers the items of a component no operation mounts. Its golden is regenerated, and composedHints holds a row for each. The validation oracle holds five rows for the spec's lines added since main: two itemSchema lines classified version-gate, and three parameters' empty names classified empty-is-missing.
fuad-daoud
marked this pull request as ready for review
November 5, 2026 10:36
fuad-daoud
marked this pull request as draft
November 5, 2026 23:59
The composedHints rows were matched to the golden's empty_* hints by hand, and the two variants of Mixed's union, named from their literals, had no assertion, so a regeneration accepted a changed name there. Assert the variants, and fail on any node whose hint composes from an empty name without a row, so a new composition site cannot be added by regenerating the golden. Name the two empty-named positions left without a row, #1535 and #1536.
fuad-daoud
marked this pull request as ready for review
November 6, 2026 00:28
fuad-daoud
marked this pull request as draft
November 6, 2026 10:46
A key "" under a keyword the walk does not read, such as an x- extension's, composes empty_item from the empty name. No test held that branch of stepOf, so a name an emitter renders could move with the suite green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In short: A name hint composed under an empty property, header or parameter name goes through seven code paths no test row held, so regenerating the golden could quietly accept a changed name. This adds a row for each path.
An empty property name, header key or parameter name composes hints through seven code paths with no row in
composedHints: a property'scontentSchemaand, for a header keyed""and a parameter named""alike, a media type'sitemSchema, aschemaheld directly, and aschemaundercontent. Many positions in a document go through each path, and the rows hold the paths, not every position. Other positions an empty name reaches have no row, for one of two reasons. Acomponents/schemasentry keyed"", and a key""under a keyword the walk does not read, such as anx-extension's, composeempty_item, andTestAt_NamesASchemaByItsStructureholds both hints. Acomponents/responsesorcomponents/requestBodiesentry keyed""takes a role word (response_item,request_item), and acomponents/mediaTypesentry keyed""(#1536) and a header under a nested encoding (#1535) are each named from their pointer, so none of these four composes from it. The test's comment saiditemSchemacould not need a row, and that was false: a$refreaches it under a header or a parameter.Defects on these paths moved a hint with the compiler's suite green:
contentOwner's parameter branch movedempty_itemtoitem_schema, andownerOf's header branch and its media-type fall-through moved it toschema_item.ownerOf's parameter branch was held only byTestAt_ReadsAnOwnerAsTheParserDoes, which reads the owner and not the compiled hint.The
empty-namesspec gains a schema or a$reffor each path, its golden is regenerated, andcomposedHintsholds a row for each. No operation mounts these components, so a$refis what lowers their items. The golden's diff is only those new nodes, theno_ir_homeentries of the three parameters and the three responses, the warnings for the 3.2 field, and the hash.The validation oracle gains five rows for the spec's new lines: the two
itemSchemalines are a later minor's field, classifiedversion-gate, and the three parameters' empty names areempty-is-missing, as the file's other such rows are.This goes beyond #743's text, which names
contentSchemaalone, on the same mechanism.Closes #743
Before and after
flowchart TB subgraph before ["Before"] b0["A defect moves a hint composed under an empty name"] b1["empty_item becomes item_schema or schema_item"] b2["The compiler's suite stays green, and -update would accept it"] b0 --> b1 b1 --> b2 end subgraph after ["After"] a0["A defect moves a hint composed under an empty name"] a1["empty_item becomes item_schema or schema_item"] a2["The composedHints row fails before the golden is compared or rewritten"] a0 --> a1 a1 --> a2 end before ~~~ afterWhat it brings: A hint composed under an empty property, header key or parameter name now has a row for each code path that names its owner, so a regeneration cannot quietly accept a changed name there, which is what a target's identifier is rendered from.
Test plan
mainat2123d296merged in, runsmake gate. On6ba78067,go build ./..., the touched packages' tests,make vet,make lintandmake lint-plantedeach pass; the merge after it touched only.claude/skills/andCLAUDE.md.contentSchemarole innaming/steps.goas_reddens theBlobrow (actual: empty_empty)._contentchanges no hint, becauseSubHintsneutralizes a role.naming/owners.gorefuse an empty name reddens that path's rows:contentOwner's parameter case theUnnamedandUnnamedContentrows, and its header case theFramedandCarriedrows (actual: item_schema,schema_item);ownerOf'sKindHeadertheListedrow, itsKindParametertheUnnamedListrow, and its media-type fall-through theCarriedandUnnamedContentrows (actual: schema_item).Blob,Frame,Line,HeaderItem,ParamItem,HeaderContentItemorParamContentItemfrom the spec reddens the suite with "no node at ...", so the regeneration did real work.name: ""asname: "q"reddens its row (actual: q_item), so the row needs the empty name.composedHintsrows and theempty_*hints under the golden's.typesagree in both directions, 15 and 15, and a test now holds that: a hint startingempty_with no row reddens it. The golden's two otherempty_*hints are the variants ofMixed's union, whichassertEmptyDerivedHintsreads beside the rows.testdata/unwitnessed.golden.txtdoes not move.naming/steps.go, insertingif keyword == "" { return enclosing, false, 1 }beforestepOf's last line (:81),return chain{base: keyword}, false, 1, reddens thea key "" under a keyword the walk does not readrow ofTestAt_NamesASchemaByItsStructure,actual: x_ext_item. With that row removed, the same plant leavesgo test ./compilers/... ./internal/conformance/... ./internal/harness/... ./cmd/morphic-census/...green.