Repository navigation
fix(query)!: distribute alias widening over an endpoint's kind union - #666
Merged
Merged
Conversation
`SubsumptionAffected` decided "does this relation name kind K" by `Extract`ing the whole ontology element against a single-kind endpoint shape. An endpoint that can hold more than one kind matches no such shape, so the decision came back `false` for every kind the endpoint can hold — an unsound under-widening that typed a genuinely polymorphic alias as exact, the opposite of the conservative over-widening the erased arms take on purpose. The decision now reduces each element's `MatchedEndpoints` to the kind literals they can hold and asks whether `K` is among them, which covers both spellings of a union endpoint: a union of endpoint types (`typeof Audio | typeof Video`, from a helper that declares a subclass of either media root) and a union inside one endpoint's `kind` (`NodeType<"Audio" | "Video">`). `MatchedEndpoints` becomes the sole owner of the name-to-endpoint-position mapping — the decided arm no longer re-spells it as `Extract` arms alongside the erased arm's use of it — and both erased arms are unchanged. Forgotten-export debt moves +1 on the seven `SubsumptionAffected`-reachable entrypoints for exactly one new declaration, `SubsumptionElementNamesKind`; removing that name from each new symbol set reproduces the previously recorded `sha256` exactly.
pdlug
added a commit
that referenced
this pull request
Sep 23, 2026
…666) Second whole-branch review of #637, finding: an ontology endpoint declared as a finite union of node types (`parent: typeof ParentA | typeof ParentB`) still produced exact alias types, because `SubsumptionAffected` decided "does this relation name kind K" by `Extract`ing the whole relation against a single-kind endpoint shape. A union endpoint matches no such shape, so the decision answered `false` for every kind the endpoint can hold — an unsound under-widening, the opposite of the conservative over-widening the erased arms take on purpose. The decision now reduces each relation's `MatchedEndpoints` to the kind literals its endpoints can hold and asks whether `K` is among them. That covers both spellings of a union endpoint: a union of endpoint types (from a helper that declares a subclass of either of two roots) and a union inside one endpoint's `kind` (`NodeType<"Audio" | "Video">`). `MatchedEndpoints` is the sole owner of the name-to-endpoint-position mapping; the decided arm no longer re-spells it as `Extract` arms beside the erased arm's use of it, and both erased arms are unchanged. A union endpoint therefore widens exactly the kinds it can hold and nothing else, which the typed-subsumption changeset and the queries guide now state. Forgotten-export debt moves +1 on the seven entrypoints that reach `SubsumptionAffected`, for exactly one new declaration (`SubsumptionElementNamesKind`); removing that name from each new symbol set reproduces the previously recorded digest.
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.
Second whole-branch review of #637, finding: an ontology endpoint declared as a finite union of node types (
parent: typeof ParentA | typeof ParentB) still produced exact alias types, becauseSubsumptionAffecteddecided "does this relation name kind K" byExtracting the whole relation against a single-kind endpoint shape. A union endpoint matches no such shape, so the decision answeredfalsefor every kind the endpoint can hold — an unsound under-widening, the opposite of the conservative over-widening the erased arms take on purpose.The decision now reduces each relation's
MatchedEndpointsto the kind literals its endpoints can hold and asks whetherKis among them. That covers both spellings of a union endpoint: a union of endpoint types (from a helper that declares a subclass of either of two roots) and a union inside one endpoint'skind(NodeType<"Audio" | "Video">).MatchedEndpointsis the sole owner of the name-to-endpoint-position mapping; the decided arm no longer re-spells it asExtractarms beside the erased arm's use of it, and both erased arms are unchanged. A union endpoint therefore widens exactly the kinds it can hold and nothing else, which the typed-subsumption changeset and the queries guide now state.Forgotten-export debt moves +1 on the seven entrypoints that reach
SubsumptionAffected, for exactly one new declaration (SubsumptionElementNamesKind); removing that name from each new symbol set reproduces the previously recorded digest.