Mark pull_request_review_write and sub_issue_write as destructive#2838
Open
JuggerGrimrod88 wants to merge 1 commit into
Open
Mark pull_request_review_write and sub_issue_write as destructive#2838JuggerGrimrod88 wants to merge 1 commit into
JuggerGrimrod88 wants to merge 1 commit into
Conversation
Set DestructiveHint: true on the two remaining method-dispatched write tools whose delete/remove method discards data, completing the convention established for label_write (github#2836, issue github#2723) and already followed by discussion_comment_write and projects_write. - pull_request_review_write: delete_pending discards a pending review's body. Its granular equivalent delete_pending_pull_request_review already sets DestructiveHint. - sub_issue_write: remove deletes a sub-issue link. Its granular equivalent remove_sub_issue already sets DestructiveHint. Adds require.NotNil/assert.True assertions mirroring labels_test.go and regenerates both golden snapshots. No behavior, schema, or API change. Follow-up to github#2836; surfaced by self-review of github#2836/github#2837. Co-Authored-By: Claude <noreply@anthropic.com>
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.
What
Sets
DestructiveHint: trueon the two remaining method-dispatched write tools whosedelete/removemethod discards data:pull_request_review_write—method: "delete_pending"deletes a pending review and discards its body.sub_issue_write—method: "remove"deletes a sub-issue link.Why
This completes the convention established by #2836 (issue #2723) for
label_write, and already followed bydiscussion_comment_writeandprojects_write: a method-dispatched write tool capable of destruction setsDestructiveHint: trueso MCP clients that gate on the hint surface a confirmation prompt before running it.Before this PR, a client gating on
DestructiveHintwould warn beforelabel_write deletebut not beforepull_request_review_write method: "delete_pending"orsub_issue_write method: "remove", even though both discard data. The granular equivalents already flag these as destructive:delete_pending_pull_request_review(pkg/github/pullrequests_granular.go) setsDestructiveHint: true.remove_sub_issue(pkg/github/issues_granular.go) setsDestructiveHint: true.So this brings the umbrella method-dispatched tools in line with both their granular equivalents and the sibling umbrella tools (
discussion_comment_write,projects_write,label_write). No new judgment call — just consistency.This was surfaced by a self-review of #2836/#2837: the #2836 rationale ("method-dispatched tools capable of destruction should set
DestructiveHint") is satisfied by these two tools as well, so a maintainer would reasonably ask "why onlylabel_write?" — this answers it.Changes
pkg/github/pullrequests.go— addDestructiveHint: jsonschema.Ptr(true)topull_request_review_write(gofmt re-aligned the struct fields).pkg/github/issues.go— addDestructiveHint: jsonschema.Ptr(true)tosub_issue_write.pkg/github/pullrequests_test.go,pkg/github/issues_test.go— addrequire.NotNil+assert.Trueassertions mirroringlabels_test.go.pull_request_review_write.snap,sub_issue_write.snap(only delta is+ "destructiveHint": true).No behavior, schema, or API change.
Overlap with #2837 (heads-up)
#2837 also edits
pull_request_review_write's annotation block (itsTitlestring) and regenerates the samepull_request_review_write.snap. This PR and #2837 touch different fields of the sameAnnotationsstruct, so the.gomerge is clean. The.snapfile will conflict if both merge, but it's a one-line regen — whichever merges second just re-runsUPDATE_TOOLSNAPS=true go test ./pkg/github/ -run TestCreateAndSubmitPullRequestReview. Happy to rebase onto whichever lands first if helpful.Verification
gofmt -lclean on all touched files.go vet ./pkg/github/go build ./...go test ./pkg/github/ -run 'TestCreateAndSubmitPullRequestReview|TestCreatePendingPullRequestReview|TestSubmitPendingPullRequestReview|TestDeletePendingPullRequestReview|Test_AddSubIssue|Test_RemoveSubIssue|Test_ReprioritizeSubIssue'— green (snapshots regenerated withUPDATE_TOOLSNAPS=true, then re-run without the flag).