Skip to content

[Fusion] Precompute satisfiability facts to make schema validation scale - #10072

Merged
michaelstaib merged 6 commits into
mainfrom
mst/fes-5
Jul 8, 2026
Merged

[Fusion] Precompute satisfiability facts to make schema validation scale#10072
michaelstaib merged 6 commits into
mainfrom
mst/fes-5

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 8, 2026 20:33
@michaelstaib michaelstaib changed the title # Executor A _distributed GraphQL executor_ executes a GraphQL request against the composite schema by requesting data from the source schemas and combining the results into a single GraphQL response. ## Execution Model The executor operates on the _composite execution schema_. This is a GraphQL IDL document that contains the composite schema together with metadata from composition. The metadata records which source schemas resolve each field and how entities are resolved by key. This specification does not prescribe how an executor plans or schedules its work. It defines only the behavior that a client or a source schema can observe. The composite schema is a GraphQL schema, and executing a request against it follows the GraphQL specification. A client must not be able to observe any difference between executing a request against the composite schema and executing it against a single GraphQL service. The sections below define the rules that preserve this equivalence. [Fusion] Precompute satisfiability facts to make schema validation scale Jul 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves Fusion composition satisfiability validation by adding a least-fixpoint “fact” table for fast transition/resolution checks, tightening correctness around @provides, and ensuring Apollo Federation entity lookups are generated even for subgraphs without a user-declared Query type.

Changes:

  • Add SatisfiabilityFacts + SatisfiabilityFactsBuilder to precompute transition/accessibility/resolvability facts and use them to shortcut expensive recursion.
  • Add a new validation step that checks @provides selections are actually deliverable by the providing schema.
  • Update Apollo Federation lookup generation to synthesize a Query type when needed (query-less subgraph) and add regression tests.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/HotChocolate/Fusion/test/Fusion.Composition.Tests/Satisfiability/SatisfiabilityFactsBuilderTests.cs New tests covering fixpoint accessibility/transition behavior and require-cycle cases.
src/HotChocolate/Fusion/test/Fusion.Composition.Tests/Satisfiability/SatisfiabilityCycleTests.cs New tests asserting composition fails/succeeds based on require-cycle satisfiability.
src/HotChocolate/Fusion/test/Fusion.Composition.Tests/Satisfiability/RequirementsValidatorTests.cs Update test wiring to use the new SatisfiabilityFacts instead of transition cache.
src/HotChocolate/Fusion/test/Fusion.Composition.Tests/Satisfiability/ProvidesDeliverabilityTests.cs New tests for @provides deliverability enforcement.
src/HotChocolate/Fusion/test/Fusion.Composition.ApolloFederation.Tests/QueryLessSubgraphLookupTests.cs Regression test for query-less subgraph lookup generation.
src/HotChocolate/Fusion/test/Fusion.Composition.ApolloFederation.Tests/ExternalKeyLookupRepro.cs Regression test for “external key field” lookup resolvability scenario.
src/HotChocolate/Fusion/test/Fusion.Composition.ApolloFederation.Tests/CorpusScaleProbe.cs Added local corpus probe (currently problematic for CI).
src/HotChocolate/Fusion/src/Fusion.Composition/SatisfiabilityValidator.cs Integrates fixpoint facts, adds @provides deliverability validation, adjusts partial-field resolution semantics.
src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/SourceSchemaTransitionHelper.cs Removes memoization/cycle-scope logic tied to the deleted transition cache.
src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/SourceSchemaTransitionCache.cs Removed direct-lookup transition memoization type.
src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/SatisfiabilityFactsBuilder.cs New fixpoint builder that computes reachability/transition/accessibility facts.
src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/SatisfiabilityFacts.cs New fact container queried by validators for O(1) checks.
src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/RequirementsValidator.cs Uses fixpoint facts to short-circuit transitions/requirements, updates partial-field handling semantics.
src/HotChocolate/Fusion/src/Fusion.Composition/Properties/CompositionResources.resx Adds new localized message for non-deliverable @provides fields.
src/HotChocolate/Fusion/src/Fusion.Composition/Properties/CompositionResources.Designer.cs Designer update for the new resource string.
src/HotChocolate/Fusion/src/Fusion.Composition/Logging/LogEntryCodes.cs Adds PROVIDES_FIELDS_NOT_RESOLVABLE log code.
src/HotChocolate/Fusion/src/Fusion.Composition/Extensions/SatisfiabilityPathItemExtensions.cs Adds ProvidesViaEventStream to distinguish event-stream vs @provides satisfaction.
src/HotChocolate/Fusion/src/Fusion.Composition/Collections/SatisfiabilityPath.cs Simplifies cycle-detection storage and adds ProvidedByEventStream flag on path items.
src/HotChocolate/Fusion/src/Fusion.Composition/ApolloFederation/GenerateLookupFields.cs Synthesizes/removes Query as needed to host generated lookups for query-less subgraphs.
Files not reviewed (1)
  • src/HotChocolate/Fusion/src/Fusion.Composition/Properties/CompositionResources.Designer.cs: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +20 to +21
[Fact]
public void Compose_Edge0V2()
Comment on lines +133 to +138
if (selection is not FieldNode fieldNode
|| !possibleType.Fields.TryGetField(fieldNode.Name.Value, out var providedField))
{
// Non-field selections and shape errors are handled by the @provides shape rules.
continue;
}
@michaelstaib
michaelstaib merged commit 05e235a into main Jul 8, 2026
143 of 146 checks passed
@michaelstaib
michaelstaib deleted the mst/fes-5 branch July 8, 2026 22:20
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.

2 participants