4.2 KiB
4.2 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 09-diff-finding-annotations | Render findings as anchored diff annotations, with stale handling | done | 6 |
|
plan.md | ../../specs/agents/requirements/native-code-review.md |
Task 09: Render findings as anchored diff annotations
Findings appear where the code is, in the same annotation surface as anchored comments.
Inputs
- Spec What (findings render at their anchored line; advisory actions), the stale scenario, and the "not in current changes" failure row.
components/diff/use-diff-annotation-renderer.tsx— theAnnotationMetadataunion to extend.components/diff/use-diff-viewer-state.ts—useWalkthroughSelectionis the exact shape for a store-driven annotation source;buildAnnotationsshows how annotations anchor toendLine.components/diff/comment-display.tsx— card layout and action-button conventions.apps/web/AGENTS.mdcomponent limits (files ≤600 lines, components <200 lines) andcursor-pointerrequirement.
Work
components/diff/review-finding-card.tsx— severity chip (blocker/majordestructive-toned,minor/nitmuted), category badge, title, Markdown body via the existing comment Markdown renderer, optionalsuggestionin a read-only code block with an explicit "not applied automatically" affordance, and the three actions.resolved/dismissedrender collapsed with an Undo action.components/diff/use-diff-annotation-renderer.tsx— add"review-finding"to the metadata type union with afindingfield, and render the card.components/diff/use-diff-viewer-state.ts—useReviewFindingAnnotations({ filePath, repo, diffHash })reading the review slice for the active task, filtering to this file viafindingFileKey, dropping stale findings that cannot be re-anchored, usingreanchorFindingfor the rest, and anchoring atend_lineon the finding'sside. Append to the annotation list next to the walkthrough annotation. Pass the file's currentdiffHashdown from the review file list so the hook does not recompute it per render.components/review/review-file-findings-banner.tsx— collapsible group rendered directly above a file's diff listing that file's stale findings and its findings whose anchor no longer exists, each with the same action set. This is the surface that guarantees a stale finding is neither dropped nor mis-anchored.components/review/review-diff-list.tsx— threaddiffHashand the banner into each file section; keep the file component under the size limit by extracting the banner rather than growing the section component.hooks/domains/review/use-send-finding-to-agent.ts— builds the agent context payload from a finding (repository, path, line range, severity, title, body) and sends it through the same pathuse-run-comment.tsuses for a diff comment; the finding staysopen.hooks/domains/review/use-finding-actions.ts— resolve / dismiss / undo wrappers overupdateReviewFindingStatuswith optimistic slice updates and rollback on failure.
Acceptance
- An open non-stale finding renders at its
end_linein the correct file, in a multi-repository task only inside its own repository's file. - A stale finding does not render inline at its stored line; it appears in the file's stale banner.
- A stale finding whose
anchor_textstill exists renders inline at the relocated line. - Resolve collapses the card and decrements the open count; failure rolls the optimistic update back.
- Send-to-agent produces the expected context payload and leaves the finding
open.
Verification
cd apps/web && pnpm vitest run components/diff/use-diff-viewer-state.test.ts components/diff/review-finding-card.test.tsx hooks/domains/review
cd apps/web && pnpm run typecheck && pnpm lint
Files likely touched
components/diff/{review-finding-card.tsx,use-diff-annotation-renderer.tsx,use-diff-viewer-state.ts}, components/review/{review-file-findings-banner.tsx,review-diff-list.tsx}, hooks/domains/review/{use-send-finding-to-agent.ts,use-finding-actions.ts}, plus tests.
Output contract
Summary, files changed, tests run with results, blockers, risks, status: done, plan checkbox.