Skip to content

fix(suggest): render a pure-deletion suggestion as a deletion, not an empty box - #201

Merged
adnaan merged 1 commit into
mainfrom
suggestion-deletion-render
Jul 30, 2026
Merged

adnaan merged 1 commit into
mainfrom
suggestion-deletion-render

Conversation

@adnaan

@adnaan adnaan commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

prereview suggest has always accepted a suggestion whose proposed is empty — suggest_cmd.go:139-142 validates only file and from_line. But the card rendered the after-pane unconditionally, so a pure deletion painted an empty green box, which reads as a bug rather than as "this text goes away".

The before-pane was already conditional, for the mirror case of a pure insertion. This makes the after-pane conditional too, and adds the affordance that was missing:

  • .sg-diff gains is-deletion, which strikes the before-pane through
  • a .sg-del-note caption (delete — accepting removes L4) stands in for the absent green box, so the card still says what accepting will do

Why this is load-bearing rather than cosmetic

Deletions are the common case for a document-simplify workflow — a pass over a plan is mostly cuts. A tool that proposes cuts through prereview suggest is unusable while every cut renders as an empty box.

Rendering safety

Every non-deletion suggestion renders byte-identically:

  • the 18 render goldens (TestTemplateRenderGolden) pass untouched
  • only testdata/prereview.tmpl.sig.golden moves — an intentional content change, regenerated with -update-sig per the repo's template guard convention

Tests

e2e/e2e_deletion_suggestion_test.go (chromedp) asserts:

  • no .sg-new element is emitted at all for a deletion — this is the actual regression; previously one existed and was empty
  • the .sg-diff.is-deletion marker is present
  • the before-pane still carries the removed text
  • the caption is non-empty and says what will happen (an empty caption would reproduce the bug in a new element)
  • accept/reject still work on a deletion
  • an ordinary replacement card is completely unaffected

Verified failing against the pre-fix template before landing — reverting partials.tmpl to HEAD produces exactly the two intended failures, so the test goes red if this regresses.

Full unit suite green; full browser e2e suite green (573s). Confirmed by eye in a running prereview, not only by reading the template.

🤖 Generated with Claude Code

https://claude.ai/code/session_014g9DCfyYjDZsMQ4xocgCMj

… empty box

`prereview suggest` has always accepted a suggestion whose `proposed` is empty
(suggest_cmd.go validates only `file` and `from_line`), but the card rendered the
after-pane unconditionally — so a deletion painted an EMPTY GREEN BOX, which
reads as a bug rather than as "this text goes away".

The before-pane was already conditional, for the mirror case of a pure insertion.
This makes the after-pane conditional too and adds the missing affordance:

- `.sg-diff` gains `is-deletion`, which strikes the before-pane through
- a `.sg-del-note` caption ("delete — accepting removes L4") stands in for the
  absent green box, so the card still says what accepting will do

This is load-bearing rather than cosmetic for the plan-simplify workflow, where
a pass over a document is mostly *cuts* — deletions are the common case there,
not an edge case.

Rendering for every non-deletion suggestion is byte-identical: the render goldens
pass untouched, and only the signature golden moves (an intentional content
change, regenerated with -update-sig).

Tests: e2e/e2e_deletion_suggestion_test.go asserts no `.sg-new` is emitted at all
for a deletion (the actual regression), the `is-deletion` marker, a non-empty
caption, that accept/reject still work, and that an ordinary replacement card is
untouched. Verified failing against the pre-fix template before landing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014g9DCfyYjDZsMQ4xocgCMj
@adnaan
adnaan merged commit 0e80bc4 into main Jul 30, 2026
11 checks passed
@adnaan
adnaan deleted the suggestion-deletion-render branch August 4, 2026 01:45
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