Skip to content

Fix false @defer/@stream label collision in reused fragments - #9709

Merged
glen-84 merged 4 commits into
mainfrom
gai/issue-9705
May 19, 2026
Merged

glen-84 merged 4 commits into
mainfrom
gai/issue-9705

Conversation

@glen-84

@glen-84 glen-84 commented May 15, 2026 •

Copy link
Copy Markdown
Member

Closes #9705

Copilot AI review requested due to automatic review settings May 15, 2026 11:04

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 fixes validation for @defer/@stream label uniqueness so reused fragments do not falsely collide with themselves during document traversal.

Changes:

  • Tracks processed @defer/@stream directive nodes to count each lexical directive once.
  • Adds regression tests for reused fragments with @defer and @stream.
  • Adds a snapshot for the remaining valid duplicate-label error case.

Reviewed changes

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

File Description
src/HotChocolate/Core/src/Validation/Rules/DirectiveVisitor.cs Adds processed directive tracking to avoid duplicate label validation for the same reused fragment directive.
src/HotChocolate/Core/test/Validation.Tests/DeferAndStreamDirectiveLabelsAreUniqueTests.cs Adds regression tests for reused fragment labels and an outside duplicate.
src/HotChocolate/Core/test/Validation.Tests/__snapshots__/DeferAndStreamDirectiveLabelsAreUniqueTests.Label_Duplicate_When_Reused_Fragment_Label_Also_Used_Outside.snap Captures the expected duplicate-label validation error.

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

Comment thread src/HotChocolate/Core/src/Validation/Rules/DirectiveVisitor.cs
@glen-84
glen-84 marked this pull request as draft May 15, 2026 15:01
@glen-84
glen-84 marked this pull request as ready for review May 19, 2026 15:37
@glen-84
glen-84 merged commit 9a60aee into main May 19, 2026
272 of 274 checks passed
@glen-84
glen-84 deleted the gai/issue-9705 branch May 19, 2026 15:46
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.

issue in defer/stream label uniqueness validation

2 participants