-
Notifications
You must be signed in to change notification settings - Fork 1
review: line-number-annotated staged diffs #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2d746ac
6727eb6
5c00cf3
52073ef
93770e6
30e7527
19f06cb
d1b5288
254dfc4
917cc11
0ee295a
58cd4ed
b19b08d
bced291
da1115c
a6883be
0d02672
93d8dec
e3b34eb
491a983
7b5318c
5dd182b
92bffa2
2be8ede
3a8fc5c
813767c
2812679
2ce35a0
c0fece2
e02ac40
d225bd4
de239ee
1329297
45c6f6e
976b925
cbc838d
63097f1
9012508
25133b4
0a3d212
a547972
391151b
d2c4c70
082f580
48cdc39
284fa40
7f9ae36
996766f
fb81be8
a659be8
b7c3786
541e413
fd42efd
6d3459a
1438a67
98157c2
bbb624c
4d1ac62
193ae69
7a2065c
00ce9d4
4bd445c
da1e1db
1bc9e08
0123a92
64f8115
5631477
6a1a8bc
1dcc7c3
18eda9f
26c8526
a63648f
149bf14
52c954d
de525c3
64f5b14
2369b86
59f78c7
3f96569
c7ae211
6b8e3c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "review": minor | ||
| --- | ||
|
|
||
| Line-number-annotated staged diffs: remove the anchor mis-counting at the source. The mis-anchor pathology anchor-snap repairs downstream (reviewers counting unified-diff text lines instead of file lines) exists because the staged diff makes the model count; the staging now prints the real number on every content line so anchors are read off the page, never counted. A new deterministic `annotateDiffLineNumbers` (`lib/diff.ts`) prefixes each hunk content line with its line number (`+`/context lines carry the NEW-file RIGHT-side number, `-` lines the OLD-file LEFT-side number) while keeping the diff marker in column one, so annotated text still splits into file sections. The provenance CLI writes `full-stripped-annotated.diff` beside the raw stripped diff, and a new `annotate <in> <out>` subcommand produces `pr-annotated.diff` after Phase 1 builds `pr.diff` (the scoped and flip-gated depths refresh the annotated copies the same way). Every finding-producing reviewer (correctness, skill-auditor, conventions, the four whole-change reviewers, and all eleven specialist lenses via the shared disciplines block) now reads the annotated copy, takes `anchor.line` from the printed number, and strips the prefix when quoting code or authoring a `suggested_patch`. Everything that PARSES a diff keeps reading the raw files: provenance, re-review hunk fingerprints (whose signatures must not shift), scoped staging, and pattern-triage/claim-validator are untouched. The eval stages the annotated siblings for both arms unconditionally, and only a review.md version that names them reads them, so the A/B against a pre-annotation baseline is a pure prompt delta with no staging flag. The measurement instrument rides along: per-case anchor-snap counts (`perCase.snapped`) in the arm report and a pooled "Findings anchor-snapped" row in the aggregate, version-tolerant of older artifacts — if annotation works, candidate-arm snaps fall to zero because anchors arrive correct, with the anchor-snap gate remaining as the deterministic backstop. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,13 @@ export type ArmRunReport = { | |
| expected: string; | ||
| caught: number; | ||
| missed: string[]; | ||
| /** | ||
| * Findings the provenance gate anchor-snapped this run. The direct | ||
| * observable for anchor fidelity: a prompt change that fixes | ||
| * anchoring at the source (line-number-annotated diffs) shows up | ||
| * here as candidate-arm snaps falling to zero. | ||
| */ | ||
| snapped: number; | ||
| /** `<agent>: <reason>` per failed agent (diagnosable from the report). */ | ||
| failedAgents: string[]; | ||
| /** Present iff the case is an open-PR (rereview) case. */ | ||
|
|
@@ -170,6 +177,10 @@ export const renderMultiMarkdownReport = (report: MultiAbReport): string => { | |
| return lines.join("\n"); | ||
| }; | ||
|
|
||
| /** Total anchor-snaps across an arm's case runs (see `perCase.snapped`). */ | ||
| const snappedTotal = (arm: ArmRunReport): number => | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (non-blocking): |
||
| arm.perCase.reduce((sum, c) => sum + c.snapped, 0); | ||
|
|
||
| /** `caseId:specKey` -> drop bucket, for every found-but-dropped miss. */ | ||
| const dropClassByKey = (arm: ArmRunReport): Map<string, string> => { | ||
| const map = new Map<string, string>(); | ||
|
|
@@ -345,6 +356,11 @@ export const renderMarkdownReport = (report: AbReport): string => { | |
| String(dropClassByKey(baseline).size), | ||
| String(dropClassByKey(candidate).size), | ||
| ), | ||
| row( | ||
| "Findings anchor-snapped", | ||
| String(snappedTotal(baseline)), | ||
| String(snappedTotal(candidate)), | ||
| ), | ||
| "", | ||
| ]; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (non-blocking): This PR makes
snappeda required field onSampleRun(aggregate.ts:59), but thesampleRunbuilder ineval/aggregate.test.ts(not touched by this PR) omits it, so thissnapped += run.snappedevaluates toNaNandrenderAggregateMarkdownrenders| Findings anchor-snapped | NaN | ... |for reports built from that fixture. Production reports are safe (parseArmdefaults it to 0), so this is test-fixture-only. Addsnapped: 0to the builder's defaults. Relatedly, every fixture exercises only the zero branch, so the populated-count path (parse ataggregate.ts:164plus this sum) is untested; a fixture with a non-emptysnappedByProvenancewould cover it.Lower-confidence observations
workflows/review/lib/diff.ts:344—-lines are annotated with the OLD-file (LEFT) number, while the "takeanchor.linefrom the printed number — never count" instruction (review.md:1597/1701) isn't qualified for-lines. The schema line ("lineis a RIGHT-side number",review.md:1662) mitigates this, but consider stating explicitly that a deletion finding anchors on the adjacent RIGHT-side context/added number, not the-line's printed OLD number — otherwise a side-less deletion anchor can be dropped by the RIGHT-side provenance gate where OLD/NEW diverge.workflows/review/review.md:1702— the new "strip theNNN|prefix" obligation for quoted code /suggested_patchhas no deterministic backstop (unlike anchor-snap for anchors);suggested_patchis validated only as a non-empty string, so a leaked prefix would flow verbatim into a posted suggestion block. Consider a code-level strip in Phase 3.