Skip to content

feat(review): add --edit-comment flag for updating pending review comments#16

Open
EurFelux wants to merge 3 commits intoagynio:mainfrom
EurFelux:feature/edit-comment
Open

feat(review): add --edit-comment flag for updating pending review comments#16
EurFelux wants to merge 3 commits intoagynio:mainfrom
EurFelux:feature/edit-comment

Conversation

@EurFelux
Copy link
Copy Markdown
Contributor

@EurFelux EurFelux commented Feb 3, 2026

Summary

This PR implements the update/edit functionality for the CRUD lifecycle of pending review comments.

Changes

Code

  • Added --edit-comment flag to edit a comment in a pending review
  • Added --comment-id flag to specify the GraphQL comment node ID (PRRC_...)
  • Added --body flag (required) for the new comment content
  • Validates that comment ID uses GraphQL node ID format
  • Returns JSON status output following existing conventions

Bug Fix

  • Fixed GraphQL mutation parameter name: pullRequestReviewCommentId (not id)

Documentation

  • Updated SKILL.md with edit-comment command and workflow
  • Updated README.md quickstart with edit example
  • Updated Backend policy table
  • Added review --edit-comment section to docs/USAGE.md

Tests

  • Added TestReviewEditCommentCommand_GraphQLOnly - validates successful edit with GraphQL mutation
  • Added TestReviewEditCommentCommandRequiresGraphQLCommentID - validates PRRC_ prefix required
  • Added TestReviewEditCommentCommandRequiresBody - validates --body is required

Usage

gh pr-review review --edit-comment \\
  --comment-id PRRC_kwDOAAABbcdEFG12 \\
  --body \"Updated comment text\" \\
  -R owner/repo 42

Expected output:

{
  \"status\": \"Comment updated successfully\"
}

Manual Testing

✅ Tested on PR #16:

  1. Created pending review: gh pr-review review --start
  2. Added test comment: gh pr-review review --add-comment --body \"Original\"
  3. Queried comment ID via GraphQL API (PRRC_...)
  4. Edited comment: gh pr-review review --edit-comment --comment-id PRRC_... --body \"Updated\"
  5. Verified comment was updated via GraphQL API
  6. Submitted review successfully

Implementation Details

  • Uses GraphQL mutation updatePullRequestReviewComment
  • Follows the same patterns as existing --add-comment and --submit commands
  • Only works on pending review comments (GraphQL API restriction)
  • --body is required when editing a comment

Testing

All tests pass (including new tests):

CGO_ENABLED=0 go test ./...

🤖 Generated with Claude Code

This implements the update functionality for the CRUD lifecycle of pending
review comments, allowing users to modify comment bodies before submission.

Usage:
  gh pr-review review --edit-comment \
    --comment-id PRRC_kwDOAAABbcdEFG12 \
    --body "Updated comment text" \
    -R owner/repo 42

Features:
- New --edit-comment flag to edit a comment in a pending review
- New --comment-id flag to specify the GraphQL comment node ID (PRRC_...)
- Validates that comment ID uses GraphQL node ID format
- Requires --body for the new comment content
- Returns JSON status output following existing conventions

GraphQL mutation used: updatePullRequestReviewComment

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor Author

@EurFelux EurFelux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test: edit-comment feature verified working

Comment thread cmd/review.go

cmd.Flags().BoolVar(&opts.Start, "start", false, "Open a pending review")
cmd.Flags().BoolVar(&opts.AddComment, "add-comment", false, "Add an inline comment to a pending review")
cmd.Flags().BoolVar(&opts.EditComment, "edit-comment", false, "Edit a comment in a pending review")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated comment text - edit works!

This implements the update functionality for the CRUD lifecycle of pending
review comments, allowing users to modify comment bodies before submission.

Features:
- New --edit-comment flag to edit a comment in a pending review
- New --comment-id flag to specify the GraphQL comment node ID (PRRC_...)
- Validates that comment ID uses GraphQL node ID format
- Requires --body for the new comment content
- Returns JSON status output following existing conventions

Bug fix:
- Fixed GraphQL mutation parameter name: pullRequestReviewCommentId (not id)

Documentation:
- Updated SKILL.md with edit-comment command and workflow
- Updated README.md quickstart with edit example
- Updated Backend policy table
- Added review --edit-comment section to docs/USAGE.md

Testing:
- Manually tested on PR agynio#16: created review, added comment, edited it,
  verified update, submitted review

GraphQL mutation used: updatePullRequestReviewComment

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@EurFelux EurFelux changed the title Add --edit-comment flag for updating pending review comments feat(review): add --edit-comment flag for updating pending review comments Feb 3, 2026
Add three test cases for the edit-comment functionality:
- TestReviewEditCommentCommand_GraphQLOnly: successful edit with valid inputs
- TestReviewEditCommentCommandRequiresGraphQLCommentID: validates PRRC_ prefix required
- TestReviewEditCommentCommandRequiresBody: validates --body is required

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
v2nic added a commit to v2nic/gh-pr-review that referenced this pull request Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant