Repository navigation
Description
Problem or Motivation
D7 of the approved pipeline split design (tracker #5482): watch reads a failed review.verdict as a draft reason only after the review unit reaches 80 % precision or more on 30 PRs. About 4 ready delivery PRs a week gives 8 weeks live, so replays of closed PRs add cases.
Proposed Solution & Architectural Design
- Run the review unit (feat(roadmap): a review unit posts a COMMENT review on each ready PR #5521) in shadow on ready delivery PRs and on replays of closed delivery PRs.
- Collect the verdict of a person for each finding: 30 PRs, about 2.5 h of owner time.
- Compute the precision with the Wilson interval. Record it in
docs/roadmap/job-success.md.
Target Subsystem
Roadmap Service and roadmap jobs (src/devops_cli/review/, the eval commands).
Acceptance Criteria
- Test first: the precision function gives the expected value and interval on fixed verdicts. The test fails on the base.
- Live proof: the unit runs as the App in shadow on the live ready delivery PRs. A comment on this issue gives the result lines, n, the precision and its interval.
Existing Tool Considered
devops review (tools find the issues, ADR 0005) and statsmodels. Build: 100,000 to 200,000 agent tokens and 0.5 day. Review spend: one model correlation for each PR head.
Related
Tracker #5482, Phase 7. Depends on #5521. Owner step: 30 verdicts. #5170.
Source: #5482
Alternatives check of 2026-11-23: in-use.
The repository already uses this tool.
Tool: statsmodels (https://pypi.org/project/statsmodels), BSD-3-Clause, last activity 2026-08-30, maintained.
Reason: Searches found no tool that runs a review unit in shadow or collects person verdicts per finding, but statsmodels supplies the Wilson score interval, so it covers only the interval part of the measurement.
Covers:
- Wilson score interval at 95% confidence
- Proportion input of correct and incorrect findings
- Plain function callable from the review eval command
Lacks:
- Shadow run of the review unit on ready delivery PRs
- Collection of one person verdict for each finding
- Recording of the measured precision in the job success page
Proposed design
Problem statement
The review unit needs a measured precision before watch reads a failed review.verdict as a draft reason. This issue adds the offline precision function and one result line in devops review stats. The shadow run on 30 live PRs, the owner verdicts and the recorded measurement are in #6275.
Acceptance criteria
Requirement: Precision over decided findings
The review precision function SHALL count verified and mitigated findings as correct, count invalidated findings as incorrect, and exclude unverified findings from the denominator.
Scenario: Mitigated and unverified verdicts
- WHEN A test calls
review_precisioninsrc/devops_cli/review/precision.pywith 4 verified, 2 mitigated, 2 invalidated and 2 unverified findings. - THEN The test asserts n=8, precision=0.75, unverified=2 and the Wilson interval 0.409 to 0.929.
Requirement: Wilson interval
The review precision function SHALL compute the 95% Wilson score interval with statsmodels.stats.proportion.proportion_confint.
Scenario: Fixed verdicts give the expected interval
- WHEN A test calls
review_precisionwith 8 verified and 2 invalidated findings. - THEN The test asserts n=10, precision=0.8 and the interval 0.490 to 0.943.
Requirement: No decided findings
The review precision function MUST report no precision and no interval when no finding has a decided verdict.
Scenario: No decided verdicts
- WHEN A test calls
review_precisionwith 5 unverified findings. - THEN The test asserts n=0, precision is none, interval is none and unverified=5.
Requirement: Statsmodels call
The review precision function SHALL call statsmodels.stats.proportion.proportion_confint with method='wilson' and alpha=0.05.
Scenario: Statsmodels computes the interval
- WHEN A test replaces
proportion_confintwith a spy and callsreview_precisionwith 8 verified and 2 invalidated findings. - THEN The spy records one call with
method='wilson'andalpha=0.05.
Requirement: Precision result line
The devops review stats command SHALL print one precision result line with the decided finding count, the precision and its Wilson interval, in addition to its existing report.
Scenario: Fixed review sessions print the precision line
- WHEN A test runs
devops review statson fixed review sessions that hold 24 verified and 6 invalidated findings. - THEN The command exits 0 and prints
review_precision n=30 precision=0.800 ci_low=0.627 ci_high=0.905.
Existing Tool Considered
statsmodels (https://pypi.org/project/statsmodels), verdict in-use in the alternatives check of 2026-11-23 in the issue body. That block gives what statsmodels covers, the Wilson score interval at 95% confidence, and what it lacks, the shadow run, the person verdicts and the recording. This proposal calls statsmodels.stats.proportion.proportion_confint(method='wilson', alpha=0.05) for the interval. No tool covers the count of correct and incorrect verdicts, which is about 10 lines in src/devops_cli/review/precision.py; to build and keep it costs about 2,000 agent tokens and under 1 hour. The issue body gives 100,000 to 200,000 agent tokens and 0.5 day for the shadow runner and the verdict collection, which #6275 holds.
Key questions
- Which verdicts count as correct when computing review precision?: Count
verifiedandmitigatedas correct. Countinvalidatedas incorrect. Excludeunverifiedfrom the denominator and report its count. Precision is (verified + mitigated) / (verified + mitigated + invalidated). (best practice) [sources: CONTEXT.md, docs/adr/0005-review-findings-come-from-tools-not-models.md, src/devops_cli/ai/review/category_metrics.py]- Chosen: Verified and mitigated. CONTEXT.md defines mitigated as a defect that is present, so it is a true positive.
- Rejected: Verified only. It treats a present defect as a false positive and understates precision.
- Rejected: All verdicts, with unverified as incorrect. An unverified finding has no decision and is no evidence of a false positive.
- Which library computes the Wilson interval?: Use
statsmodels.stats.proportion.proportion_confintwithmethod='wilson'andalpha=0.05. The repository already calls it insrc/devops_cli/roadmap/job_grade.py. (best practice) [sources: src/devops_cli/roadmap/job_grade.py, src/devops_cli/roadmap/stage/stage_findings.py]- Chosen: statsmodels proportion_confint. The repository already uses it for the same interval, and it is maintained.
- Rejected: Custom Wilson formula. It adds code to test and keep for a calculation that the maintained library already gives.
- What is n for the Wilson interval?: n is the number of findings with a decided verdict: verified, mitigated or invalidated. A finding is the unit whose precision is measured, and one review session can hold more than one finding. (best practice) [sources: CONTEXT.md, src/devops_cli/ai/review/category_metrics.py]
- Chosen: Decided findings. Precision is a ratio of findings, and each finding has one verdict.
- Rejected: Count of PRs. A PR can hold several findings, so a PR count is not the number of Bernoulli trials.
- Rejected: Mean of per-PR precision. It gives a PR with one finding the same weight as a PR with many findings.
- Which command prints the precision result?: Extend the existing
devops review statssubcommand insrc/devops_cli/commands/review.py. It already counts theVERIFIED,MITIGATED,INVALIDATEDandUNVERIFIEDverdicts of the review sessions, so it adds one precision line and no new entry point. (best practice) [sources: src/devops_cli/commands/review.py, src/devops_cli/ai/review/history.py, docs/roadmap/job-success.md]- Chosen: Extend
devops review stats. The command already reads the verdicts of the review sessions, so the measure adds no second entry point. - Rejected: New
devops review evalsubcommand. No such command exists, and a second eval entry point duplicates the stats read. - Rejected: Extend
devops roadmap eval grades. That command reads the result lines of the roadmap jobs, not the findings of a review session. - Rejected: Doc-only calculation. A person would repeat the calculation by hand and could use a different method.
- Chosen: Extend
- Does the offline precision work need the review unit of feat(roadmap): a review unit posts a COMMENT review on each ready PR #5521?: No. The precision function reads the findings and verdicts of stored review sessions, which
devops reviewwrites today. The shadow run on live PRs and the 30 owner verdicts are in feat(roadmap): measure review precision on 30 live PRs #6275, and that issue waits on feat(roadmap): a review unit posts a COMMENT review on each ready PR #5521. [sources: src/devops_cli/commands/review.py, src/devops_cli/ai/review/history.py] - Where does the measured result go?: The live measurement goes to
docs/roadmap/job-success.mdwith the shadow run in feat(roadmap): measure review precision on 30 live PRs #6275. This issue writes no doc text, because the grade table of that page is generated bydevops docs generate. (best practice) [sources: docs/roadmap/job-success.md, src/devops_cli/roadmap/job_grade.py]- Chosen: Record in the job success page with the live run in feat(roadmap): measure review precision on 30 live PRs #6275. No measurement exists before the shadow run, and the page holds a generated grade table.
- Rejected: Record the method in the page now. The page states the Wilson method already, and a hand edit of its generated table fails the docs check.
- Rejected: New report file. It adds a second place for the same measure.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 13, 2026
Both concern the review unit's grading, but #5170 adds a job result line per session while this item computes and records a precision metric over 30 PRs.devops-cli-service commentedon Nov 17, 2026
Alternatives check: in-use
Reason: Searches for a Wilson-interval tool surfaced only statsmodels, whose proportion_confint gives the interval the acceptance criteria need; it does not run the unit in shadow, collect human verdicts or record the result.
The repository already uses this tool.
Tool: statsmodels (https://pypi.org/project/statsmodels), BSD-3-Clause, last activity 2026-08-30, maintained.
Covers:
Lacks:
Searches (9)
Tools considered:
Searches run:
Sources:
A person decides what this check of 2026-11-17 means for the item.
devops-cli-service commentedon Nov 18, 2026
Status set to Ready at 86358b6 (see proposed design in issue body).
Moved to new items: #6275.
dan-petty commentedon Nov 25, 2026
Returning
#5522tostatus/newwithout implementing because the item depends on unbuilt#5521and cites a nonexistent command:#5521): The issue body statesDepends on #5521(feat(roadmap): a review unit posts a COMMENT review on each ready PR), which is stillopenwithstatus/newandrefine.blocked_by: 5170. No review unit or review-unit PR session writer exists yet.sha=86358b6c) requires addingreview_precisionoutput (plain line and--format json) to "the review eval command" (WHEN A test runs the review eval command on 30 fixed review sessions) and rejects adding a new command. Neithersrc/devops_cli/commands/review.py(review,findings,verify,intake,stats,benchmark,score,export-feedback,fetch-databases) norsrc/devops_cli/commands/roadmap_eval.py(stage,implement,intake,jev,verify,screen,completeness,grades,harbor) has areview evalcommand. (Existingdevops review statscountsVERIFIED/MITIGATED/INVALIDATED/UNVERIFIEDverdicts acrossReviewSessionStorewithout Wilson intervals;devops review scorescores sessions against--labelsfiles.)Re-refine after
#5521lands, or specify the exact existing command/module (devops review stats,devops roadmap eval review, or a dedicated command) that should exposereview_precision.devops-cli-service commentedon Nov 25, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.