Repository navigation
Conversation
rateLimit is a field on the Query root. injectRateLimit added it as a sibling of every operation's root fields, so every mutation document failed with "Field 'rateLimit' doesn't exist on type 'Mutation'" — approve, merge, label edit and label remove were all dead. Skip injection for mutation operations. Queries (shorthand, named, with leading fragments) still get the reading.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
injectRateLimitaddsrateLimit { cost remaining limit resetAt }immediately after the operation's opening brace, which is correct for a query and invalid for a mutation:rateLimitis a field on theQueryroot only.Result: every mutation the plugin sends fails before it reaches the API.
Reproduced directly, without the plugin:
So Approve, Merge, and label add/remove are all dead in the installed build (
d6f7184a); the merge button in the detail panel surfaces it as the popup seen above.This skips injection when the operation after any leading fragments starts with
mutation. Queries — shorthand{ … }, namedquery X(…), and queries preceded by fragment definitions — are untouched and still report their cost.Checked against the three shapes the plugin actually sends:
mutation($id: ID!, $method: PullRequestMergeMethod!) { … }query { viewer { login } }query Board($login: String!) { … }fragment F on PullRequest { id }\nquery { … }Happy to add a unit test for the mutation case if you want one in the repo — there is no existing test file for
rate-limit.ts.