Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Guard against unused fragments#70

Merged
ruudk merged 1 commit into
mainfrom
guard-unused-fragments
May 15, 2026
Merged

Guard against unused fragments#70
ruudk merged 1 commit into
mainfrom
guard-unused-fragments

Conversation

@ruudk
Copy link
Copy Markdown
Owner

@ruudk ruudk commented May 15, 2026

Fragments defined in .graphql files or .twig templates were silently generated even when nothing ever spread them, leaving orphan generated classes that nobody could discover were safe to delete.

Compute reachability from operation spreads (plus inline #[GeneratedGraphQLFragment] contracts, which are intentionally standalone, so what they spread counts as used) through the transitive fragment-spread graph. Any file-defined fragment that is not reachable is now reported. Under --ensure-sync this is a hard error that fails the run after listing every offender; otherwise it is a warning and generation continues. Inline contracts themselves are out of scope — only fragments a developer can simply delete are flagged.

Fragments defined in `.graphql` files or `.twig` templates were
silently generated even when nothing ever spread them, leaving orphan
generated classes that nobody could discover were safe to delete.

Compute reachability from operation spreads (plus inline
`#[GeneratedGraphQLFragment]` contracts, which are intentionally
standalone, so what they spread counts as used) through the transitive
fragment-spread graph. Any file-defined fragment that is not reachable
is now reported. Under `--ensure-sync` this is a hard error that fails
the run after listing every offender; otherwise it is a warning and
generation continues. Inline contracts themselves are out of scope —
only fragments a developer can simply delete are flagged.
@ruudk ruudk enabled auto-merge (squash) May 15, 2026 12:13
@ruudk ruudk merged commit 1c04593 into main May 15, 2026
3 checks passed
@ruudk ruudk deleted the guard-unused-fragments branch May 15, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant