Skip to content

feat(roadmap): measure the precision of the review unit on 30 PRs #5522

Open

Description

@dan-petty

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

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_precision in src/devops_cli/review/precision.py with 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_precision with 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_precision with 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_confint with a spy and calls review_precision with 8 verified and 2 invalidated findings.
  • THEN The spy records one call with method='wilson' and alpha=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 stats on 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 verified and mitigated as correct. Count invalidated as incorrect. Exclude unverified from 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_confint with method='wilson' and alpha=0.05. The repository already calls it in src/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 stats subcommand in src/devops_cli/commands/review.py. It already counts the VERIFIED, MITIGATED, INVALIDATED and UNVERIFIED verdicts 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 eval subcommand. 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.
  • 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 review writes 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.md with 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 by devops 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.

Moved to new items

#6275

Activity

  1. added
    source/agent
    on Nov 13, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 13, 2026
  3. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 13, 2026
  5. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    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:

    • Wilson score interval for a binomial proportion
    • Interval bounds from a count and a total
    • Pure Python dependency, no service to run

    Lacks:

    • No collection of a person's verdict per finding
    • No shadow run on live ready delivery PRs
    • No write of the precision to the roadmap doc
    Searches (9)

    Tools considered:

    Searches run:

    • python Wilson score interval proportion_confint statsmodels, results: 5
    • statsmodels proportion_confint method wilson documentation, results: 5
    • python library Wilson confidence interval binomial proportion package, results: 5
    • "wilson" interval calculator open source tool github, results: 5
    • ststsmodels confidence intervals proportions statsmodels.stats.api, results: 5
    • statsmodels, results: 5
    • Wilson score interval, results: 5
    • statsmodels proportion_confint github, results: 5
    • python package binomial proportion confidence interval wilson score pypi statsmodels scipy, results: 5

    Sources:

    A person decides what this check of 2026-11-17 means for the item.

  6. added
    status/ready
    and removed
    status/new
    on Nov 18, 2026
  7. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 86358b6 (see proposed design in issue body).

    Moved to new items: #6275.

  8. dan-petty commented on Nov 25, 2026

    @dan-petty
    OwnerAuthor

    Returning #5522 to status/new without implementing because the item depends on unbuilt #5521 and cites a nonexistent command:

    1. Open dependency (#5521): The issue body states Depends on #5521 (feat(roadmap): a review unit posts a COMMENT review on each ready PR), which is still open with status/new and refine.blocked_by: 5170. No review unit or review-unit PR session writer exists yet.
    2. Missing command premise: The refined design (sha=86358b6c) requires adding review_precision output (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. Neither src/devops_cli/commands/review.py (review, findings, verify, intake, stats, benchmark, score, export-feedback, fetch-databases) nor src/devops_cli/commands/roadmap_eval.py (stage, implement, intake, jev, verify, screen, completeness, grades, harbor) has a review eval command. (Existing devops review stats counts VERIFIED/MITIGATED/INVALIDATED/UNVERIFIED verdicts across ReviewSessionStore without Wilson intervals; devops review score scores sessions against --labels files.)

    Re-refine after #5521 lands, or specify the exact existing command/module (devops review stats, devops roadmap eval review, or a dedicated command) that should expose review_precision.

  9. added
    status/new
    and removed
    status/ready
    on Nov 25, 2026
  10. added
    status/ready
    and removed
    status/new
    on Nov 25, 2026
  11. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/roadmapsource/agentstatus/readytype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions