Repository navigation
test(incremental): document bugs in shared deferred work - #4859
Conversation
|
@duckki is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel. A member of the Team first needs to authorize it. |
|
This is a real bug. But, the current proposed fix may not be the right fix. I'm validating a new fix.
|
|
Updated the fix to retain failures and buffered values until their defer groups are announced, and to cancel children discovered after their parent fails. |
|
Added ready-group tracking to avoid repeated scans of unrelated pending roots while preserving the retained-outcome fix. Local paired stress tests show runtime reductions of 61% for 1,024 independent defer groups and 54% for shared contributors, with little change in retained heap. These are stress-test results, not expected application-wide gains. |
The tests in this PR so far exposed existing bugs surrounding premature error completions and successful shared results that could be lost or delayed. This commit preserves those findings by adding new tests in the existing workspace style, but zeroes out the implementation changes to leave the necessary implementation changes to follow-up PRs. In other words, the insights from this PR into the existing bugs are preserved, but we will reassess the implementation changes. - The new tests are temporarily disabled by skip functionality. - Necessary changes to existing tests are outlined by comments.
72ddd7f to
1c9b86e
Compare
|
Thanks @duckki => this is amazing! I am taking this PR as tests that currently fail that I will fix in follow-up commits differently than the approach you have here. |
Previously, we could skip a nested deferred fragment whose shared fields had succeeded before its parent finished. That was incorrect when the shared data had not yet been delivered. If the other fragment failed on a separate field, the data was lost; if its separate fields succeeded later, the data was delayed. This commit announces the nested fragment and delivers its successful shared data when its parent completes. The data, including any shared stream, can therefore reach the client without waiting for the other fragment's separate fields. ## @defer: another fragment fails on a separate field ```graphql { hero { ... @defer(label: "R") { nonNullName id } ... @defer(label: "P") { name ... @defer(label: "C") { id } } } } ``` R and C share `id`, which returns `1`. R fails because its own `nonNullName` returns `null`. After that error is sent, P's `name` resolves to `"Luke"`. Both versions start with: ```json { "data": {"hero": {}}, "pending": [ {"id": "0", "path": ["hero"], "label": "R"}, {"id": "1", "path": ["hero"], "label": "P"} ], "hasNext": true } ``` Then R fails: ```json { "hasNext": true, "completed": [ { "id": "0", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7} ], "path": ["hero", "nonNullName"] } ] } ] } ``` **Before this fix:** Previously, finishing P ended the response without announcing C or sending `id`, even though `id` had succeeded. Response 3: ```json { "hasNext": false, "incremental": [ {"id": "1", "data": {"name": "Luke"}} ], "completed": [ {"id": "1"} ] } ``` **After this fix:** This commit announces C and delivers `id` when P finishes, so R's separate failure no longer loses C's data. Response 3: ```json { "hasNext": false, "pending": [ {"id": "2", "path": ["hero"], "label": "C"} ], "incremental": [ {"id": "1", "data": {"name": "Luke"}}, {"id": "2", "data": {"id": "1"}} ], "completed": [ {"id": "1"}, {"id": "2"} ] } ``` ## @defer: another fragment's separate field is slower ```graphql { hero { ... @defer(label: "R") { nonNullName id } ... @defer(label: "P") { name ... @defer(label: "C") { id } } } } ``` Here all three fields succeed. `id` returns `1` immediately. After the initial response, P's `name` resolves to `"Luke"`. R's `nonNullName` stays pending until after P's response, then also resolves to `"Luke"`. Both versions start with: ```json { "data": {"hero": {}}, "pending": [ {"id": "0", "path": ["hero"], "label": "R"}, {"id": "1", "path": ["hero"], "label": "P"} ], "hasNext": true } ``` **Before this fix:** Previously, P completed without announcing C. The shared `id` wasn't sent until R's separate `nonNullName` finished, unnecessarily delaying data that C was ready to deliver. Response 2: ```json { "hasNext": true, "incremental": [ {"id": "1", "data": {"name": "Luke"}} ], "completed": [ {"id": "1"} ] } ``` Response 3: ```json { "hasNext": false, "incremental": [ {"id": "0", "data": {"nonNullName": "Luke"}}, {"id": "0", "data": {"id": "1"}} ], "completed": [ {"id": "0"} ] } ``` **After this fix:** This commit delivers `id` through C as soon as P finishes. R sends its separate field later. Response 2: ```json { "hasNext": true, "pending": [ {"id": "2", "path": ["hero"], "label": "C"} ], "incremental": [ {"id": "1", "data": {"name": "Luke"}}, {"id": "2", "data": {"id": "1"}} ], "completed": [ {"id": "1"}, {"id": "2"} ] } ``` Response 3: ```json { "hasNext": false, "incremental": [ {"id": "0", "data": {"nonNullName": "Luke"}} ], "completed": [ {"id": "0"} ] } ``` ## @stream: a separate field fails before the list is delivered ```graphql { nestedObject { ... @defer(label: "R") { nonNullScalarField ...Friends } ... @defer(label: "P") { scalarField ... @defer(label: "C") { ...Friends } } } } fragment Friends on NestedObject { nestedFriendList @stream(initialCount: 0) { name } } ``` The shared `nestedFriendList` returns Luke, Han, and Leia immediately. R fails because its own `nonNullScalarField` returns `null`. After that error is sent, P's `scalarField` resolves to `"parent"`. Both versions start with: ```json { "data": {"nestedObject": {}}, "pending": [ {"id": "0", "path": ["nestedObject"], "label": "R"}, {"id": "1", "path": ["nestedObject"], "label": "P"} ], "hasNext": true } ``` Then R fails: ```json { "hasNext": true, "completed": [ { "id": "0", "errors": [ { "message": "Cannot return null for non-nullable field NestedObject.nonNullScalarField.", "locations": [ {"line": 4, "column": 7} ], "path": ["nestedObject", "nonNullScalarField"] } ] } ] } ``` **Before this fix:** Previously, P completed and the response ended. C and the stream were never announced, so neither the empty list nor its items were sent. Response 3: ```json { "hasNext": false, "incremental": [ {"id": "1", "data": {"scalarField": "parent"}} ], "completed": [ {"id": "1"} ] } ``` **After this fix:** This commit announces C and the stream with P's result. C sends the empty list, then the stream sends all three friends, so R's separate failure no longer loses the list. Response 3: ```json { "hasNext": true, "pending": [ {"id": "2", "path": ["nestedObject"], "label": "C"}, {"id": "3", "path": ["nestedObject", "nestedFriendList"]} ], "incremental": [ {"id": "1", "data": {"scalarField": "parent"}}, {"id": "2", "data": {"nestedFriendList": []}} ], "completed": [ {"id": "1"}, {"id": "2"} ] } ``` Response 4: ```json { "hasNext": false, "incremental": [ {"id": "3", "items": [{"name": "Luke"}, {"name": "Han"}, {"name": "Leia"}]} ], "completed": [ {"id": "3"} ] } ``` Follow-up to merged PR [graphql#4859](graphql#4859), which documented these bugs with skipped regression tests. This commit implements the successful-result fix and enables its regression tests. Additional integration tests cover delayed delivery and later owners. Co-authored-by: Duckki Oe <[email protected]>
Follow-up to merged PR [graphql#4859](graphql#4859). Thanks to Duckki Oe (@duckki) for pointing out these issues and providing an initial fix. That PR documented these bugs with skipped regression tests. This commit implements the successful-result fix and enables its regression tests. Additional integration tests cover delayed delivery and later owners. Previously, we could skip a nested deferred fragment whose shared fields had succeeded before its parent finished. That was incorrect when the shared data had not yet been delivered. If the other fragment failed on a separate field, the data was lost; if its separate fields succeeded later, the data was delayed. This commit announces the nested fragment and delivers its successful shared data when its parent completes. The data, including any shared stream, can therefore reach the client without waiting for the other fragment's separate fields. ## @defer: another fragment fails on a separate field ```graphql { hero { ... @defer(label: "R") { nonNullName id } ... @defer(label: "P") { name ... @defer(label: "C") { id } } } } ``` R and C share `id`, which returns `1`. R fails because its own `nonNullName` returns `null`. After that error is sent, P's `name` resolves to `"Luke"`. Both versions start with: ```json { "data": {"hero": {}}, "pending": [ {"id": "0", "path": ["hero"], "label": "R"}, {"id": "1", "path": ["hero"], "label": "P"} ], "hasNext": true } ``` Then R fails: ```json { "hasNext": true, "completed": [ { "id": "0", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7} ], "path": ["hero", "nonNullName"] } ] } ] } ``` **Before this fix:** Previously, finishing P ended the response without announcing C or sending `id`, even though `id` had succeeded. Response 3: ```json { "hasNext": false, "incremental": [ {"id": "1", "data": {"name": "Luke"}} ], "completed": [ {"id": "1"} ] } ``` **After this fix:** This commit announces C and delivers `id` when P finishes, so R's separate failure no longer loses C's data. Response 3: ```json { "hasNext": false, "pending": [ {"id": "2", "path": ["hero"], "label": "C"} ], "incremental": [ {"id": "1", "data": {"name": "Luke"}}, {"id": "2", "data": {"id": "1"}} ], "completed": [ {"id": "1"}, {"id": "2"} ] } ``` ## @defer: another fragment's separate field is slower ```graphql { hero { ... @defer(label: "R") { nonNullName id } ... @defer(label: "P") { name ... @defer(label: "C") { id } } } } ``` Here all three fields succeed. `id` returns `1` immediately. After the initial response, P's `name` resolves to `"Luke"`. R's `nonNullName` stays pending until after P's response, then also resolves to `"Luke"`. Both versions start with: ```json { "data": {"hero": {}}, "pending": [ {"id": "0", "path": ["hero"], "label": "R"}, {"id": "1", "path": ["hero"], "label": "P"} ], "hasNext": true } ``` **Before this fix:** Previously, P completed without announcing C. The shared `id` wasn't sent until R's separate `nonNullName` finished, unnecessarily delaying data that C was ready to deliver. Response 2: ```json { "hasNext": true, "incremental": [ {"id": "1", "data": {"name": "Luke"}} ], "completed": [ {"id": "1"} ] } ``` Response 3: ```json { "hasNext": false, "incremental": [ {"id": "0", "data": {"nonNullName": "Luke"}}, {"id": "0", "data": {"id": "1"}} ], "completed": [ {"id": "0"} ] } ``` **After this fix:** This commit delivers `id` through C as soon as P finishes. R sends its separate field later. Response 2: ```json { "hasNext": true, "pending": [ {"id": "2", "path": ["hero"], "label": "C"} ], "incremental": [ {"id": "1", "data": {"name": "Luke"}}, {"id": "2", "data": {"id": "1"}} ], "completed": [ {"id": "1"}, {"id": "2"} ] } ``` Response 3: ```json { "hasNext": false, "incremental": [ {"id": "0", "data": {"nonNullName": "Luke"}} ], "completed": [ {"id": "0"} ] } ``` ## @stream: a separate field fails before the list is delivered ```graphql { nestedObject { ... @defer(label: "R") { nonNullScalarField ...Friends } ... @defer(label: "P") { scalarField ... @defer(label: "C") { ...Friends } } } } fragment Friends on NestedObject { nestedFriendList @stream(initialCount: 0) { name } } ``` The shared `nestedFriendList` returns Luke, Han, and Leia immediately. R fails because its own `nonNullScalarField` returns `null`. After that error is sent, P's `scalarField` resolves to `"parent"`. Both versions start with: ```json { "data": {"nestedObject": {}}, "pending": [ {"id": "0", "path": ["nestedObject"], "label": "R"}, {"id": "1", "path": ["nestedObject"], "label": "P"} ], "hasNext": true } ``` Then R fails: ```json { "hasNext": true, "completed": [ { "id": "0", "errors": [ { "message": "Cannot return null for non-nullable field NestedObject.nonNullScalarField.", "locations": [ {"line": 4, "column": 7} ], "path": ["nestedObject", "nonNullScalarField"] } ] } ] } ``` **Before this fix:** Previously, P completed and the response ended. C and the stream were never announced, so neither the empty list nor its items were sent. Response 3: ```json { "hasNext": false, "incremental": [ {"id": "1", "data": {"scalarField": "parent"}} ], "completed": [ {"id": "1"} ] } ``` **After this fix:** This commit announces C and the stream with P's result. C sends the empty list, then the stream sends all three friends, so R's separate failure no longer loses the list. Response 3: ```json { "hasNext": true, "pending": [ {"id": "2", "path": ["nestedObject"], "label": "C"}, {"id": "3", "path": ["nestedObject", "nestedFriendList"]} ], "incremental": [ {"id": "1", "data": {"scalarField": "parent"}}, {"id": "2", "data": {"nestedFriendList": []}} ], "completed": [ {"id": "1"}, {"id": "2"} ] } ``` Response 4: ```json { "hasNext": false, "incremental": [ {"id": "3", "items": [{"name": "Luke"}, {"name": "Han"}, {"name": "Leia"}]} ], "completed": [ {"id": "3"} ] } ``` Co-authored-by: Duckki Oe <[email protected]>
Follow-up to merged PR [graphql#4868](graphql#4868). Thanks to Duckki Oe (@duckki) for identifying these issues and providing an initial fix in [graphql#4859](graphql#4859). PR graphql#4868 fixed successful shared results. A nested fragment can now deliver its ready data, including a shared stream, as soon as its parent finishes. Another fragment's separate failure or slower fields no longer cause that data to be lost or delayed. Previously, even after that fix, a shared non-null field failure could complete a nested deferred fragment before it was announced, although its parent's separate fields succeeded. This was incorrect: the response referred to an ID that the client had never received in `pending`. This commit waits until the nested fragment is announced before sending its error completion. The client therefore receives its `pending` entry before its completion, including when both appear in the same response. If several shared fields have already failed, the fragment completes once with one shared error. Its parent's successful data is still delivered. Late outcomes and descendants belonging only to failed fragments are discarded. Shared work needed by a surviving fragment remains available. This enables the remaining regression tests introduced in graphql#4859 and adds integration coverage for error ordering, late outcomes, and shared streams whose remaining fragment fails. ## @defer: the shared field fails while the parent succeeds ```graphql { hero { ... @defer(label: "R") { nonNullName } ... @defer(label: "P") { name ... @defer(label: "C") { nonNullName } } } } ``` `nonNullName` returns `null`, failing R and C. P's separate `name` returns `"Luke"` successfully. Both results are available immediately. Both versions start with: ```json { "data": {"hero": {}}, "pending": [ {"id": "0", "path": ["hero"], "label": "R"}, {"id": "1", "path": ["hero"], "label": "P"} ], "hasNext": true } ``` **Before this fix:** Previously, C completed as ID `"2"` even though only IDs `"0"` and `"1"` had been announced. Response 2: ```json { "hasNext": false, "incremental": [ {"id": "1", "data": {"name": "Luke"}} ], "completed": [ { "id": "0", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 9, "column": 9} ], "path": ["hero", "nonNullName"] } ] }, { "id": "2", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 9, "column": 9} ], "path": ["hero", "nonNullName"] } ] }, {"id": "1"} ] } ``` **After this fix:** This commit announces C as ID `"2"` before sending its error completion, so the client can identify the failed fragment. P still returns its successful `name`. Response 2: ```json { "hasNext": false, "pending": [ {"id": "2", "path": ["hero"], "label": "C"} ], "incremental": [ {"id": "1", "data": {"name": "Luke"}} ], "completed": [ { "id": "0", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 9, "column": 9} ], "path": ["hero", "nonNullName"] } ] }, {"id": "1"}, { "id": "2", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 9, "column": 9} ], "path": ["hero", "nonNullName"] } ] } ] } ``` ## @defer: two shared fields have already failed ```graphql { hero { ... @defer(label: "R1") { first: nonNullName } ... @defer(label: "R2") { second: nonNullName } ... @defer(label: "P") { name ... @defer(label: "C") { first: nonNullName second: nonNullName } } } } ``` `name` returns `"Luke"`. Both `first` and `second` return `null`. C shares `first` with R1 and `second` with R2; both have failed by the time P completes. Both versions start with: ```json { "data": {"hero": {}}, "pending": [ {"id": "0", "path": ["hero"], "label": "R1"}, {"id": "1", "path": ["hero"], "label": "R2"}, {"id": "2", "path": ["hero"], "label": "P"} ], "hasNext": true } ``` **Before this fix:** Previously, C completed as ID `"3"` without a `pending` entry. Response 2: ```json { "hasNext": false, "incremental": [ {"id": "2", "data": {"name": "Luke"}} ], "completed": [ { "id": "0", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 12, "column": 9} ], "path": ["hero", "first"] } ] }, { "id": "3", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 12, "column": 9} ], "path": ["hero", "first"] } ] }, { "id": "1", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 7, "column": 7}, {"line": 13, "column": 9} ], "path": ["hero", "second"] } ] }, {"id": "2"} ] } ``` **After this fix:** This commit announces C before completing it once with a shared error. In this example, its completion reports the `first` error. R1 and R2 each report their own error, and P delivers `name`. Response 2: ```json { "hasNext": false, "pending": [ {"id": "3", "path": ["hero"], "label": "C"} ], "incremental": [ {"id": "2", "data": {"name": "Luke"}} ], "completed": [ { "id": "0", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 12, "column": 9} ], "path": ["hero", "first"] } ] }, { "id": "1", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 7, "column": 7}, {"line": 13, "column": 9} ], "path": ["hero", "second"] } ] }, {"id": "2"}, { "id": "3", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 12, "column": 9} ], "path": ["hero", "first"] } ] } ] } ``` Co-authored-by: Duckki Oe <[email protected]>
…#4869) Follow-up to merged PR [#4868](#4868). Thanks to Duckki Oe (@duckki) for identifying these issues and providing an initial fix in [#4859](#4859). PR #4868 fixed successful shared results. A nested fragment can now deliver its ready data, including a shared stream, as soon as its parent finishes. Another fragment's separate failure or slower fields no longer cause that data to be lost or delayed. Previously, even after that fix, a shared non-null field failure could complete a nested deferred fragment before it was announced, although its parent's separate fields succeeded. This was incorrect: the response referred to an ID that the client had never received in `pending`. This PR waits until the nested fragment is announced before sending its error completion. The client therefore receives its `pending` entry before its completion, including when both appear in the same response. If several shared fields have already failed, the fragment completes once with one shared error. Its parent's successful data is still delivered. Late outcomes and descendants belonging only to failed fragments are discarded. Shared work needed by a surviving fragment remains available. This enables the remaining regression tests introduced in #4859 and adds integration coverage for error ordering, late outcomes, and shared streams whose remaining fragment fails. ## @defer: the shared field fails while the parent succeeds ```graphql { hero { ... @defer(label: "R") { nonNullName } ... @defer(label: "P") { name ... @defer(label: "C") { nonNullName } } } } ``` `nonNullName` returns `null`, failing R and C. P's separate `name` returns `"Luke"` successfully. Both results are available immediately. Both versions start with: ```json { "data": {"hero": {}}, "pending": [ {"id": "0", "path": ["hero"], "label": "R"}, {"id": "1", "path": ["hero"], "label": "P"} ], "hasNext": true } ``` **Before this fix:** Previously, C completed as ID `"2"` even though only IDs `"0"` and `"1"` had been announced. Response 2: ```json { "hasNext": false, "incremental": [ {"id": "1", "data": {"name": "Luke"}} ], "completed": [ { "id": "0", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 9, "column": 9} ], "path": ["hero", "nonNullName"] } ] }, { "id": "2", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 9, "column": 9} ], "path": ["hero", "nonNullName"] } ] }, {"id": "1"} ] } ``` **After this fix:** This commit announces C as ID `"2"` before sending its error completion, so the client can identify the failed fragment. P still returns its successful `name`. Response 2: ```json { "hasNext": false, "pending": [ {"id": "2", "path": ["hero"], "label": "C"} ], "incremental": [ {"id": "1", "data": {"name": "Luke"}} ], "completed": [ { "id": "0", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 9, "column": 9} ], "path": ["hero", "nonNullName"] } ] }, {"id": "1"}, { "id": "2", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 9, "column": 9} ], "path": ["hero", "nonNullName"] } ] } ] } ``` ## @defer: two shared fields have already failed ```graphql { hero { ... @defer(label: "R1") { first: nonNullName } ... @defer(label: "R2") { second: nonNullName } ... @defer(label: "P") { name ... @defer(label: "C") { first: nonNullName second: nonNullName } } } } ``` `name` returns `"Luke"`. Both `first` and `second` return `null`. C shares `first` with R1 and `second` with R2; both have failed by the time P completes. Both versions start with: ```json { "data": {"hero": {}}, "pending": [ {"id": "0", "path": ["hero"], "label": "R1"}, {"id": "1", "path": ["hero"], "label": "R2"}, {"id": "2", "path": ["hero"], "label": "P"} ], "hasNext": true } ``` **Before this fix:** Previously, C completed as ID `"3"` without a `pending` entry. Response 2: ```json { "hasNext": false, "incremental": [ {"id": "2", "data": {"name": "Luke"}} ], "completed": [ { "id": "0", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 12, "column": 9} ], "path": ["hero", "first"] } ] }, { "id": "3", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 12, "column": 9} ], "path": ["hero", "first"] } ] }, { "id": "1", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 7, "column": 7}, {"line": 13, "column": 9} ], "path": ["hero", "second"] } ] }, {"id": "2"} ] } ``` **After this fix:** This PR announces C before completing it once with a shared error. In this example, its completion reports the `first` error. R1 and R2 each report their own error, and P delivers `name`. Response 2: ```json { "hasNext": false, "pending": [ {"id": "3", "path": ["hero"], "label": "C"} ], "incremental": [ {"id": "2", "data": {"name": "Luke"}} ], "completed": [ { "id": "0", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 12, "column": 9} ], "path": ["hero", "first"] } ] }, { "id": "1", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 7, "column": 7}, {"line": 13, "column": 9} ], "path": ["hero", "second"] } ] }, {"id": "2"}, { "id": "3", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ {"line": 4, "column": 7}, {"line": 12, "column": 9} ], "path": ["hero", "first"] } ] } ] } ``` Co-authored-by: Duckki Oe <[email protected]>
This proposal extracts the multiple-error reporting idea from Duckki Oe's original implementation in [graphql#4859](graphql#4859). This is an optional follow-up to [graphql#4868](graphql#4868) and [graphql#4869](graphql#4869). Those changes already prevent lost or delayed successful results and completions for unannounced fragments, in line with graphql#4859. This PR extracts an additional element from graphql#4859, i.e. how many errored tasks to report for a delivery group with multiple shared tasks that have errored prior to the start of a deferred group. Currently, when several shared tasks have failed before a deferred group starts, the group completes with the first replayed error. This proposal includes every failure already cached by its retained, started tasks in that one completion. It exposes more information we already have, without waiting for other work. For example: ```graphql { hero { ... @defer(label: "R1") { first: nonNullName } ... @defer(label: "R2") { second: nonNullName } ... @defer(label: "P") { name ... @defer(label: "C") { first: nonNullName second: nonNullName } } } } ``` `first` and `second` both return `null`, failing R1 and R2 while P's `name` is still pending. R1 and R2 each report their own error. When `name` resolves to `"Luke"`, both versions announce C and complete P successfully. The final response on `17.x.x` is: ```json { "hasNext": false, "pending": [ { "id": "3", "path": [ "hero" ], "label": "C" } ], "incremental": [ { "id": "2", "data": { "name": "Luke" } } ], "completed": [ { "id": "2" }, { "id": "3", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ { "line": 4, "column": 7 }, { "line": 12, "column": 9 } ], "path": [ "hero", "first" ] } ] } ] } ``` With this proposal, the final response is: ```json { "hasNext": false, "pending": [ { "id": "3", "path": [ "hero" ], "label": "C" } ], "incremental": [ { "id": "2", "data": { "name": "Luke" } } ], "completed": [ { "id": "2" }, { "id": "3", "errors": [ { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ { "line": 4, "column": 7 }, { "line": 12, "column": 9 } ], "path": [ "hero", "first" ] }, { "message": "Cannot return null for non-nullable field Hero.nonNullName.", "locations": [ { "line": 7, "column": 7 }, { "line": 13, "column": 9 } ], "path": [ "hero", "second" ] } ] } ] } ``` The implementation moves cached-failure inspection from `startTask` to `startGroup`. It adds an additional pass over a group's tasks before starting new work to check for cached failures. This also ensures that a group already known to have failed does not start unnecessary tasks. Unlike the original implementation's retained group errors, this version reads the existing computation results. It adds no persistent group-error storage or WeakSet. Co-authored-by: Duckki Oe <[email protected]>
## v17.1.0 (2026-11-04) #### New Feature 🚀 * [#4852](#4852) spec change: allow empty selection sets ([@martinbonnin](https://github.com/martinbonnin)) * [#4905](#4905) feat: add maxComments parser option ([@yaacovCR](https://github.com/yaacovCR)) * [#4906](#4906) feat: add maxSourceLength parser option ([@yaacovCR](https://github.com/yaacovCR)) * [#4950](#4950) feat: configure list type nesting in the parser ([@yaacovCR](https://github.com/yaacovCR)) * [#4953](#4953) feat: configure printer indentation depth ([@yaacovCR](https://github.com/yaacovCR)) #### Bug Fix 🐞 * [#4837](#4837) fix(VariablesInAllowedPositionRule): allow fragments with variables prior to operations ([@yaacovCR](https://github.com/yaacovCR)) * [#4838](#4838) fix(DeferStreamDirectiveOnRootFieldRule): handle fragment cycles ([@yaacovCR](https://github.com/yaacovCR)) * [#4839](#4839) fix(OverlappingFieldsCanMergeRule): require same variable definitions ([@yaacovCR](https://github.com/yaacovCR)) * [#4853](#4853) fix(OverlappingFieldsCanMerge): fix var scope for fragment comparison cache ([@yaacovCR](https://github.com/yaacovCR)) * [#4841](#4841) Skip deferred fragments in collectFields only when same directive is used ([@robrichard](https://github.com/robrichard)) * [#4859](#4859) test(incremental): document bugs in shared deferred work ([@duckki](https://github.com/duckki)) * [#4868](#4868) fix(incremental): prevent lost or delayed successful shared results ([@yaacovCR](https://github.com/yaacovCR)) * [#4869](#4869) fix(incremental): prevent error completions for unannounced fragments ([@yaacovCR](https://github.com/yaacovCR)) * [#4865](#4865) fix(validation): keep argument defaults inside fragments ([@SashaMIT](https://github.com/SashaMIT)) * [#4879](#4879) fix(validation): keep collected fields separate by parent type ([@yaacovCR](https://github.com/yaacovCR)) * [#4895](#4895) fix(validation): bound conflict descriptions ([@yaacovCR](https://github.com/yaacovCR)) * [#4896](#4896) fix(validation): bound nested conflict locations ([@yaacovCR](https://github.com/yaacovCR)) * [#4898](#4898) perf(validation): prepare fragment spreads only for comparisons ([@yaacovCR](https://github.com/yaacovCR)) * [#4897](#4897) feat(validation): limit overlapping field complexity ([@yaacovCR](https://github.com/yaacovCR)) * [#4903](#4903) fix: rename maxTokens to maxLexicalTokens ([@yaacovCR](https://github.com/yaacovCR)) * [#4904](#4904) memoize pathToArray to reduce memory for multiple defers at the same path ([@robrichard](https://github.com/robrichard)) * [#4908](#4908) fix: pass parser options through buildSchema ([@yaacovCR](https://github.com/yaacovCR)) * [#4916](#4916) fix: bound shared fragment traversal in introspection validation ([@yaacovCR](https://github.com/yaacovCR)) * [#4929](#4929) fix: initialize subscription validation variables ([@yaacovCR](https://github.com/yaacovCR)) * [#4937](#4937) fix: skip disabled argument suggestions ([@yaacovCR](https://github.com/yaacovCR)) * [#4946](#4946) refactor: track fragment validation work ([@yaacovCR](https://github.com/yaacovCR)) * [#4949](#4949) refactor: account for subscription field collection ([@yaacovCR](https://github.com/yaacovCR)) * [#4951](#4951) refactor: account for field return type comparisons ([@yaacovCR](https://github.com/yaacovCR)) * [#4915](#4915) fix: align minified source location at chunk boundaries ([@fallintoplace](https://github.com/fallintoplace)) * [#4977](#4977) fix: keep minified EOF carets after the final character ([@yaacovCR](https://github.com/yaacovCR)) * [#4979](#4979) fix: reference ESM source maps from every emitted module ([@yaacovCR](https://github.com/yaacovCR)) * [#4980](#4980) fix: identify ESM modules in source map metadata ([@yaacovCR](https://github.com/yaacovCR)) * [#4983](#4983) fix: avoid inherited variable getters in nested literal values ([@yaacovCR](https://github.com/yaacovCR)) #### Docs 📝 <details> <summary> 4 PRs were merged </summary> * [#4986](#4986) docs: refresh the v16 and v17 API references ([@yaacovCR](https://github.com/yaacovCR)) * [#4987](#4987) docs: render constructor examples in the API reference ([@yaacovCR](https://github.com/yaacovCR)) * [#4988](#4988) docs: generate API reference during website builds ([@yaacovCR](https://github.com/yaacovCR)) * [#4989](#4989) docs: list v17 first in the API sidebar ([@yaacovCR](https://github.com/yaacovCR)) </details> #### Polish 💅 <details> <summary> 69 PRs were merged </summary> * [#4836](#4836) refactor: add map keyed by set membership ([@yaacovCR](https://github.com/yaacovCR)) * [#4843](#4843) polish(OverlappingFieldsCanMerge: add tests documenting existing behavior ([@yaacovCR](https://github.com/yaacovCR)) * [#4855](#4855) refactor(validation): add overlapping fields rule context ([@yaacovCR](https://github.com/yaacovCR)) * [#4856](#4856) refactor(validation): name the variable map type ([@yaacovCR](https://github.com/yaacovCR)) * [#4857](#4857) polish(validation): skip empty field comparisons ([@yaacovCR](https://github.com/yaacovCR)) * [#4851](#4851) test: accept non-null union implementing a nullable union ([@jayphelps](https://github.com/jayphelps)) * [#4845](#4845) polish(validateInputValue): cover invalid values in iterable input ([@vrana055](https://github.com/vrana055)) * [#4844](#4844) polish(introspection): cover __Type.description on wrapping types ([@vrana055](https://github.com/vrana055)) * [#4860](#4860) docs: fix incorrect API doc examples and copy-pasted descriptions ([@Cito](https://github.com/Cito)) * [#4867](#4867) refactor(incremental): extract maybeFinishGroup ([@yaacovCR](https://github.com/yaacovCR)) * [#4871](#4871) refactor(validation): rename NodeAndDef to FieldDetails ([@yaacovCR](https://github.com/yaacovCR)) * [#4872](#4872) refactor(validation): name field detail lists ([@yaacovCR](https://github.com/yaacovCR)) * [#4873](#4873) refactor(validation): rename NodeAndDefCollection to GroupedFieldSet ([@yaacovCR](https://github.com/yaacovCR)) * [#4874](#4874) refactor(validation): align field collection names with execution ([@yaacovCR](https://github.com/yaacovCR)) * [#4875](#4875) refactor(validation): convert FieldDetails tuples to objects ([@yaacovCR](https://github.com/yaacovCR)) * [#4876](#4876) refactor(validation): convert CollectFieldsResult tuples to objects ([@yaacovCR](https://github.com/yaacovCR)) * [#4877](#4877) refactor(validation): convert conflict tuples to objects ([@yaacovCR](https://github.com/yaacovCR)) * [#4878](#4878) refactor(validation): make unordered pair lookup independent of key order ([@yaacovCR](https://github.com/yaacovCR)) * [#4880](#4880) refactor(validation): rename VariableMap to VariableScope ([@yaacovCR](https://github.com/yaacovCR)) * [#4881](#4881) perf(validation): share field collections across scopes ([@yaacovCR](https://github.com/yaacovCR)) * [#4882](#4882) refactor(validation): check stream overlap in findConflict ([@yaacovCR](https://github.com/yaacovCR)) * [#4883](#4883) perf(validation): prepare field comparison data together ([@yaacovCR](https://github.com/yaacovCR)) * [#4885](#4885) perf(validation): reuse scope maps across equivalent fragment spreads ([@yaacovCR](https://github.com/yaacovCR)) * [#4886](#4886) refactor(validation): compare value structure directly ([@yaacovCR](https://github.com/yaacovCR)) * [#4888](#4888) refactor(validation): compare variable scope identities ([@yaacovCR](https://github.com/yaacovCR)) * [#4889](#4889) perf(validation): cache field-pair source comparisons ([@yaacovCR](https://github.com/yaacovCR)) * [#4890](#4890) perf(validation): cache source value preparation ([@yaacovCR](https://github.com/yaacovCR)) * [#4891](#4891) perf(validation): cache value scope dependencies ([@yaacovCR](https://github.com/yaacovCR)) * [#4892](#4892) perf(validation): cache source fragment spread preparation ([@yaacovCR](https://github.com/yaacovCR)) * [#4893](#4893) perf(validation): reuse matching response groups across scopes ([@yaacovCR](https://github.com/yaacovCR)) * [#4894](#4894) perf(validation): skip redundant inline selection-set checks ([@yaacovCR](https://github.com/yaacovCR)) * [#4902](#4902) perf: avoid repeated SetMap key construction ([@yaacovCR](https://github.com/yaacovCR)) * [#4920](#4920) perf: reuse fragment dependencies across operations ([@yaacovCR](https://github.com/yaacovCR)) * [#4921](#4921) perf: reuse fragment variable usages ([@yaacovCR](https://github.com/yaacovCR)) * [#4925](#4925) perf: share fragment collection across operations ([@yaacovCR](https://github.com/yaacovCR)) * [#4926](#4926) refactor: use context fragment lookups in directive validation ([@yaacovCR](https://github.com/yaacovCR)) * [#4927](#4927) perf: share subscription fragment lookups ([@yaacovCR](https://github.com/yaacovCR)) * [#4931](#4931) perf: reuse subscription directive paths ([@yaacovCR](https://github.com/yaacovCR)) * [#4932](#4932) perf: reuse introspection fragment checks ([@yaacovCR](https://github.com/yaacovCR)) * [#4933](#4933) perf: share completed directive checks ([@yaacovCR](https://github.com/yaacovCR)) * [#4935](#4935) test: cover source location lookups ([@yaacovCR](https://github.com/yaacovCR)) * [#4936](#4936) perf: share source location lookups ([@yaacovCR](https://github.com/yaacovCR)) * [#4938](#4938) perf: reuse required fragment arguments ([@yaacovCR](https://github.com/yaacovCR)) * [#4939](#4939) perf: remove an extra list item type check ([@yaacovCR](https://github.com/yaacovCR)) * [#4940](#4940) perf: reuse identical field return types ([@yaacovCR](https://github.com/yaacovCR)) * [#4941](#4941) perf: reuse field return type names ([@yaacovCR](https://github.com/yaacovCR)) * [#4942](#4942) perf: index directive argument names ([@yaacovCR](https://github.com/yaacovCR)) * [#4943](#4943) perf: index directive locations ([@yaacovCR](https://github.com/yaacovCR)) * [#4944](#4944) perf: reuse field return type descriptions ([@yaacovCR](https://github.com/yaacovCR)) * [#4945](#4945) perf: reuse supported AST kinds ([@yaacovCR](https://github.com/yaacovCR)) * [#4947](#4947) refactor: extract visitSelectionSets ([@yaacovCR](https://github.com/yaacovCR)) * [#4948](#4948) refactor: simplify referenced fragment collection ([@yaacovCR](https://github.com/yaacovCR)) * [#4952](#4952) refactor: stream printer output ([@yaacovCR](https://github.com/yaacovCR)) * [#4956](#4956) perf: skip unused argument lookup preparation ([@yaacovCR](https://github.com/yaacovCR)) * [#4957](#4957) perf: skip required argument preparation for argument-free fields ([@yaacovCR](https://github.com/yaacovCR)) * [#4958](#4958) perf: scan single source locations directly ([@yaacovCR](https://github.com/yaacovCR)) * [#4959](#4959) perf: store visitor edits in a flat array ([@yaacovCR](https://github.com/yaacovCR)) * [#4960](#4960) perf: skip selection sets with no fields to compare ([@yaacovCR](https://github.com/yaacovCR)) * [#4961](#4961) perf: allocate visitor edits only when needed ([@yaacovCR](https://github.com/yaacovCR)) * [#4963](#4963) perf: reuse the visitor array check ([@yaacovCR](https://github.com/yaacovCR)) * [#4964](#4964) perf: skip pair metadata for compatible leaf fields ([@yaacovCR](https://github.com/yaacovCR)) * [#4965](#4965) perf: prepare type name lookups only when needed ([@yaacovCR](https://github.com/yaacovCR)) * [#4972](#4972) perf: flatten input-value printing ([@yaacovCR](https://github.com/yaacovCR)) * [#4973](#4973) perf: avoid arrays for single-line printer text ([@yaacovCR](https://github.com/yaacovCR)) * [#4974](#4974) perf: assemble printer output as a string ([@yaacovCR](https://github.com/yaacovCR)) * [#4975](#4975) perf: skip empty printer work ([@yaacovCR](https://github.com/yaacovCR)) * [#4976](#4976) perf: add a minimal AST reducer for printing ([@yaacovCR](https://github.com/yaacovCR)) * [#4971](#4971) perf: reuse fragment checks from fields exceeding the introspection depth ([@Cito](https://github.com/Cito)) * [#4982](#4982) revert: remove maxListDepth from #4950 for now ([@yaacovCR](https://github.com/yaacovCR)) </details> #### Internal 🏠 <details> <summary> 13 PRs were merged </summary> * [#4884](#4884) ci: use a stable language-based CodeQL category ([@yaacovCR](https://github.com/yaacovCR)) * [#4887](#4887) ci: run CodeQL in a dedicated workflow ([@yaacovCR](https://github.com/yaacovCR)) * [#4907](#4907) test: execute JSDoc API examples with Node ([@yaacovCR](https://github.com/yaacovCR)) * [#4912](#4912) internal: robustify examples test runner ([@yaacovCR](https://github.com/yaacovCR)) * [#4928](#4928) ci: shard integration tests across eight jobs ([@yaacovCR](https://github.com/yaacovCR)) * [#4954](#4954) ci: retire Node.js 25 ([@yaacovCR](https://github.com/yaacovCR)) * [#4955](#4955) ci: test Node.js 27 prereleases ([@yaacovCR](https://github.com/yaacovCR)) * [#4967](#4967) fix: accept zero-byte benchmark memory samples ([@yaacovCR](https://github.com/yaacovCR)) * [#4968](#4968) fix: collect warmup garbage before benchmark memory samples ([@yaacovCR](https://github.com/yaacovCR)) * [#4970](#4970) benchmark: cover schema document printing ([@yaacovCR](https://github.com/yaacovCR)) * [#4969](#4969) fix: use cumulative allocation counters in memory benchmarks ([@yaacovCR](https://github.com/yaacovCR)) * [#4978](#4978) build: remove the obsolete development entry point ([@yaacovCR](https://github.com/yaacovCR)) * [#4981](#4981) internal: further improve example test runner ([@yaacovCR](https://github.com/yaacovCR)) </details> #### Committers: 9 * Christoph Zwerschke([@Cito](https://github.com/Cito)) * Duckki Oe([@duckki](https://github.com/duckki)) * Jay Phelps([@jayphelps](https://github.com/jayphelps)) * Martin Bonnin([@martinbonnin](https://github.com/martinbonnin)) * Minh Vu([@fallintoplace](https://github.com/fallintoplace)) * Rob Richard([@robrichard](https://github.com/robrichard)) * Sash([@SashaMIT](https://github.com/SashaMIT)) * Vibhanshu Rana([@vrana055](https://github.com/vrana055)) * Yaacov Rydzinski ([@yaacovCR](https://github.com/yaacovCR))
Issue
{ ... @defer(label: "R") { bad } ... @defer(label: "P") { slow ... @defer(label: "C") { bad } } }With
bad: String!returningnullandslow: Stringreturning"ok",badis shared by R and C. Initially, only R and P are pending. Upstream completes both R and C when the shared task fails, before P releases C, so the response contains acompletedID for C, which never appeared inpending.The draft spec's Incremental Completion Notice requires the associated pending notice to appear in an earlier response or the same response. C needs to delay its failure notice until P succeeds and announces it. If P instead fails, C is cancelled with P and doesn't need to be announced.
The earlier guard in this PR suppressed the invalid completion but discarded C's failure. Further tests expose the same retention problem for successful values:
{ ... @defer(label: "R") { bad x } ... @defer(label: "P") { slow ... @defer(label: "C") { x } } }All three resolvers start. Settle
bad = null, thenx = "X", thenslow = "ok", allowing each settlement to reach the queue.pruneEmptyGroupssees C's pending count reach zero and deletes it, even though C still owns the unpublished value. The response terminates without deliveringx. Only if the last two settlements are reversed,xis delivered successfully. Both schedules are tested with early execution enabled and disabled.This conflicts with the draft's pending notice semantics: when no notice is returned, the corresponding data should already be available in the initial or prior results. Here the successful value is absent everywhere.
Finally, a shared producer can reveal a nested defer group after its parent has failed and been removed. Without remembering failed parents, the late child can remain an owner of shared work and affect later failure reporting. A regression covers this with and without an intervening empty defer group.
Proposed solution
Treat deferred outcomes as retained state until their groups are released or cancelled:
These changes belong together: retaining values without draining can stall a group, while suppressing early failure notices without retention loses the group's error.
The follow-up commits first characterize the previous candidate with passing tests, then implement the correction and update the expectations. The tests include validated public operations and direct queue regressions for retained child streams, cancelled late outcomes, shared-value deduplication, and multiple accepted failures.
Track newly released groups with retained outcomes in a ready set, rather than scanning every active root after each task completion or stream batch. Ordinary task completions still finish their directly affected groups. The drain preserves release order, including settled descendants released during the same pass.
Verification
npm teststops at the Deno runtime check because Deno is not installed locally. The separately invoked integration suite is blocked by missing Docker.(Follow-up PR: Error collection before a task's non-null failure is handled separately in #4861.)