Repository navigation
feat(web): edit saved review comments in place - #12087
cmaciasjimenez wants to merge 1 commit into
Conversation
A review comment could only be deleted and rewritten from scratch once submitted, while comments already posted to a pull request host have been editable all along. Give the saved comment a pencil beside its delete action. It reopens the same inline composer seeded with the comment, buffering the rewrite so cancelling leaves the saved text untouched. Saving upserts the record in place, so an edit no longer reorders the draft's context.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a new saved-comment editing workflow across the diff and file-preview surfaces and changes shared composer state replacement semantics. The change is contained but affects production user interactions in multiple places, so human review is appropriate. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds inline editing for saved review comments. Edited text flows through existing annotation persistence paths, and replacing a comment preserves its position in the review comment list. ChangesReview comment editing
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~15 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant Reviewer
participant DiffCommentAnnotation
participant AnnotatableCodeView
participant ComposerDraftStore
Reviewer->>DiffCommentAnnotation: Select saved comment edit
DiffCommentAnnotation->>DiffCommentAnnotation: Update edited text
Reviewer->>DiffCommentAnnotation: Select Save
DiffCommentAnnotation->>AnnotatableCodeView: Send edited text
AnnotatableCodeView->>ComposerDraftStore: Upsert comment by entry ID
ComposerDraftStore-->>AnnotatableCodeView: Preserve comment position
Suggested reviewers: Merge Risk: ⚪ Minimal · up to Saved-comment editing uses the intended persistence path and does not expose editing for delete-only comments. The change is ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Leaving the CodeRabbit Docstring Coverage pre-merge warning (33.33% vs its 80% default) unaddressed on purpose. Satisfying it would mean adding a docstring to Documenting only the new one would make it the single commented callback in the file. The convention here is that the exported surface gets a doc comment and internal callbacks do not — The 80% threshold is CodeRabbit's generic default rather than anything this repository asks for, so I have treated it as a false positive rather than changing the code to match it. Happy to reverse that if a maintainer disagrees. The CodeRabbit check itself reports Review completed with no actionable comments, and the review body puts merge risk at Minimal. |
|
Note This comment is posted by Julius' dot This adds an Edit/Save/Cancel workflow for saved local review comments across the diff and file-preview surfaces. No maintainer approval for that direction and scope is linked. Closing under prior approval. Discuss the proposed workflow in Ideas and link explicit approval for reconsideration. |
|
Opened an Ideas discussion to get approval for the direction and scope: #14570. Once a maintainer approves it there, I'll link the approval here and ask for this PR to be reopened. |
Once a review comment is submitted in the diff panel, its text is frozen: hovering it offers only a delete button, so fixing a typo means deleting the comment and writing it again from scratch. Comments already posted to a pull request host have been editable all along (
pullRequests.updateComment), which makes the local ones the odd surface out.Give a saved comment a pencil beside its delete action. It reopens the same inline composer seeded with the comment's text, and buffers the rewrite locally so cancelling leaves the saved comment untouched. Saving upserts the record by id, so the draft keeps one inline reference and the comment keeps its place among the draft's context.
addReviewCommentalready replaced a record with a matching id, but by filtering and re-appending, which moved an edited comment to the end. It now replaces in place, so an edit no longer reorders the draft's context.No contract, server, or mobile change: review comments are composer-draft state, and mobile dissolves them straight into the draft text rather than keeping an editable bubble. Pending (unsubmitted) pull-request review comments are still delete-only — a separate surface, left for a follow-up.
Before
Hovering a saved comment offers only delete.
After
The same comment now offers edit beside delete, and the pencil reopens the composer with the comment's text, Cancel and Save.
Edit.comment.mov
Verification
vp test run apps/web/src/composerDraftStore.test.ts apps/web/src/components/diffs/DiffCommentAnnotation.test.tsx— 143 passed, including a new case covering in-place replacement.vp test run apps/web/src/components/files/FilePreviewPanel.test.ts apps/web/src/components/diffs/StyledDiffCodeView.test.tsx apps/web/src/components/diffs/commentSubmitShortcut.test.ts— 17 passed.Written by Claude Opus 5 in T3 Code.
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes