Repository navigation
[Fusion] Fix composition crash on unimplemented merged interface field - #9821
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a post-merge validation crash in Fusion composition when merged interface fields are not implemented by every implementing type, replacing a failing dictionary index with a guarded lookup so validation can continue and surface the intended INTERFACE_FIELD_NO_IMPLEMENTATION error from the appropriate rule.
Changes:
- Updated
ImplementedByInaccessibleRuleto useTryGetFieldand skip interface fields that aren’t present on the implementing type (instead of throwingKeyNotFoundException). - Added a regression test ensuring
ImplementedByInaccessibleRulevalidation does not crash when merged interfaces contain disjoint fields across subgraphs.
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/PostMergeValidationRules/ImplementedByInaccessibleRule.cs | Prevents crash by guarding field lookup on implementing types during interface-field iteration. |
| src/HotChocolate/Fusion/test/Fusion.Composition.Tests/PostMergeValidationRules/ImplementedByInaccessibleRuleTests.cs | Adds coverage for merged interface unions where implementers don’t all define every interface field. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jun 3, 2026
This was referenced Jun 16, 2026
This was referenced Jul 2, 2026
Closed
Closed
This was referenced Aug 31, 2026
This was referenced Sep 8, 2026
This was referenced Sep 17, 2026
This was referenced Sep 28, 2026
This was referenced Oct 5, 2026
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.
Summary
KeyNotFoundException: The given key '…' was not present in the dictionaryduring post-merge validation.ImplementedByInaccessibleRuleindexedtype.Fields[interfaceField.Name]directly, assuming every implementing type provides every field of the merged interface. When a type implements the interface but is missing a field contributed by another subgraph, the lookup threw.TryGetFieldand skip absent fields; the unimplemented-field case is already reported byInterfaceFieldNoImplementationRule, which now surfaces a clearINTERFACE_FIELD_NO_IMPLEMENTATIONerror instead of an opaque crash.Test plan
ImplementedByInaccessibleRuleTests.Validate_MergedInterfaceFieldNotOnAllImplementers_Succeeds, which merges two subgraphs whose shared interface has disjoint fields (previously crashed).ImplementedByInaccessibleRuleTestspass, including the 6 existing@inaccessibledetection cases.