Repository navigation
Incremental Delivery spec draft - #1110
robrichard wants to merge 6 commits into
Conversation
✅ Deploy Preview for graphql-spec-draft ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hi @robrichard , do you have any expected timeline for this feature? We are really excited to have this feature for our product! |
9ec7f65 to
f7e9124
Compare
|
The previous spec edits reached RFC2, should this also be RFC2? |
|
|
||
| - If {serial} is not provided, initialize it to {false}. | ||
| - Let {groupedFieldSet} and {newDeferUsages} be the result of | ||
| {CollectFields(objectType, selectionSet, variableValues)}. |
There was a problem hiding this comment.
The new CollectFields requires a deferUsage argument ... this should be null for the initial call to CollectFields.
| {CollectFields(objectType, selectionSet, variableValues)}. | |
| {CollectFields(objectType, selectionSet, null, variableValues)}. |
Also in this case its not clear while reading what null actually is for so maybe it should be declared first?
|
Moving this to RFC2, draft. More work to do for sure, but we're waaaaay closer to the end than the start and I believe we've fully understood the problem domain and are narrowing in on details now. Massive props and excellent work to @robrichard for his continued championship and work on this RFC |
8e9cbcb to
fea9349
Compare
fea9349 to
1520fc1
Compare
f5f26b0 to
85bbf89
Compare
30d83f1 to
185efb0
Compare
185efb0 to
73b8554
Compare
Co-authored-by: Yaacov Rydzinski <yaacovCR@gmail.com>
Co-authored-by: Yaacov Rydzinski <yaacovCR@gmail.com>
73b8554 to
045e193
Compare
|
👋 I noticed a few minor corrections to make:
|
|
For @defer(label: null) or @stream(label: null), should pending include "label": null, or omit label? Both directives declare a nullable label: String. The validation rule says:
I read that as exempting null from the uniqueness check, while still allowing the argument. In GetPendingEntry, the algorithm takes the group or stream’s {label} and constructs a pending entry containing it. The response section says that if the directive “contains a label argument,” the pending notice “must contain an entry {"label"} with the value of this argument.” Together, these suggest that label: null produces "label": null in the pending notice. Currently, GraphQL.js instead omits the entry and tests for that behavior. |
| - Increment {nextID} by {1}. | ||
| - Return {id}. | ||
|
|
||
| GetPendingEntry(newGroups, newStreams): |
There was a problem hiding this comment.
This method returns a list of pending entries, though its name "GetPendingEntry" would suggest that it returns just a single entry.
This might be clearer if named "GetPendingEntries".
| EnsureID(node): | ||
|
|
||
| - If {idMap} has an entry for {node}, return that entry. | ||
| - Let {id} be {nextID} converted to a string. | ||
| - Set the entry for {node} in {idMap} to {id}. | ||
| - Increment {nextID} by {1}. | ||
| - Return {id}. |
There was a problem hiding this comment.
My understanding is that these ids are expected to be opaque and should not be interpreted by clients. For example, clients should not parse id strings to an integer and compare them to determine if they are missing any delivery groups. The true requirement is that an id is a string value that is unique per node.
As written, though, this specific counter-based algorithm is normative.
Is it feasible to rework EnsureID to only specify the identity guarantees, with the counter-based impl described in a non-normative note?
I naively tried reworking it in the suggested edit.
| EnsureID(node): | |
| - If {idMap} has an entry for {node}, return that entry. | |
| - Let {id} be {nextID} converted to a string. | |
| - Set the entry for {node} in {idMap} to {id}. | |
| - Increment {nextID} by {1}. | |
| - Return {id}. | |
| EnsureID(node): | |
| - If {idMap} has an entry for {node}, return that entry. | |
| - Let {id} be a string value that has not previously been assigned to any node in this incremental response. | |
| - Set the entry for {node} in {idMap} to {id}. | |
| - Return {id}. | |
| Note: One implementation strategy is to maintain a counter initialized to zero for each incremental response. When assigning a new ID, convert the counter to a string and increment it by one. |
There was a problem hiding this comment.
I agree that their exact values need not be prescribed, while these are public wire IDs used to correlate pending/completion notices and results. Implementations should be free to choose any string values, provided they remain stable for each node and unique across the incremental response. The counter-based algorithm would work well as a non-normative example.
|
Could we clarify error reporting when an incremental delivery group fails? Previously collected errors handled at nullable fields may reasonably be omitted from a failed completion. However, the completion can still have multiple propagating failure causes. For example, GraphQL.js #4870 reports multiple cached task rejections when several shared tasks have failed before a deferred group starts. The draft’s To support multiple causes, the mapping could become: @@ GROUP_FAILURE
- Let {group} and {error} be the corresponding entries on {event}.
- Let {groupErrors} be a list containing {error}.
- Append {GetCompletedEntry(group, groupErrors)} to {completed}.
+ Let {group} and {errors} be the corresponding entries on {event}.
+ Assert: {errors} is a non-empty list of execution errors
+ whose propagation caused delivery of the group to fail.
+ Append {GetCompletedEntry(group, errors)} to {completed}.This would allow multiple propagating causes while permitting omission of errors handled at nullable positions. I’m leaving STREAM_FAILURE outside this question, since the motivating case concerns multiple shared task failures affecting one deferred group. |
Spec draft of
@deferbased on the response format in graphql/defer-stream-wg#69, with no duplication of fields.@streamwill be added soon.Please keep discussion limited to specifics on how the spec text is written. There is a dedicated discussion forum for questions, feedback, and comments on defer & stream: https://github.com/graphql/defer-stream-wg/discussions