Skip to content

[Fusion] Allow @require intermediates from the requiring schema#9796

Merged
glen-84 merged 2 commits into
mainfrom
gai/fix-circular-require-validation
May 29, 2026
Merged

[Fusion] Allow @require intermediates from the requiring schema#9796
glen-84 merged 2 commits into
mainfrom
gai/fix-circular-require-validation

Conversation

@glen-84

@glen-84 glen-84 commented May 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Fix RequirementsValidator to distinguish leaf fields from intermediate (navigation) fields when computing candidate source schemas for a requirement. Leaves still exclude the target schema (the gateway must source their values from elsewhere); intermediates now include all schemas, since the gateway can resolve a navigation step locally in the requiring schema as part of executing the requiring field.
  • This unblocks RequiresCircular (federation-gateway-audit requires-circular), which has Post.byNovice in schema B requiring author { yearsOfExperience } where Post.author is only declared in B. The previous logic excluded B wholesale and reported Post.author as unreachable; the new logic allows the intermediate author to come from B (where it's resolved locally) while still requiring yearsOfExperience (the leaf) from outside B.

Test plan

  • dotnet test src/HotChocolate/Fusion/test/Fusion.Composition.Tests --filter "FullyQualifiedName~SatisfiabilityValidatorTests|FullyQualifiedName~RequirementsValidatorTests" — 64 passed, 0 skipped, 0 failed on net8.0, net9.0, and net10.0.
  • Full HotChocolate.Fusion.Composition.Tests — 498 passed, 0 skipped, 0 failed across all three TFMs.

Copilot AI review requested due to automatic review settings May 29, 2026 08:47

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 updates Fusion composition satisfiability validation so @require paths can use intermediate navigation fields from the requiring schema while still requiring leaf values to come from another schema. It also enables the previously skipped circular-requirements audit test.

Changes:

  • Distinguishes leaf vs. intermediate fields when computing candidate schemas for requirement validation.
  • Re-enables RequiresCircular as a passing satisfiability validator test.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/HotChocolate/Fusion/src/Fusion.Composition/Satisfiability/RequirementsValidator.cs Allows intermediate requirement fields to include the excluded schema as a candidate source.
src/HotChocolate/Fusion/test/Fusion.Composition.Tests/SatisfiabilityValidatorTests.cs Unskips the circular @require satisfiability test.

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

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@glen-84 glen-84 merged commit 1063f8b into main May 29, 2026
279 of 281 checks passed
@glen-84 glen-84 deleted the gai/fix-circular-require-validation branch May 29, 2026 11:04
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