feat(drive): expose resolve/reopen action on comments reply (#623)#626
Merged
steipete merged 2 commits intoMay 22, 2026
Merged
Conversation
…#623) Drive REST API's Reply resource supports `action: "resolve"|"reopen"` to post a reply that atomically flips the parent comment's resolved state. `drive comments reply` previously only accepted content, forcing PMs batch-processing inline doc-review feedback to either delete comments (destroying thread context) or hit the Docs UI one thread at a time. Implements both shapes the issue offered: - `drive comments reply <fileId> <commentId> <content> --action=resolve|reopen` closer to the API and composes with existing reply muscle memory. - Sibling verbs `drive comments resolve` / `drive comments reopen` mirror the established `docs comments resolve` pattern (already in the codebase) and are more discoverable. Adds matching `docs comments reopen` for parity. Helper plumbing: - `createDriveReplyWithAction` generalizes `createDriveReply`; the old `resolveDriveComment` becomes a thin wrapper. `reopenDriveComment` added. - `validateDriveReplyAction` centralises enum validation (also wired to the kong `enum` tag). - `writeDriveReplyMutationWithAction` renders the right envelope key (`resolved: true` vs `reopened: true`) per action; the original `writeDriveReplyMutation` is preserved as a thin wrapper so existing callers (and the existing `docs comments resolve` JSON shape) are untouched. Tests use an `httptest.Server` to capture the outgoing `replies.create` request body and assert the `action` field is set correctly across `reply --action=resolve`, `reply --action=reopen`, plain reply (no action), sibling `resolve`/`reopen` verbs, the optional-content path, and invalid `--action` rejection.
63f4f99 to
4783a78
Compare
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.
Summary
Closes #623.
Drive REST API's
Replyresource accepts anactionfield —"resolve"or"reopen"— that atomically flips the parent comment's resolved state when the reply is created.gog drive comments replypreviously only accepted content, leaving two bad options for batch-processing inline doc-review feedback:drive comments delete— destroys thread context; only acceptable for self-comments.This PR exposes both API actions in both shapes the issue offered, with overlap intended:
gog drive comments reply <fileId> <commentId> <content> --action=resolve|reopen— closer to the API shape, composes with existing reply muscle memory.gog drive comments resolve <fileId> <commentId> [--message=...]andgog drive comments reopen ...— sibling verbs mirroring the existingdocs comments resolvepattern; more discoverable.For docs-surface parity,
docs comments reply --action=...and a newdocs comments reopenverb are also added.Implementation notes
createDriveReplyWithAction(ininternal/cmd/comment_ops.go) generalises the existingcreateDriveReply; the existingresolveDriveCommentbecomes a thin wrapper, so the existingdocs comments resolvepath is unchanged.reopenDriveCommentadded.validateDriveReplyActioncentralises enum validation; also wired to the kongenumtag on the--actionflag.writeDriveReplyMutationWithActionrenders the right envelope key (resolved: truevsreopened: true) per action; the originalwriteDriveReplyMutationis preserved as a thin wrapper so existing callers and existing JSON output shapes are bytewise unchanged.Fields(...)beyond the existingdriveResolveReplyCreateFieldsconstant, which already includesaction.Tests
New tests in
internal/cmd/drive_comments_resolve_test.gouse anhttptest.Serverto capture the outgoingreplies.createrequest body and assert theactionfield reaches the wire correctly:reply --action=resolvepostsaction="resolve"and emitsresolved: trueenvelope.reply --action=reopenpostsaction="reopen"and emitsreopened: trueenvelope.reply(no--action) emits noactionfield and the original{"reply": ...}envelope (regression guard).drive comments resolveanddrive comments reopenverbs.drive comments resolvewithout--message(action-only reply, no content).--action=ignoreis rejected by kong before any network call.docs comments reopenparity test.TestDocsComments_ValidationErrorsstyle.go test ./...is green locally.Use case
Batch-resolving inline review feedback on Google Docs from a PM workflow — reply with the substantive resolution AND mark the thread resolved in a single command, scriptable across dozens of threads. This is the PM workflow that motivated #623.
Test plan
go test ./...greengofmt -lclean on touched filesgo vet ./internal/cmd/...cleanTestDriveCommentsReply_NoActionUnchanged)docs comments resolveJSON envelope unchanged🤖 Generated with Claude Code