Repository navigation
fix(federation): merge fragments whose keys collide after directive stripping - #10376
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: 02cf6155759e9914b4639c6e URL: https://www.apollographql.com/docs/deploy-preview/02cf6155759e9914b4639c6e ✅ 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-5-fragment-key-collision
branch
from
October 5, 2026 18:04
e32b1b6 to
de333c5
Compare
inanna-apollo
marked this pull request as ready for review
October 5, 2026 18:04
…tripping `remove_unneeded_top_level_fragment_directives` removes `@include`/`@skip` applications from top-level inline fragments when they are already implied by the path a fetch node is merged at. Removing a directive changes the fragment's selection key, so two fragments that were distinct before (`... on A @include(if: $x) { id }` and `... on A { value }`) can end up with the same key. The result was built with `SelectionMap::insert`, which appends without checking for an existing key, so the returned selection set held two entries for one key, breaking the invariant every key-based lookup and merge on `SelectionMap` relies on. Build the result with `add_local_selection`, which merges selections whose keys collide.
inanna-apollo
force-pushed
the
inanna/fix-5-fragment-key-collision
branch
3 times, most recently
from
October 5, 2026 18:24
de333c5 to
3e433bd
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.
remove_unneeded_top_level_fragment_directivesremoves@include/@skipapplications from top-level inline fragments when they are already implied by the path a fetch node is merged at. Removing a directive changes the fragment's selection key, so two fragments that were distinct before (... on A @include(if: $x) { id }and... on A { value }) can end up with the same key. The result was built withSelectionMap::insert, which appends without checking for an existing key, so the returned selection set held two entries for one key, breaking the invariant every key-based lookup and merge onSelectionMaprelies on.Build the result with
add_local_selection, which merges selections whose keys collide.Reachability
Not reached by the planner today: instrumenting every strip across the query plan suite and hand-built shapes found no collision, and the only caller re-merges top-level duplicates. Defensive fix for the
SelectionMapkey invariant.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