Skip to content

feat: adopt Sangria's overlapping fields algorithm#4840

Open
yaacovCR wants to merge 3 commits into
graphql:17.x.xfrom
yaacovCR:sangria
Open

feat: adopt Sangria's overlapping fields algorithm#4840
yaacovCR wants to merge 3 commits into
graphql:17.x.xfrom
yaacovCR:sangria

Conversation

@yaacovCR

Copy link
Copy Markdown
Contributor

Replace the recursive pairwise validator with an indexed field-set graph algorithm adapted from Sangria. Preserve GraphQL.js error messages as closely as practical through representative conflict sampling, nested reasons, stable source ordering, and dedicated fragment-argument diagnostics.

Prior art/context:

@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

@yaacovCR is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@yaacovCR yaacovCR added the PR: feature 🚀 requires increase of "minor" version number label Jul 20, 2026
@yaacovCR
yaacovCR force-pushed the sangria branch 2 times, most recently from 873981c to eb4ee4d Compare July 21, 2026 19:43
yaacovCR added 3 commits July 22, 2026 17:19
Adopt Sangria's grouped, cached field-set algorithm while preserving GraphQL.js error paths, wording, and source nodes as closely as possible.

Keep the established validator for documents using the experimental fragment-arguments syntax so the core algorithm can be reviewed independently of invocation-specific variable binding.

Bound all work performed by this rule with an internal 100,000-unit budget. Charge field collection and comparison, merged field-set construction, fragment expansion, grouping, and proof work where each operation occurs.

This follows the original GraphQL.js performance issue, Sangria's grouped-algorithm pull request, and Sangria's validation performance issue.
Bind fragment variables as compact scopes on the same selection-set graph, reject incompatible spread arguments before fieldless-root canonicalization, and share alpha-equivalent bound proofs.

Apply the same 100,000-unit total-work budget to bound field-set expansion, argument canonicalization, grouping, comparisons, reporting, and proof caching. Replacing the fallback pairwise fragment comparisons with grouped bound proofs lets repeated fragment bindings consume fewer units without changing the limit.

This builds on the fragment arguments proposal and its GraphQL.js implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: feature 🚀 requires increase of "minor" version number

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant