Repository navigation
[Fusion] Cache per-field options in the satisfiability validator - #10703
Merged
Merged
Conversation
Contributor
Patch coverage98.9% of changed lines covered (179/181)
Uncovered changed lines (JSON){
"sha": "c18cdc57bcde39a6253b3808f70a7d11dc737139",
"files": [
{ "path": "src/HotChocolate/Fusion/src/Fusion.Composition/Options/ThrowHelper.cs", "ranges": [[15, 15]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/SchemaSetInterner.cs", "ranges": [[41, 41]] }
]
}Project coverage: 59.3% (319312/538478 lines) |
michaelstaib
force-pushed
the
mst/fusion-sat-field-options
branch
from
November 1, 2026 09:29
ecd2d02 to
0f6ab1e
Compare
michaelstaib
force-pushed
the
mst/fusion-sat-field-options
branch
from
November 1, 2026 09:31
0f6ab1e to
2cdd548
Compare
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the validator caching and schema-registration changes.
No open issues 🎉
What changed in this PR
This PR reduces repeated work in Fusion’s satisfiability validator by caching field-resolution options and registering source schemas up front. It builds on #10702’s bounded error explanations while aiming to preserve validation results and error ordering. Benchmarks remain pending.
Changes:
- Cache per-field schema options, partial status, requirements, event-stream messages, and possible return types.
- Pre-register schema indexes and restrict lookup checks to schemas named by the type’s lookups.
- Add success and failure regression tests for 65-schema federations, including an ordered error snapshot.
| File | Description |
|---|---|
src/HotChocolate/Fusion/test/Fusion.Composition.Tests/Satisfiability/SatisfiabilityWideFederationTests.cs |
Adds 65-schema success and failure cases. |
src/HotChocolate/Fusion/test/Fusion.Composition.Tests/Satisfiability/__snapshots__/SatisfiabilityWideFederationTests.Validate_Should_Fail_When_SixtyThreeSchemasDeclareFieldsBelowLoopExit.md |
Records expected validation errors and ordering. |
src/HotChocolate/Fusion/test/Fusion.Composition.Tests/CompositionTestHelper.cs |
Supports explicitly named source schemas in tests. |
src/HotChocolate/Fusion/src/Fusion.Composition/SatisfiabilityValidator.VisitKeys.cs |
Collects schema names and narrows lookup checks. |
src/HotChocolate/Fusion/src/Fusion.Composition/SatisfiabilityValidator.cs |
Uses cached options during field resolution. |
src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/SchemaSetTable.cs |
Initializes fixed schema indexes and buffer capacity. |
src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/FieldOptionTable.cs |
Caches field options and possible return types. |
src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/FieldOptions.cs |
Enumerates cached options with the previous schema first. |
src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/FieldOption.cs |
Stores per-schema field-resolution metadata. |
src/HotChocolate/Fusion/src/Fusion.Composition/Options/ThrowHelper.cs |
Adds an exception for unregistered source schemas. |
Review effort: Balanced
…or is constructed
… its lookup schemas
michaelstaib
force-pushed
the
mst/fusion-sat-field-options
branch
from
November 2, 2026 08:42
59a9d51 to
0633060
Compare
This was referenced Nov 17, 2026
This was referenced Nov 22, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 43 others
AdCodicem/AdCodicem.ValueObjects#274
Closed
This was referenced Nov 30, 2026
Merged
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.
The satisfiability validator now computes the options of each output field once (the schemas that can resolve it, with whether the field is partial, its requirements and its event stream message in each schema) instead of on every visit. It also registers every source schema when it is constructed, and when it collects the lookup schemas of a type it checks only the schemas that the type's lookups name. Composition output is unchanged: on 27,196 generated federations the validator logs the same errors in the same order as before. A new test covers a federation of 65 source schemas. Benchmarks are still pending. This builds on #10702.