Skip to content

feat(review): first-class "edited in place" comment state (Tier B) - #196

Merged
adnaan merged 3 commits into
mainfrom
feat/det-review-tier-b
Jul 23, 2026
Merged

feat(review): first-class "edited in place" comment state (Tier B)#196
adnaan merged 3 commits into
mainfrom
feat/det-review-tier-b

Conversation

@adnaan

@adnaan adnaan commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What & why

Tier B of the deterministic review-state work (Tier A is #195). When a comment's exact lines are edited in place — the recorded text changes but its before/after context stays intact — prereview now classifies the comment edited and badges it "likely addressed".

This fills the gap when the agent addresses a comment but skips prereview done: the reviewer sees "likely addressed" (deterministic, from the file itself) and can confirm/resolve, instead of the comment sitting there looking untouched.

How

Detection reuses the existing relocate classifier (anchor.go). The case 0 that used to blanket-label a gone-from-its-lines comment outdated now splits it:

  • if the region is still bracketed by its recorded context (before and after neighbors both in place) → edited;
  • otherwise → outdated, as before.

Requiring both sides is what separates an in-place edit from a deletion (which shifts the after-context away so it no longer matches at the recorded position). Reuses neighborScore; no fuzzy matching.

Semantics (conservative default)

  • edited ≠ correctly addressed, so it stays actionable — a badge, never a drop. A wrongly-edited comment is never hidden.
  • done / resolved win: the badge is suppressed when either is set, so it only shows in the gap it exists to fill.
  • moved stickiness untouched; edited re-derives on each relocate.
  • The green badge (positive "likely addressed", distinct from grey moved / red outdated) renders in the inline card and the all-comments overview.

Tests

  • Unit: an in-place edit → edited; a deletion or a disturbed-context edit → outdated (guards the false positive).
  • Browser e2e: comment a line, edit it in place, reload → the "likely addressed" badge appears, no prereview command.
  • Template goldens regenerated for the new conditional (verified: no visible change for non-edited comments — the badge is absent).

Deferred (explicitly out of scope)

The opt-in auto-resolve toggle (make edited auto-leave the actionable set) from the plan's B3 — genuinely optional, and the conservative badge-only default is the safer starting point. Easy to add later if wanted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FG91be8B49Jq7sNMJskM8c

adnaan and others added 3 commits July 23, 2026 20:05
…ressed)

Tier B of the deterministic review-state work. When a comment's exact lines are
edited in place -- the recorded text changes but its before/after context stays
intact -- prereview now classifies it `edited` (anchor_status), a deterministic
"likely addressed" hint, and badges it. This fills the gap when the agent
addresses a comment but skips `prereview done`: the reviewer sees "likely
addressed" and can confirm/resolve, instead of the comment sitting there looking
untouched.

Detection lives in the existing relocate classifier (anchor.go): the `case 0`
that used to blanket-label a gone-from-its-lines comment `outdated` now splits it
-- if the region is still BRACKETED by its recorded context (before AND after
neighbors both in place) it is `edited`, else `outdated`. Requiring both sides is
what separates an in-place edit from a deletion (which shifts the after-context
away). Reuses neighborScore; no fuzzy matching.

Semantics (the conservative default):
- edited != correctly addressed, so it STAYS actionable -- a badge, never a drop;
  a wrongly-edited comment is never hidden. (An opt-in auto-resolve toggle is a
  deferred follow-up, not this change.)
- `done` (processed.jsonl) and `resolved` win: the badge is suppressed when
  either is set, so it only shows in the gap it exists to fill.
- `moved` stickiness is untouched; `edited` re-derives on each relocate.

Badge renders green (a positive "likely addressed", distinct from grey moved /
red outdated) in the inline card and the all-comments overview.

Tests: unit (an in-place edit -> edited; a deletion or a disturbed-context edit
-> outdated) + a browser e2e (comment a line, edit it in place, reload -> the
"likely addressed" badge appears, no prereview command). Template goldens
regenerated for the new conditional (no visible change for non-edited comments).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FG91be8B49Jq7sNMJskM8c
# Conflicts:
#	testdata/render/update-diff-card-thread.payload.golden
#	testdata/render/update-markdown-block-comment.payload.golden
…eanchor e2e

The Tier B `edited` classifier compared context with neighborScore>0, which a
far-off blank line could satisfy — so an in-place edit whose immediate before
line had actually changed was still read as "edited". Tighten it to require the
IMMEDIATELY-adjacent neighbor on each side to match, which cleanly separates an
in-place edit from a deletion (shifts the after-neighbor) or a restructure
(changes the before-neighbor).

The existing re-anchor e2e edited a commented line but kept its context intact —
which is now correctly `edited`, not `outdated`, so its outdated/re-anchor
assertions no longer applied. Make its rewrite a genuine orphan (change the
before-context too), keeping the trailing line as the re-anchor target. The
in-place-edit → edited case is covered by the new TestE2E_EditedInPlaceBadge.

Full unit + e2e suites green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FG91be8B49Jq7sNMJskM8c
@adnaan
adnaan merged commit 7ab8352 into main Jul 23, 2026
11 checks passed
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