vscode: edit + preview-side delete on review comments (#1055) - #1132
Merged
Conversation
…prefill composer
…poser remount on same-block re-edit
amrmelsayed
added a commit
that referenced
this pull request
Jul 2, 2026
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.
PIR Review: Edit + Preview-Side Delete on Review Comments
Fixes #1055
Summary
Makes the markdown reviewer a functional reviewing tool by adding edit to both review-comment surfaces (the editor Comments-API gutter and the preview cards) and delete from the preview (previously delete worked only from the editor gutter). Both operations use line + content identity — the marker's own physical file line plus an author + body-prefix optimistic-concurrency check — with no on-disk format change; a stable-ID "format v2" was explicitly left to #1131. A write that loses the race (file changed between click and host write) refuses to mutate, refreshes the preview, and surfaces an info toast rather than corrupting a different marker.
Files Changed
packages/core/src/review-markers.ts(+53 / -3) —markerLineonReviewMarker;matchesExpectedMarker+rewriteReviewMarkerBodyhelperspackages/core/src/__tests__/review-markers.test.ts(+67 / -3) — unit tests for the new field + helperspackages/artifact-canvas/src/types.ts(+26) — optionalmarkerLine+onEditComment/onDeleteCommentpropspackages/artifact-canvas/src/components/ArtifactCanvas.tsx(+132 / -6) — per-card edit/delete affordances (inline SVG icons), delegated click routing, edit-mode composer wiringpackages/artifact-canvas/src/overlays/CommentComposer.tsx(+28 / -6) — optionalinitialTextprefill for edit ("Save" vs "Comment")packages/artifact-canvas/src/styles/default-theme.css(+42) — card action-row + SVG-button stylingpackages/artifact-canvas/src/components/__tests__/marker-card-edit-delete.test.tsx(+104) — card → intent wiring, stacked second-of-threepackages/vscode/src/markdown-preview/messages.ts(+8 / -1) —editComment/deleteCommentmessage shapespackages/vscode/src/markdown-preview/preview-provider.ts(+101) — race-safe host handlers (verifyReviewMarker/editReviewMarker/deleteReviewMarker)packages/vscode/src/markdown-preview/webview/main.ts(+15) — wires the two intents topostMessagepackages/vscode/src/comments/plan-review.ts(+105 / -12) —ReviewCommentclass + edit action (start/save/cancel), author preservedpackages/vscode/package.json(+33) — three edit commands +comments/comment/title(pencil) andcomments/comment/context(save/cancel) menuspackages/vscode/src/__tests__/preview-edit-delete.test.ts(+197) — host edit/delete: stacked, race, delete-single/last-line, mismatchpackages/vscode/src/__tests__/plan-review-edit.test.ts(+134) — editor save-edit: author preserved, stacked second-of-threecodev/resources/arch.md,codev/resources/lessons-learned.md— cold-tier updates (see below)codev/plans/1055-vscode-edit-preview-side-delet.md,codev/state/pir-1055_thread.md— plan + threadCommits
f47a1bd6[PIR vscode: edit + preview-side delete on review comments (make the markdown reviewer functional) #1055] core: surface markerLine + marker verify/rewrite helpers8af0dc7f[PIR vscode: edit + preview-side delete on review comments (make the markdown reviewer functional) #1055] artifact-canvas: per-card edit/delete affordances + edit-prefill composerf7fb450f[PIR vscode: edit + preview-side delete on review comments (make the markdown reviewer functional) #1055] vscode preview: editComment/deleteComment host handlers (race-safe)795e50e2[PIR vscode: edit + preview-side delete on review comments (make the markdown reviewer functional) #1055] vscode editor: edit action on review comments (author preserved)602650cb[PIR vscode: edit + preview-side delete on review comments (make the markdown reviewer functional) #1055] Thread: implement phase completeea266fc2[PIR vscode: edit + preview-side delete on review comments (make the markdown reviewer functional) #1055] artifact-canvas: replace emoji card icons with inline SVGsbb02892f[PIR vscode: edit + preview-side delete on review comments (make the markdown reviewer functional) #1055] Thread: dev-approval testing feedback (icons fixed, delete non-issue)Test Results
pnpm build(porchbuildcheck): ✓ pass (7.5s)testscheck): ✓ pass (34.4s)tschost + webview), eslint, and esbuild bundle all clean.dev-approvalgate (running worktree): edit from the preview composer and the editor pencil (author preserved, body updated); delete from a preview card; stacked-comment edit/delete acting on only the intended marker; icon legibility. The reviewer surfaced three findings during testing — all resolved (see Things to Look At).Architecture Updates
COLD (
codev/resources/arch.md) — added a bullet to the review-marker/artifact-canvas subsystem documenting the #1055 edit/delete design: themarkerLinephysical-line identity, the corematchesExpectedMarker/rewriteReviewMarkerBodymechanics, the verify-before-write race behavior (refuse + refresh + toast), the optional canvas props (read-only hosts render plain cards), and the editorReviewComment/thread.comments-reassignment detail. This extends an existing documented subsystem rather than introducing a new module boundary, so it's reference detail (cold), not a top-tier always-inject fact.HOT (
arch-critical.md) — no change. No new always-on system-shape invariant; the on-disk marker format is deliberately unchanged, so the existing hot facts still hold.Lessons Learned Updates
COLD (
codev/resources/lessons-learned.md) — added, under Debugging: a VS Code command that is visible but does nothing after an extension change is often a stale Extension Development Host, not a code regression — reload before diagnosing dispatch. Captured because a "delete no longer works" report against a byte-for-byte-unchanged command turned out to be environmental, and a speculative fix was started then reverted once confirmed.HOT (
lessons-critical.md) — no change. The lesson is a debugging recipe, not a cross-cutting behavior-changing rule; the existing hot lessons ("'it compiled' ≠ 'it works'", "verify claims against the actual file") already cover the general principle.Things to Look At During PR Review
matchesExpectedMarker,preview-provider.tsverify path): the body match is a prefix on the whitespace-normalized body, deliberately tolerant of the codec's\s+→space normalization while still refusing a genuinely different marker. Combined withmarkerLine(one marker per line) it uniquely locates the target even in a stack. The race path is covered bypreview-edit-delete.test.ts(marker moved between click and write → no write, refresh + toast).rewriteReviewMarkerBody), never from the caller — an edit can rephrase the body but cannot reassign authorship.plan-review-edit.test.tspins this (the comment's own author field is'ignored'; the on-disk@amrsurvives).startEditReviewCommentreassignsthread.commentsbecause VS Code only re-renders a thread on reassignment; the subsequent file-changerefreshDocrecreates the thread from disk as the source of truth.main.How to Test Locally
pir-1055→ Review Diffcodev/plans|specs|reviews/*.mdin the Codev Markdown Preview (and the raw editor)codev/(plans|specs|reviews)/*.md