Skip to content

[Fusion] Do not apply "InferKeysFromLookups" to invalid lookup fields#9541

Merged
glen-84 merged 5 commits intomainfrom
gai/improve-infer-keys-from-lookups
Apr 13, 2026
Merged

[Fusion] Do not apply "InferKeysFromLookups" to invalid lookup fields#9541
glen-84 merged 5 commits intomainfrom
gai/improve-infer-keys-from-lookups

Conversation

@glen-84
Copy link
Copy Markdown
Member

@glen-84 glen-84 commented Apr 13, 2026

Summary of the changes (Less than 80 chars)

  • [Fusion] Do not apply "InferKeysFromLookups" to invalid lookup fields.

Copilot AI review requested due to automatic review settings April 13, 2026 10:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Fusion source schema preprocessing to avoid inferring entity keys from lookup fields that are invalid per lookup constraints (e.g., no arguments, non-null return type, list return type).

Changes:

  • Filter @lookup fields in InferKeysFromLookups() to exclude invalid lookup field shapes (no args / non-null / list).
  • Add a regression test covering a mix of valid + invalid lookup fields to ensure only valid lookups contribute inferred @key directives.

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/SourceSchemaPreprocessor.cs Excludes invalid @lookup fields from key inference to prevent incorrect @key directive application.
src/HotChocolate/Fusion/test/Fusion.Composition.Tests/SourceSchemaPreprocessorTests.cs Adds coverage ensuring invalid lookup fields do not contribute to inferred keys.

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

@glen-84 glen-84 merged commit 666707b into main Apr 13, 2026
134 checks passed
@glen-84 glen-84 deleted the gai/improve-infer-keys-from-lookups branch April 13, 2026 13:19
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (2732654) to head (8d09975).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #9541   +/-   ##
============================
============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants