[Fusion] Precompute satisfiability facts to make schema validation scale - #10072
Merged
Conversation
Contributor
There was a problem hiding this comment.
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+SatisfiabilityFactsBuilderto precompute transition/accessibility/resolvability facts and use them to shortcut expensive recursion. - Add a new validation step that checks
@providesselections are actually deliverable by the providing schema. - Update Apollo Federation lookup generation to synthesize a
Querytype 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; | ||
| } |
This was referenced Jul 13, 2026
This was referenced Jul 20, 2026
chore(deps): Bump HotChocolate.Subscriptions.InMemory from 15.1.14 to 16.5.1
Kuestenlogik/Bowire#506
Merged
This was referenced Jul 27, 2026
This was referenced Aug 3, 2026
This was referenced Aug 11, 2026
Open
Open
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.
No description provided.