Skip to content

Conversation

sachindshinde
Copy link
Contributor

@sachindshinde sachindshinde commented Sep 29, 2025

This PR fixes a bug where composition may erroneously declare a schema with a @shareable mutation field satisfiable when it shouldn't be.

Specifically, this PR updates composition satisfiability to ensure that all query paths under a @shareable mutation field can be satisfied starting at the same subgraph. (I.e., that no matter what selection set is on the @shareable mutation field, the query planner will not need to make multiple calls to that mutation field across subgraphs.)

This is done by partitioning subgraph paths in ValidationState by the initial subgraph when a shared mutation field is encountered, and keeping track of separate error stacks as well. If all these partitions experience satisfiability errors, then there's no way to satisfy the selection set containing the witness operation from each partition using a single @shareable mutation field call, and the user is asked to fix (at least) one of the partition's satisfiability errors.

This PR may cause composition errors for a previously successful composition if that composition was mistakenly satisfiable due to this bug. We've determined that this may not be a rare occurrence, and accordingly this fix will land in the next minor release (which is why this PR was split off from #3303, where it was originally filed). This PR is currently stacked on top of #3304 for tests to pass, but once that PR merges and is pulled into next, this PR's base will change to next.

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

changeset-bot bot commented Sep 29, 2025

🦋 Changeset detected

Latest commit: 31be1e5

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

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

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: 599fc1b1f80a53dd41735724
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-composition branch from 17ed572 to bda02c8 Compare September 29, 2025 22:54
@sachindshinde sachindshinde force-pushed the sachin/fix-shareable-mutation-fields-in-qp branch from 369029b to 57c8040 Compare September 29, 2025 23:07
@sachindshinde sachindshinde force-pushed the sachin/fix-shareable-mutation-fields-in-composition branch from bda02c8 to 31be1e5 Compare September 29, 2025 23:08
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.

1 participant