Skip to content

fix(federation/query-planning): Fix bug where subgraph jump key fields are fetched from the wrong node#8016

Merged
sachindshinde merged 3 commits intodevfrom
sachin/fix-inapplicable-key-during-requires-subgraph-jump
Oct 1, 2025
Merged

fix(federation/query-planning): Fix bug where subgraph jump key fields are fetched from the wrong node#8016
sachindshinde merged 3 commits intodevfrom
sachin/fix-inapplicable-key-during-requires-subgraph-jump

Conversation

@sachindshinde
Copy link
Contributor

When a @requires edge needs a subgraph jump during fetch dependency graph processing, this would sometimes cause the locally satisfiable key fields needed by that jump to be fetched from the parent node instead of the current node (which apparently was done as an optimization). This can be a problem, since GraphPath::can_satisfy_conditions() only really guarantees the current node has those key fields.

This PR updates the code using the parent node to now explicitly check whether the locally satisfiable key can be fetched from that node, and if not, falls back to the current node (adding it as a parent, if needed). This lets us keep the optimization and avoid unnecessarily changing query plans.

This PR mirrors its JS equivalent at apollographql/federation#3293 , and fixes #6004 .

@sachindshinde sachindshinde requested review from a team as code owners July 30, 2025 18:35
@apollo-librarian
Copy link

apollo-librarian bot commented Jul 30, 2025

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 32cc33479e2a7a2af19bf806
Build Logs: View logs

@github-actions

This comment has been minimized.

@sachindshinde sachindshinde requested a review from a team as a code owner July 30, 2025 18:51
@sachindshinde sachindshinde force-pushed the sachin/fix-inapplicable-key-during-requires-subgraph-jump branch 2 times, most recently from 4b84a63 to 46156ba Compare August 1, 2025 16:47
Copy link
Contributor

@duckki duckki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just a minor correction in the changelog text.

@sachindshinde sachindshinde force-pushed the sachin/fix-inapplicable-key-during-requires-subgraph-jump branch from 012c938 to c7e2e35 Compare August 4, 2025 16:35
@duckki
Copy link
Contributor

duckki commented Aug 4, 2025

can't approve more! let's merge.

@sachindshinde sachindshinde force-pushed the sachin/fix-inapplicable-key-during-requires-subgraph-jump branch from c7e2e35 to 1cd1577 Compare September 29, 2025 14:39
@sachindshinde sachindshinde merged commit 5d4a832 into dev Oct 1, 2025
15 checks passed
@sachindshinde sachindshinde deleted the sachin/fix-inapplicable-key-during-requires-subgraph-jump branch October 1, 2025 16:20
@abernix abernix mentioned this pull request Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Query Planner Fails for Nested Entity Fields Decorated With @requires

2 participants