Improve "unknown method" errors to list supported methods#2713
Open
gustavo-sec wants to merge 2 commits into
Open
Improve "unknown method" errors to list supported methods#2713gustavo-sec wants to merge 2 commits into
gustavo-sec wants to merge 2 commits into
Conversation
The consolidated method-dispatch tools returned a bare "unknown method: <x>" with no hint of valid values, and each tool's valid method set lived only in its schema enum (or, for sub_issue_write, only in prose). labels.go already listed the supported methods on an unknown value; this brings the rest in line and makes the advertised methods the single source of truth. - Each tool's method set is a single []string that feeds both the input-schema enum (methodEnum) and the unknown-method error (unknownMethodError), so the advertised methods and the accepted methods cannot drift apart. - An unknown method now lists the supported set: "unknown method: x. Supported methods are: ...". - pull_request_review_write decoded args with WeakDecode (no RequiredParam), so an omitted method surfaced as "unknown method: " (empty). It now reports "missing required parameter: method", consistent with the other tools. - sub_issue_write advertised its method options only in the description; it now declares the enum like every other method-dispatch tool. Closes github#2712
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.
Closes #2712.
The consolidated
method-dispatch tools returned a bareunknown method: <x>with no hint of valid values, and each tool's valid method set lived only in its schema enum (or, forsub_issue_write, only in prose).labels.goalready listed the supported methods on an unknown value; this brings the rest in line and makes the advertised methods the single source of truth.What changed
[]stringthat feeds both the input-schema enum (methodEnum) and the unknown-method error (unknownMethodError), so the advertised methods and the accepted methods cannot drift apart.unknown method: x. Supported methods are: ....pull_request_review_writedecoded args withmapstructure.WeakDecode(it does not useRequiredParamlike the other tools), so an omittedmethodsurfaced asunknown method:(empty value). It now reportsmissing required parameter: method, consistent with every other tool.sub_issue_writeadvertised its method options only in the description; it now declares theenumlike every other method-dispatch tool.Affected tools:
pull_request_read,pull_request_review_write,issue_read,sub_issue_write,actions(list/get/run),projects(list/get/write),ui_get.Testing
go test ./...— green.golangci-lint run(v2.9.0) — 0 issues.script/generate-docs— no changes.sub_issue_writechanged (it gained the advertisedmethodenum).projects/ui_getunknown-method assertions.missing required parameter: method;method: "bogus"→unknown method: bogus. Supported methods are: ....