Repository navigation
Description
Context & Rationale
Every review report has a "Historical Baseline FP Rate" column (#434). It compares this review session's false-positive rate per category with earlier sessions. Three defects make that figure wrong.
- The current session counts itself.
generate_consolidated_reportwrites findings.json (src/devops_cli/ai/review/pipeline.py:3600-3601) before it builds the report (pipeline.py:3616). The baseline reads the session's parent directory (pipeline.py:3034-3035), so the session being compared is part of its own history. - Repeat sessions count again. Every reader sums every session directory: the baseline (
src/devops_cli/ai/review/category_metrics.py:114-124),devops review stats(src/devops_cli/commands/review.py:1242,:1141-1159) and the feedback export (src/devops_cli/ai/review/exporter.py:145-153). A re-review, ordevops review benchmark(3 sessions by default,src/devops_cli/config/defaults.py:391), counts one subject several times.ReviewSessionPayload(src/devops_cli/ai/review_schema.py:1125-1143) records nothing about what was reviewed, so repeats cannot be told apart. The tests passtarget=andtimestamp=to it (tests/test_category_metrics.py:173-174,:197-198,:281-282,:300-301). Pydantic ignores unknown fields, so those values are silently dropped. - The two sides count different findings. The session side uses every finding the session raised (
candidate_findings or all_findings,pipeline.py:3119-3120). The history side reads findings.json, and the pipeline writes only reportable, non-invalidated findings there (pipeline.py:2840-2846). Every finding goes to candidates.json instead (pipeline.py:3603-3610). In one workstation's history of 26 sessions, findings.json holds 51 invalidated findings out of 2,237 (2.3%), and candidates.json holds 1,840 out of 4,090 (45%).
Evidence:
- A scratch probe calls
format_category_baseline_markdownon a temporary reviews directory. With one earlier VERIFIED session, the cell reads— (baseline established). Once the current INVALIDATED session is written first, it reads50.0% (1/2). Adding two byte-identical copies of the earlier session makes it25.0% (1/4). This is a function-level probe: the pipeline itself never writes INVALIDATED findings into findings.json (defect 3). - The same 26 sessions cover 8 profile targets. 4 of those targets were reviewed more than once, across 22 sessions. All 26 have a profile.json, which records a target but no commit (
src/devops_cli/ai/review/profile.py:101-123). None records a subject, and none holds a human verdict. - Benchmark records already have an identity rule:
RunRecord.subject_keyisrun_store.digest(subject)(src/devops_cli/ai/run_store.py:54-57,:89-93). Review sessions are not in that store, andload_runs(run_store.py:201-211) does not collapse repeats either. - Two code paths write findings.json. One is the pipeline. The other is
_save_findings_json(src/devops_cli/ai/review/runner.py:426-469), reached from_run_persona_loop(runner.py:1257) through_write_summary(runner.py:707-716) when the analysis client is notLLMClient(runner.py:2151). It stampsgenerated_atin local time (runner.py:451), while the pipeline uses UTC. - Human verdicts live only in findings.json:
devops review verifysetsby = "human"(commands/review.py:1062) and rewrites findings.json alone (commands/review.py:1082). - A session run with
--no-verificationstill writes findings.json and candidates.json: the verification stage is skipped (pipeline.py:2671), but reporting is not (pipeline.py:3556). Every finding in it stays UNVERIFIED. - A branch review without a named branch diffs the working tree (
git diff HEAD,runner.py:1813-1819), so no commit identifies what it reviewed. - Full
ReviewSessionPayloadparsing is slow, becauseFindingvalidators normalize every verification criterion (review_schema.py:464-475). With a warm cache, the 26 findings.json files take about 1.7 s and the 26 candidates.json files about 3.4 s. A model holding only the fields the figures read parses both sets in 0.23 s.
Scope & Deliverables
Deliverable: one PR that records what each review session reviewed. History is then read through one reader that leaves out the current session and counts each subject once.
-
Subject.
ReviewSessionPayloadgainssubject: dict[str, str], empty by default.history.review_subject(target_type, target_ref, pages)returns{"type": target_type, "ref": target_ref, "input": <first 16 hex chars of sha256 over the pages joined by "\n">}.history.subject_key(subject)returnsrun_store.digest(subject), or None for an empty subject._execute_review_workflow(runner.py:2115) builds the subject once and passes it to both writers:ReviewPipelineOrchestrator, and_save_findings_jsonvia_run_persona_loopand_write_summary._save_findings_jsonstampsgenerated_atin UTC.
-
Reader. A new module,
src/devops_cli/ai/review/history.py, lists the completed sessions in a reviews directory, meaning those with a findings.json. For each session it returns:- its path;
- its subject key;
- its profile target, if it has a profile.json;
generated_at;- the findings in findings.json;
- every finding it raised (candidates.json if present, otherwise findings.json).
The reader takes
exclude: Path | Noneand drops that session before it collapses repeats. It parses with a slim pydantic model that holds only the fields the figures read. For each subject key it counts one session, ranked by:- most
verified_by == "human"findings in findings.json; - then most findings raised that carry a verdict (status other than UNVERIFIED);
- then the newest
generated_at.
Sessions without a subject each count on their own. They are reported as target-only if they have a profile.json, and as unkeyed otherwise.
-
Baseline.
collect_historical_category_metricsreads every finding raised, from the counted sessions, through the reader.format_category_baseline_markdowntakes the current session directory asexclude, and_build_category_baseline_sectionpassesself.session_dir.- The
total_sessions > 1gate (category_metrics.py:148) changes to: at least one counted earlier session has this category. - A line under the table reads
_Baseline: {counted} earlier session(s), {repeats} repeat session(s) collapsed, this session excluded._
-
Stats.
devops review statsuses the reader, and its tables count one session per subject. It printsSessions: {total} (counted {counted}: {repeats} repeat sessions collapsed, {target_only} target-only, {unkeyed} unkeyed). Its findings still come from findings.json (see key question 6). -
Tests and docs.
- Replace the dropped test arguments with
generated_at=andsubject=. - Add the regression tests below.
- Add a CHANGELOG entry that states the feat(review): track false-positive rate across runs #434 correction.
- Write the task file under the task-file rules in force when the PR merges. Before feat(github): github-sourced roadmap, migration and generated roadmap view (
devops roadmap migrate,render) #739's task-file split-off (backlog) merges, setdocs/agent/tasks/task-607-run-identity-review-history-with-a-leave-one-out-baseline.mdto Done and remove its stale v0.2.24 milestone. After that split-off merges, task files carry no Status, Milestone or Priority line and Backlog task files are gone, so write the file fresh as the implementation record. docs/ROADMAP.mdbecomes a generated view under ADR 0001 once feat(github): github-sourced roadmap, migration and generated roadmap view (devops roadmap migrate,render) #739 merges. Before that, move the feat(review): subject-keyed review history with a leave-one-out baseline #607 entry from the v0.2.23 section (docs/ROADMAP.md:582) to v0.2.25 in its delivered state, and add a correction note under the feat(review): track false-positive rate across runs #434 entry (docs/ROADMAP.md:240). After that, do not edit it.
- Replace the dropped test arguments with
Acceptance criteria: automated tests use tmp_path only, with no network, model or scanner.
- Subject recorded.
- A test runs
generate_consolidated_reporton a temporary session directory and reads the same subject back from findings.json. - A second test calls
_save_findings_jsonwith a subject. It reads the subject back, and checks thatgenerated_atparses with a UTC offset. - A third test runs
devops review verify(CliRunner) on a session and checks that the subject survives the rewrite. - A fourth test patches
ReviewPipelineOrchestratorand_run_persona_loop, then calls_execute_review_workflowwith an analysis client that is notLLMClient. Both patched callables receivereview_subject(target_type, target_ref, pages)for the arguments given.
- A test runs
- Subject key. A unit test with a tuple assertion checks three cases. The same type, ref and pages give the same key. One changed byte in a page gives a different key. An empty subject gives None. This last case is the guard against every older session collapsing under
digest({}). - Reader counts. The fixture has 3 sessions with one subject, 1 target-only session, 1 unkeyed session, and 1 directory without findings.json. The reader returns
(sessions, counted, repeats, target_only, unkeyed) == (5, 3, 2, 1, 1). Withexcludeset to the newest of the 3 same-subject sessions, it returns(4, 3, 1, 1, 1), and the counted session for that subject is the next one by rank. Tuple assertion. - Counted session. Unit test, tuple assertion, three cases within one subject:
- an older session with a human verdict counts over a newer one without;
- with no human verdicts, an older session with machine verdicts counts over a newer one whose findings are all UNVERIFIED;
- otherwise the newest
generated_atcounts.
- Leave-one-out regression. Earlier session P has subject S1. Its candidates.json holds one INVALIDATED and one VERIFIED
secret_scanningfinding, and its findings.json holds only the VERIFIED one. The current session C also has subject S1 and the newestgenerated_at. It is written to disk before rendering, as the pipeline does, and passed asexclude.- The historical cell reads
50.0% (1/2), and the cell is identical with or without C on disk. - After two more sessions with subject S1 and the same findings are added, the cell still reads
50.0% (1/2)and the note line reports 2 repeat sessions collapsed.
- The historical cell reads
- Gate. With no earlier session, the cell reads
— (baseline established). When C is on disk and the only earlier session has C's subject (a first re-review), the cell shows that earlier session's figures. - Population. A persona-loop-shaped session with findings.json and no candidates.json feeds the baseline from findings.json.
- Slim parse. On a fixture that includes a lower-case status and a finding with no category, the reader's per-category figures equal
compute_category_metricsover a fullReviewSessionPayloadparse of the same files. Tuple assertion. - Stats. CliRunner on the fixture from criterion 3 prints the
Sessions:line with those counts, and the status table counts each subject once. Updatetest_review_stats_command(tests/test_review_verification.py:131). - Speed. Each new or changed test runs in under 1 s, checked with
uv run pytest tests/test_category_metrics.py tests/test_review_history.py tests/test_review_verification.py --durations=0.uv run devops cipasses within its 5-minute budget. - Docs.
uv run pytest tests/test_agent_task_files.pypasses. In PR review: the task file follows the rules in force at merge and has no stale v0.2.24 milestone; the CHANGELOG entry names the feat(review): track false-positive rate across runs #434 correction;docs/ROADMAP.mdis edited as in deliverable 5 before feat(github): github-sourced roadmap, migration and generated roadmap view (devops roadmap migrate,render) #739, or untouched after it. - Person-run check (needs the model gateway):
Compared with the first
uv run devops review stats uv run devops review benchmark src/devops_cli/ai/review/category_metrics.py --runs 2 uv run devops review statsstats, the second shows 2 more sessions, 1 more counted session and 1 more repeat. The second benchmark session's review.md carries the baseline note line.
Key questions:
-
What identifies a review session's subject? (proposed)
{"type", "ref", "input"}, whereinputis a digest of the review pages, keyed withrun_store.digest.- One rule covers PRs, branches and paths.
- It needs no extra git or GitHub call.
- It covers working-tree branch reviews, which have no commit.
- A PR's diff changes only when its head or base changes, so the key follows the commits.
Two limits are accepted. Pages pass through devops-cli's paging and redaction, so a change to either re-keys every subject. A path review's ref is the resolved absolute path, so the same files in another worktree are a different subject. The earlier plan (PR head SHA, branch SHAs,
_corpus_digestfor paths) needed three rules and missed working-tree diffs. Benchmark run records keep their own subject. -
Do personas, models or flags split a subject? (proposed) No. The subject is what was reviewed, as in
RunRecord, which keeps subject and setup fingerprint apart. A session over the same subject with different personas counts as a repeat. The counted-session rank (question 4) keeps a--no-verificationre-run from displacing a verified session. -
Leave out the current session, or its whole subject? (proposed) Only the session, dropped before repeats collapse. Earlier sessions of the same subject count once. Leaving out the whole subject would hide the baseline on every re-review.
-
Which session counts for a subject? (proposed) The one with the most human verdicts, then the most findings with a verdict, then the newest
generated_at. Human verdicts are the only labels a person wrote (commands/review.py:1062), so a later machine session must not displace them. A session whose verification stage was skipped has no verdicts, so it must not displace one that has them. This item does not merge findings across sessions. -
How do sessions without a subject count? (from this issue's original constraint) Each counts on its own and is reported as target-only (has a profile.json) or unkeyed. A key is never derived from directory names or profile targets, and these sessions are never dropped. Every session on disk today is target-only.
-
Which findings does history read? (proposed) The baseline reads every finding raised: candidates.json, otherwise findings.json. That is the same population the session side uses. Stats keeps findings.json, because
devops review verifywrites human verdicts only there. Its category table therefore still counts reported findings only and will differ from the baseline. Deciding which file holds every finding with every verdict belongs to refactor(review): review session store that owns layout, fingerprints and verdicts #771. -
Do human verdicts reach the baseline? (proposed) Not when a session has a candidates.json, because human verdicts are written only to findings.json (
commands/review.py:1082). Overlaying them would need a match between consolidated and per-persona findings, which is refactor(review): review session store that owns layout, fingerprints and verdicts #771's job. Today no finding on disk has a human verdict, so nothing is lost yet. -
Add a history window? (proposed) No. The earlier plan added a window constant. With 26 sessions over 8 targets on the main workstation, no window would bind yet, and there is no data to calibrate one. Add it when history grows.
-
Should
ReviewSessionPayloadforbid unknown fields, so dropped arguments fail loudly? (proposed) No. A findings.json written by a newer version would then fail to load, and the readers skip unreadable files silently. Fix the tests instead. -
Where does the reader live? (proposed) In
ai/review/history.py, used bycategory_metrics.pyandcommands/review.py. refactor(review): review session store that owns layout, fingerprints and verdicts #771's session module can absorb it later. -
Does the feedback export change here? (proposed) No. Moving it needs a merge of human verdicts across sessions. That is the split-off item feat(review): feedback export counts each review subject once and keeps every human verdict #877.
-
Is a full-model parse fast enough? (proposed) No. Use the slim model: 0.23 s against about 5 s warm on today's 26 sessions, and the cost grows with history. Criterion 8 guards against the slim model drifting from the full one.
Constraint:
- No new dependency and no new finding match rule.
- A subject key never comes from directory names. An empty subject has no key. No session is ever dropped.
- When a subject's counted session is chosen, a session with more human verdicts always wins over a newer one.
ai/run_store.pyrecords and the exporter are unchanged.- Tests use
tmp_pathonly, with no network, model or scanner. Each runs in under 1 s and uses structural tuple assertions until test(cli): retire the tuple-assert mandate and detect opaque tuple asserts and presence-only tests #851 settles that. - Cyclomatic complexity stays at 10 or less per function (feat(cli): enforce the complexity cap with ruff C901 and an inline baseline that only shrinks #586).
Strategic Alignment
- Milestone: v0.2.25 (Multi-IDE MCP Scaffolding, Context Budgeting & Invariant Pinning). On 2026-10-01 it was retargeted from the shipped v0.2.23, as a P1 left open in a shipped release.
- Depends on: none.
- Related:
- feat(review): track false-positive rate across runs #434: the delivered baseline that this item corrects.
- Evaluation run store: every benchmark and evaluation saved and shared #554: the run store and
digest. - refactor(review): review session store that owns layout, fingerprints and verdicts #771 (backlog): the review session store. It would absorb the reader, and it owns the findings.json versus candidates.json question.
- feat(github): github-sourced roadmap, migration and generated roadmap view (
devops roadmap migrate,render) #739 (v0.2.25): makesdocs/ROADMAP.mda generated view; its task-file split-off (backlog) changes the task-file rules (ADR 0001). Deliverable 5 follows whichever rules are in force at merge. - feat(review): branch and pr reviews compute their own base-vs-head symbol delta #593 (v0.2.25): also edits PR preparation in
runner.pyand the session payload. Expect a merge conflict, not a dependency. - feat(review): per-model review quality baseline for the devops-review pool #475 (v0.2.25): its per-backend quality figures should count each subject once.
- test(security): pin the finding fingerprint and run-store digest to literal values #855: pins
run_store.digestvalues. - feat(review): order-independent review finding consolidation with a permutation test #608 (backlog): consolidation order.
- The export split-off.
- Source: vibes
tools/reliability_slo.py:287-290(_shard_namenames shards by timestamp and file count) anddocs/reliability/iterations/, where 5 of 35 shards fall in two groups of byte-identical files. - Split off (backlog): feat(review): feedback export counts each review subject once and keeps every human verdict #877 (feedback export counts each review subject once and keeps every human verdict).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 1, 2026
Retargeted from the shipped v0.2.23 to v0.2.25. It is still valid (checked 2026-10-01), and a P1 left open in a shipped release keeps precedence over P1 work committed later.
[-]feat(review): run-identity review history with a leave-one-out baseline[/-][+]feat(review): subject-keyed review history with a leave-one-out baseline[/+]feat(review): subject-keyed review history with a leave-one-out basel…
dan-petty commentedon Oct 2, 2026
Closed by #940, merged into
release/v0.2.25.GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by
devops gh issues close-merged.feat(release): v0.2.25 (#1089)
feat(review): the feedback export counts each review subject once and…