-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subscribe: once execution starts.... #3640
Conversation
data should return null?
✅ Deploy Preview for compassionate-pike-271cb3 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋 Supported commandsPlease post this commands in separate comments and only one per comment:
|
See some discussion in graphql/graphql-spec#894 See additional rough thoughts on how subscriptions fit in at: #3621 (comment) |
Probably should bring this up at next WG-- Basic question- how should request errors be distinguished from CreateSourceEventStream errors? Setting data to null is one option, but it's a little strange as data is never non null because when successful, you get a stream rather than a single result. Previously, we just threw, but now that at are trying to align execute and subscribe, we return an errors result, so we have to decide when, if ever, to set data to null. @benjie tagging you in terms of if you have any thoughts related to your spec PR about clarifying request vs execution errors |
The transition between "request error" (payloads like If a "request error" is raised, then that's seen as being "before execution" (even if it's part of ExecuteRequest(), for example the "request error" raised by CoerceVariableValues(). Asserts don't define an error type because they should not happen (due to validation, etc); but I see the assert in ExecuteQuery() and ExecuteMutation() as raising a "request error" (since there is no field at that point). Once these algorithms have moved onto the For subscriptions the definition is somewhat harder to discern. Do we introduce the "boundary" before or after step 10 of CreateSourceEventStream()? What happens if the call to One option is that because this is an error in a field method, it is a field error, and thus the division between "request error phase" and "field error phase" is between steps 9 and 10 of CreateSourceEventStream:
So an error raised whilst creating the stream for a field should be treated as a field error, and thus should result in the field itself being null. However, this may be surprising to the user who is expecting a stream not a singular payload. It seems to me that if you fail to create the event stream then that should be a request error (you've failed to set up a subscription, so the operation has failed). I.e. rather than putting the boundary at the aforementioned position, I think it should probably be once you enter MapSourceToResponseEvent(). But honestly, I could go either way on this. There does seem to be ambiguity here, but I'd have to read the spec more fully again to figure out if this was defined or not. |
I guess any type of error for CreateSourceEventStream leads to failed input for MapSourceToResponseEvent which is a kind of request error… I think this needs more hardening in the spec and likely a better way to distinguish between error types than the existence of data:null which doesn’t make much sense for subscriptions. i am going to close this for now, but it’s here if we want to revisit |
In summary, my current opinion is that "execution begins"
|
That makes data:null match current behavior, but I think a spec improvement would make all this explicit and also explicitly acknowledge that with subscriptions, there are two rounds of execution, one that sets up the source stream and one for each event.... |
Yeah, I agree that clarity here should come from the spec. |
data should return null?