Skip to content

[Fusion] Fix satisfiability validation skipping paths that reach an already visited type - #10673

Merged
michaelstaib merged 2 commits into
mainfrom
mst/composition-tests
Oct 23, 2026
Merged

michaelstaib merged 2 commits into
mainfrom
mst/composition-tests

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

Satisfiability validation checked each type once per source schema and skipped every later path that reached it the same way. Whether a field can be reached depends on the path, so the result depended on field order and some queries that cannot be planned still composed. Visits are now keyed by the set of schemas that can still serve the path, so every distinct path is checked. Schemas with such paths now fail composition. On a 745-subgraph schema, validation is faster (11.3 s to 2.6 s CPU) and reports the same errors.

Example:

# Schema A
type Query {
  objectShared: Object @shareable
  objectUnShared: Object
}

type Object {
  a: ID
}

# Schema B
type Query {
  objectShared: Object @shareable
}

type Object {
  b: ID
}

{ objectUnShared { b } } cannot be planned because Object has no lookup in B. Composition passed unless objectUnShared was declared first. It now fails in both orders.

…lready visited type

The validator deduplicated visits by (type, previous schema) and ignored
the path, so a later path that reaches the same type could reuse the
answer of an earlier path even when schema transitions differ, making the
result depend on field declaration order. Visits are now keyed by the set
of schemas that can still serve the path, plus the leaf where provided
selections or requirements depend on it.
@github-actions

Copy link
Copy Markdown
Contributor

Patch coverage

98.7% of changed lines covered (542/549)

File Covered Changed Patch %
…/Satisfiability/SourceSchemaTransitionHelper.cs 3 5 60.0% 🔴
…/Fusion.Composition/Satisfiability/ProvidedSelectionSetKey.cs 5 6 83.3% 🟡
…/Fusion/src/Fusion.Composition/SatisfiabilityValidator.cs 71 73 97.3% 🟡
…/src/Fusion.Composition/SatisfiabilityValidator.Viewer.cs 109 111 98.2% 🟡
…/Extensions/MutableOutputFieldDefinitionExtensions.cs 2 2 100.0% 🟢
…/Satisfiability/FusionLookupDirectiveCache.cs 9 9 100.0% 🟢
…/Fusion.Composition/Satisfiability/RequirementsValidator.cs 2 2 100.0% 🟢
…/Satisfiability/SatisfiabilityFactsBuilder.cs 2 2 100.0% 🟢
…/Fusion/src/Fusion.Composition/Satisfiability/SchemaSet.cs 1 1 100.0% 🟢
…/src/Fusion.Composition/Satisfiability/SchemaSetTable.cs 89 89 100.0% 🟢
…/Fusion/src/Fusion.Composition/Satisfiability/VisitKey.cs 6 6 100.0% 🟢
…/Fusion/src/Fusion.Composition/Satisfiability/VisitLeaf.cs 5 5 100.0% 🟢
…/src/Fusion.Composition/SatisfiabilityValidator.VisitKeys.cs 238 238 100.0% 🟢
Uncovered changed lines (JSON)
{
  "sha": "0f5798e0b80be432d4999a82d10e6471dac13828",
  "files": [
    { "path": "src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/SourceSchemaTransitionHelper.cs", "ranges": [[141, 142]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/ProvidedSelectionSetKey.cs", "ranges": [[22, 22]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Composition/SatisfiabilityValidator.cs", "ranges": [[436, 437]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Composition/SatisfiabilityValidator.Viewer.cs", "ranges": [[155, 155], [166, 166]] }
  ]
}

Project coverage: 59.3% (315637/532063 lines)

@michaelstaib
michaelstaib merged commit 31a0403 into main Oct 23, 2026
158 checks passed
@michaelstaib
michaelstaib deleted the mst/composition-tests branch October 23, 2026 11:22
This was referenced Oct 25, 2026
This was referenced Nov 1, 2026
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.

1 participant