Conversation
…project queries Consolidate duplicated INSUFFICIENT_SCOPES error handling into a single implementation. The project queries package now calls api.GenerateScopeErrorForGQL instead of reimplementing the same logic. Removes duplicated requiredScopesFromServerMessage, scopesRE, and the associated test (already covered by api/client_test.go). Fixes cli#12823
897346f to
fdd6388
Compare
BagToad
approved these changes
Mar 5, 2026
Member
BagToad
left a comment
There was a problem hiding this comment.
Tested locally and saw the same behavior between trunk and this PR - proper scope error message generation. LGTM
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.
Fixes #12823
Both
api/client.goandpkg/cmd/project/shared/queries/queries.gohad their own copy ofrequiredScopesFromServerMessageand the sameINSUFFICIENT_SCOPESparsing logic. The existing code even had a TODO noting this:// TODO: this duplicates parts of generateScopesSuggestion.This PR removes the duplicated functions from
queries.goand hashandleErrorcallapi.GenerateScopeErrorForGQLinstead. The duplicate test was also removed sinceapi/client_test.goalready coversrequiredScopesFromServerMessage.Changes:
queries.go: replacedhandleErrorinternals with a call toapi.GenerateScopeErrorForGQL, removedrequiredScopesFromServerMessageandscopesREqueries_test.go: removedTest_requiredScopesFromServerMessage(covered byapi/client_test.go:TestRequiredScopesFromServerMessage)api/client.go: removed the now-resolved TODO comment