Skip to content

Define 'execution' as in 'before execution begins' #1174

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

Closed
wants to merge 1 commit into from

Conversation

leebyron
Copy link
Collaborator

@leebyron leebyron commented Jul 2, 2025

Reintroduces #894 atop latest main

@leebyron leebyron requested a review from benjie July 2, 2025 05:29
Copy link

netlify bot commented Jul 2, 2025

Deploy Preview for graphql-spec-draft ready!

Name Link
🔨 Latest commit 1be44d0
🔍 Latest deploy log https://app.netlify.com/projects/graphql-spec-draft/deploys/6864c432bfebb80008498ad9
😎 Deploy Preview https://deploy-preview-1174--graphql-spec-draft.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@leebyron leebyron added the ✏️ Editorial PR is non-normative or does not influence implementation label Jul 2, 2025
Reintroduces #894 atop latest main

Co-authored-by: Benjie <benjie@jemjie.com>
@leebyron leebyron force-pushed the lee/before-execution-begins-note branch from a117f4e to 1be44d0 Compare July 2, 2025 05:31
Copy link
Collaborator Author

@leebyron leebyron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @benjie - some thoughts on this PR for you. I'd love to do some brainstorming on terminology here to find a happy medium

@@ -39,27 +39,44 @@ and have no effect on the observable execution, validation, or response of a
GraphQL document. Descriptions and comments on executable documents MAY be used
for non-observable purposes, such as logging and other developer tools.

## Executing Requests
## Processing Requests
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the intermixing of "execute" and "process" is ultimately more confusing than helpful, despite it being technically more accurate. I think it's the result of the topline section being "Execution" and then within we define execution as a sub-step of "Processing". It's a much larger change to retitle the entire section.

I wonder if instead we could define phases of execution?

Given this information, the result of {ExecuteRequest(schema, document,
operationName, variableValues, initialValue)} produces the response, to be
formatted according to the Response section below.
Given this information, the result of {Request(schema, document, operationName,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets think of how we can keep the algorithm names with action verbs. Ideally this has an "execute" or "process" or something here.

Considering the prose above describes this as "request via execution" then "execute request" does seem like what a reader would expect

rules should be executed. If validation errors are known, they should be
reported in the list of "errors" in the response and the request must fail
without execution.
As explained in the Validation section, only operations from documents which
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice cleanup here

that maps an underlying _source stream_ to a returned _response stream_.

Subscribe(subscription, schema, variableValues, initialValue):
Subscription(subscription, schema, variableValues, initialValue):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is admittedly the weirdest. Regardless of how we net-out on naming, we should rethink the terms used for the phases of subscription

Note: An error raised before _execution_ begins will typically be a _request
error_, and once _execution_ begins will typically be an _execution error_.

:: We define _execution_ as the process of executing the operation's _root
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here is where we could define "during execution" with something more specific to avoid the overloaded term.

These names might not be ideal, but it seems like we have two phases to execution.

  • First there is a pre-execution preparation step where we coerce variables and ensure we have a valid type and object to begin execution with

  • Then there is the actual collection and execution of fields (though even here it's a bit arbitrary that "execution" starts as we begin collecting fields not when we start the first ExecuteCollectedFields. Perhaps we could call this phase "field execution" or "selection execution"?

I appreciate what we're trying to do here is more clearly define what scenarios lead to an error result with no data entry vs one with a partial data entry. We started with "field error" -- which while unclear for other reasons -- at least evaded this issue. They were clearly errors which occurred at a per-field level. Maybe we just need to do a half-step back to that?

@benjie
Copy link
Member

benjie commented Jul 2, 2025

TL;DR: we already have a section "Executing Operations"; let's simply rename "execution" to "operation execution" where appropriate - WDYT?


@leebyron I've merged these changes back into #894 1 and have then2:

  1. wound back the changes to algorithm names3
  2. renamed "execution" to "operation execution" throughout
  3. used the existing "Executing Operations" section as the point at which "operation execution begins" 4
  4. moved establishing the source event stream into ExecuteRequest()5

All in all I think this makes the spec text a lot clearer without having to rename any algorithms or introduce different verbs. The only other change that we might want to consider is renaming Subscribe() to ExecuteSubscription() for consistency; but honestly I'm fine how it is.

Please let me know if you're happy with this direction; if so I'll go over it more carefully to ensure it's consistent (in particular I think I might need to update the text of the subscriptions section).

Footnotes

  1. commit 7bafeaf (#894) has no diff against this PR

  2. you can see my changes since this PR here: https://github.com/graphql/graphql-spec/pull/894/files/7bafeaf25423a68a687bbba1c461d76bcbd33e26..94241a78d020fb0bdeea483a0f50d54beff890ba - but personally I'd just read the full diff as it's simpler

  3. also removing "perform" and "process" verbs

  4. which feels really natural, right?

  5. since it happens "before (operation) execution begins"

@leebyron
Copy link
Collaborator Author

leebyron commented Jul 2, 2025

Oh amazing - thanks for getting the original one reopened, I couldn't figure out how to do that. I can close out this copy-cat PR and pick up discussion in the other

@leebyron leebyron closed this Jul 2, 2025
@benjie
Copy link
Member

benjie commented Jul 2, 2025

Haha you did all the work; I just did git merge leesbranch and then git checkout leesbranch . to resolve all the conflicts 🤣

@benjie
Copy link
Member

benjie commented Jul 2, 2025

(And to reopen I had to restore the branch it was based on, then change the PR target to main.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✏️ Editorial PR is non-normative or does not influence implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants