Skip to content

Conversation

sachindshinde
Copy link
Contributor

@sachindshinde sachindshinde commented Sep 29, 2025

This PR fixes a bug where query planning may unexpectedly error while planning an operation with a satisfiable @shareable mutation field.

Specifically, this PR:

  1. Updates query planning on mutation fields to only consider one initial subgraph at a time for a traversal, and returns the plan with lowest cost.
    • Previously, this was mixing up options that started in different subgraphs in the same traversal, which would sometimes generate query planning errors if those differing options were chosen. There were a few ways to fix this, but the least invasive/simplest was just to do multiple traversals, each with a limited initial subgraph.
  2. Updates a particular query planning optimization to avoid discarding an option if another option with less subgraph jumps/cost is found, if that option starts in a different subgraph and the option is for a mutation operation.

This PR was originally filed as part of #3303, but was split off so it could be merged faster in the next patch release.

@sachindshinde sachindshinde requested a review from a team as a code owner September 29, 2025 21:30
Copy link

changeset-bot bot commented Sep 29, 2025

🦋 Changeset detected

Latest commit: 57c8040

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@apollo/query-planner Patch
@apollo/query-graphs Patch
@apollo/gateway Patch
@apollo/composition Patch
@apollo/federation-internals Patch
@apollo/subgraph Patch
apollo-federation-integration-testsuite Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@apollo-librarian
Copy link

apollo-librarian bot commented Sep 29, 2025

❌ Docs preview failed

The preview failed to build.

Build ID: bc48972759bd33773589e97e
Build Logs: View logs

Errors

General: ENOSPC: no space left on device, mkdir '/tmp/librarian/remote-sources/apollographql/rover/main'

Copy link

codesandbox-ci bot commented Sep 29, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@sachindshinde sachindshinde force-pushed the sachin/fix-shareable-mutation-fields-in-qp branch from e727633 to 5dd2b5c Compare September 29, 2025 21:33
@sachindshinde sachindshinde changed the title fix(query-planning): Prevent error for satisfiable @shareable mutation fields fix(query-planning): Prevent error for satisfiable @shareable mutation fields Sep 29, 2025
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 like the Rust QP counterpart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants