Skip to content

Fix composition crash on bare enum default for list-typed argument - #10244

Merged
michaelstaib merged 2 commits into
mainfrom
mst/fix-bare-enum-default-on-list-type
Aug 16, 2026
Merged

michaelstaib merged 2 commits into
mainfrom
mst/fix-bare-enum-default-on-list-type

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

Fixes #10222

Copilot AI lite review requested due to automatic review settings August 16, 2026 13:14

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

Fixes Fusion composition post-merge validation crashing on spec-lawful bare enum (and object) defaults supplied for list-typed arguments/fields by applying GraphQL list input coercion and hardening type handling to avoid invalid casts.

Changes:

  • Add list input coercion handling in EnumTypeDefaultValueInaccessibleRule.ValidateDefaultValue so non-list default values on list types validate against the element type.
  • Replace unsafe casts with type checks to prevent InvalidCastException and ignore undeclared input object fields during traversal.
  • Add regression tests covering bare enum defaults on list types (both accessible and inaccessible cases) plus object-default edge cases.

Reviewed changes

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

File Description
src/HotChocolate/Fusion/src/Fusion.Composition/PostMergeValidationRules/EnumTypeDefaultValueInaccessibleRule.cs Implements list input coercion and safe type checks to prevent crashes and correctly validate inaccessible enum references.
src/HotChocolate/Fusion/test/Fusion.Composition.Tests/PostMergeValidationRules/EnumTypeDefaultValueInaccessibleRuleTests.cs Adds regression coverage for bare enum/object defaults on list-typed inputs and verifies expected diagnostics.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Patch coverage

71.4% of changed lines covered (15/21)

File Covered Changed Patch %
…/EnumTypeDefaultValueInaccessibleRule.cs 15 21 71.4% 🔴
Uncovered changed lines (JSON)
{
  "sha": "1461fbe0916f1c3b3d3ed0edb4fc93dda42c62c0",
  "files": [
    { "path": "src/HotChocolate/Fusion/src/Fusion.Composition/PostMergeValidationRules/EnumTypeDefaultValueInaccessibleRule.cs", "ranges": [[87, 88], [103, 104], [119, 120]] }
  ]
}

Project coverage: 54.5% (243366/446649 lines)

@michaelstaib
michaelstaib merged commit 49f2ac4 into main Aug 16, 2026
15 checks passed
@michaelstaib
michaelstaib deleted the mst/fix-bare-enum-default-on-list-type branch August 16, 2026 15:23
This was referenced Aug 29, 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.

Fusion post-merge validation crashes with an InvalidCastException on a spec-lawful bare enum default for a list-typed argument

2 participants