fix(federation): keep all components when normalizing interleaved origins - #10366
Open
inanna-apollo wants to merge 1 commit into
Open
inanna-apollo wants to merge 1 commit into
inanna-apollo wants to merge 1 commit into
Conversation
Contributor
✅ Docs preview readyThe preview is ready to be viewed. View the preview File Changes 0 new, 1 changed, 0 removedBuild ID: 28412638d96b3fdfb1704620 URL: https://www.apollographql.com/docs/deploy-preview/28412638d96b3fdfb1704620 ✅ AI Style Review — No Changes DetectedNo MDX files were changed in this pull request. Review Log: View detailed log
|
This comment has been minimized.
This comment has been minimized.
inanna-apollo
force-pushed
the
inanna/fix-18-normalize-interleaved-origins
branch
from
October 5, 2026 18:04
c2fac2c to
7dc7af2
Compare
inanna-apollo
marked this pull request as ready for review
October 5, 2026 18:04
…gins
`group_components_by_origin_and_sort` grouped components with
`chunk_by`, which only groups consecutive runs, and then collected the
runs into an `IndexMap` keyed by origin. When components with the same
origin were not adjacent, a later run overwrote an earlier one and its
fields/directive applications were silently dropped.
Normalization itself produces that interleaving (it sorts by content
across definition and extension origins), so normalizing an already
normalized schema lost data, e.g. `type Query { a z } extend type Query
{ m }` normalizes to `a, m, z` and then to `m, z`. Group by origin
across the whole input instead, preserving multiplicity.
inanna-apollo
force-pushed
the
inanna/fix-18-normalize-interleaved-origins
branch
3 times, most recently
from
October 5, 2026 18:24
7dc7af2 to
4d85187
Compare
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.
group_components_by_origin_and_sortgrouped components withchunk_by, which only groups consecutive runs, and then collected the runs into anIndexMapkeyed by origin. When components with the same origin were not adjacent, a later run overwrote an earlier one and its fields/directive applications were silently dropped.Normalization itself produces that interleaving (it sorts by content across definition and extension origins), so normalizing an already normalized schema lost data, e.g.
type Query { a z } extend type Query { m }normalizes toa, m, zand then tom, z. Group by origin across the whole input instead, preserving multiplicity.Reachability
Test utility only:
normalize_valid_schemais public but its only caller outside the module is the supergraph reversibility test. Freshly parsed SDL is never interleaved, but schemas built in code (such as extracted subgraphs) can be, and normalizing twice always loses data.Testing
The regression test(s) in this PR fail on
devand pass with this change; neighboring test suites pass with no snapshot changes. Found during property-based testing ofapollo-federation.Checklist