Skip to content

feat: adopt Sangria's overlapping fields algorithm - #4840

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

yaacovCR wants to merge 12 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 7 times, most recently from 26742bc to 1133f4a Compare July 27, 2026 14:27
Motivation: compute a set key once when inserting or replacing a value.
Motivation: let field merging report a conflicting pair without reconstructing its ancestry.

Report one field or fragment-argument conflict per document at the two conflicting nodes. Clarify that aliases can be placed on the fields or their ancestors.
Motivation: merged field groups can reuse a source field under several parent types or fragment scopes.

Cache argument and directive preparation by field node, and allocate comparison maps when used.
Motivation: compare compatible field groups through representatives and merge their child selections before descending.

Cache merged sets and check common-parent groups separately from response shapes. Retain the complexity budget and stop at the first conflict.

Use the existing traversal for documents declaring fragment variables during this transition. Exclude that fallback from coverage requirements while exercising it with the existing tests.
Motivation: use merged-set comparisons for fragment arguments as well as ordinary fragments.

Cache collections by fragment binding and retain each field scope through child merges. Keep the retired traversal isolated for the following cleanup commit.
Motivation: retain only the active merged-set checker.

Delete the retired traversal, its pair caches, and transitional coverage and unused-code directives.
Motivation: avoid callback allocation and repeated key construction when merging child selections.

Spend the same per-collection budget in one call.
Motivation: reuse prepared field information directly during merged checks.

Keep source-node sharing across parent types and fragment bindings.
Motivation: the pending collection set already identifies fragments without parameters.

Retain the per-definition binding check for parameterized fragments.
Motivation: share direct response-shape checks between full and shape-only traversals.
Motivation: common-parent checks can also validate their child response shapes.

Use one full traversal, with a separate response-shape traversal where multiple concrete parent groups require comparison. Cover reuse between shape-only and full comparisons.

This branch has not been deployed

No deployments
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