Don't report a shared fragment as a fragment cycle - #886
Open
toddburnside wants to merge 1 commit into
Open
Conversation
`validateVariablesAndFragments` accumulated visited fragments into a single
`seen` set spanning the whole traversal rather than tracking the fragments on
the current path. A fragment reachable by more than one path was therefore
reported as a cycle, e.g.
fragment a on T { x { ...c } y { ...b } }
fragment b on U { z { ...c } }
fragment c on V { w }
failed with "Fragment cycle starting from 'a'".
Replace the check with a proper DFS: `path` holds the fragments on the current
traversal path and `done` those already explored in full, a fragment joins
`done` only after its references have been explored, and the `path` check
precedes the `done` check. Genuine recursion is still detected, and reported
against the same fragment as before.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lyt6Er1f7k4DDcNBoZEUGS
toddburnside
force-pushed
the
fix-fragment-diamond-false-cycle
branch
from
August 3, 2026 18:37
49590d8 to
5568b7f
Compare
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.
validateVariablesAndFragmentsaccumulated visited fragments into a singleseenset spanning the whole traversal rather than tracking the fragments on the current path. A fragment reachable by more than one path was therefore reported as a cycle, e.g.failed with "Fragment cycle starting from 'a'".
Replace the check with a proper DFS:
pathholds the fragments on the current traversal path anddonethose already explored in full, a fragment joinsdoneonly after its references have been explored, and thepathcheck precedes thedonecheck. Genuine recursion is still detected, and reported against the same fragment as before.Claude-Session: https://claude.ai/code/session_01Lyt6Er1f7k4DDcNBoZEUGS