Skip to content

feat(review): devops review score scores saved review sessions against a label file offline and reproduces the S11 and loop baselines (#1138) - #1472

Merged
dan-petty merged 1 commit into
release/v0.2.30from
feat/1138-review-score
Oct 9, 2026
Merged

dan-petty merged 1 commit into
release/v0.2.30from
feat/1138-review-score

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Summary

Until now, every review evaluation from S5 to S21 worked out precision, recall and stability by hand. The baselines existed only as prose, and the loop study's labels sat in gitignored scratch files. This PR adds devops review score, which scores saved sessions against a committed label file, offline. The seed labels reproduce the published baselines: S11 12/51 lenient, 11/51 strict and 4/30 per distinct defect; the loop 75/441 and 49/441.

  • Scorer (src/devops_cli/review/score.py): devops review score SESSION... --labels FILE [--json] reports, with n beside every ratio:

    • lenient, strict and per-distinct-defect precision, also split by producer;
    • VERIFIED and HIGH/CRITICAL precision;
    • recall against the label file's recall set and against the input's known defects;
    • stability per input digest: the mean pairwise Jaccard, and Fleiss' κ from statsmodels, imported lazily (owner decision 2026-10-09).

    A ratio over a row no label covers reads "not computable", and those rows are listed. A SESSION without a readable findings.json is refused. A session that records no input digest is compared with no other. Each score is recorded as a review-score run, and the run names every figure it could not compute and why.

  • Identity:

    • In S11–S21, a row's identity is its cluster from the committed row map.
    • In any other session, it is the findings.sarif result at the row's cited place: that result's fingerprint_v2, otherwise its tool, rule, path and line or object. If the results at that place differ in tool, rule or fingerprint, the row gets no identity and is listed as unlabelled. Identical duplicates count as one finding.
    • A model's row matches the one persona label of its path and origin page within ±5 lines.

    Nothing is parsed from titles. Stored absolute paths are made repo-relative. A row outside the reviewed tree counts as false, and a row echoed from a fixture page is not recall.

  • Labels: tests/fixtures/review_labels/labels.json maps all 492 findings.json rows of S11 and S12–S21 and holds 169 labelled clusters. It also defines the golden input (held out), whose 12 defects no tool can express are listed as accepted recall loss. Four trimmed session slices sit under tests/fixtures/review_labels/sessions/.

  • Golden set: --materialise-golden DIR writes the golden files into a new repository with one fixed commit, through git/operations.commit_snapshot. It refuses a DIR that is a file, and any golden file outside DIR or under .git/.

  • Run check: devops ai runs check gains --max-precision-drop, --max-stability-drop and --max-calls-increase. Cost means model calls, since cost_usd is always 0.0 on the self-hosted models. A precision or stability figure the baseline recorded and the current run could not compute, such as precision over a new unlabelled row, fails the check and reads "not computable". The reference-coverage tolerance moves to feat(review): each finding group gets a model-written explanation and plan grounded in the rule's documentation at the installed tool version, kept apart from findings, with every quote, citation, version and code block checked #1147.

  • Docs:

    • ADR 0005 (review findings come from tools, not models).
    • docs/VISION.md item 8.
    • The knowledge-base RAG article is corrected.
    • The recall protocol in docs/SELF_IMPROVEMENT.md now uses devops review score and counts reported rows only. It no longer counts candidates before re-ranking and verification.
  • Dependency: statsmodels 0.15.0, which brings in scipy, pandas, patsy and formulaic. It is imported only when κ is computed.

Tests run offline from recorded fixtures and tmp_path sessions: no network, no scanner, no model. Every test runs under 1 s except the one stability test that computes κ, which pays statsmodels' import (about 1.1 s). The task file records this.

Pending a person:

  • review the seed labels and set expected_severity on the valid labels;
  • score the golden set once on the current pipeline;
  • run one tools-only review on a host with load1 above 20.

The three tools-only loop runs move to #1137's P0 exit, and the 16 BLE001 labels move to #873. ADR 0005 takes the next free number at merge time, since #1308 also claims 0005.


Type of Change

  • feat: New feature or capability
  • fix: Bug fix or defect remediation
  • refactor: Code reorganization with zero functional behavior change
  • docs: Documentation updates or additions
  • test: New or updated tests
  • chore: Maintenance, dependencies, or tooling updates

Base Branch

  • release/v0.2.30 (not main)

Item

Closes #1138

Task file: docs/agent/tasks/task-1138-review-score.md

Changelog fragment: changelog.d/1138.md

…t a label file offline and reproduces the S11 and loop baselines (#1138)
@dan-petty
dan-petty merged commit 434c976 into release/v0.2.30 Oct 9, 2026
8 checks passed
@dan-petty
dan-petty deleted the feat/1138-review-score branch October 9, 2026 04:56
dan-petty added a commit that referenced this pull request Oct 9, 2026
* chore(review): suppress the logger-credential rule on vault_lease.py's token-path warning (#1456)

* docs(service): subscribe each webhook to issues, pull_request, milestone and release only (#1457)

Step 8 of the roadmap Service setup and AGENTS.md listed Issues, Pull requests
and Milestones (AGENTS.md also push). The Service treats release published as a
reprioritize hint, and every other event only starts extra rounds (#1386).
The 8 live hooks were switched to these four events on 2026-10-09.

* fix(docs): the docs check validates the options inside optional-group brackets such as [-v <ver>] (#1299) (#1458)

* fix(mcp): fastmcp's debug log of tool calls never records argument values (#899) (#1459)

FastMCP logs every tools/call and prompts/get with its arguments at DEBUG on fastmcp.server.mixins.mcp_operations, so FASTMCP_LOG_LEVEL=DEBUG wrote a vault_set call's key_values to stderr. ArgumentValueLogFilter on that logger replaces each mapping argument with <redacted>, keeping the record and the tool or prompt name; the whole mapping goes, since an undeclared parameter's name is the caller's own text. #862's RejectedInputLogFilter on fastmcp.server.server is removed: since fastmcp 4.0.11 FastMCP logs a refusal's error count and types, never the input, so it matched nothing. The fastmcp_log fixture now captures every FastMCP logger at DEBUG.

* fix(security): a sandbox workspace never holds the user's ssh agent or X11 socket (#1384) (#1463)

* feat(telemetry): sandbox egress port scoping, collector lane & in-container trace context (#702) (#1465)

* refactor(ci): one nesting metric module shared by the pre-commit hook and the scanner (#773) (#1466)

devops_cli.core.code_metrics is now the one copy of the nesting and
complexity metric. It is stdlib only and imports nothing from devops_cli.
The structural-invariants hook runs it with --max-depth 5 and loads no
scanner and no pydantic-ai. devops scan complexity, MCP scan_complexity,
the inspection hotspots and devops ai spec read it too.

- Nesting counts the function body as depth 1, as CI already did, so
  5 nested blocks now fail at commit. The six test functions that sat at
  depth 6 are flattened.
- Complexity is Ruff C901's McCabe count. It equals ruff on all 18,000
  functions in src/ and tests/, and flags the same 54 functions in src/
  at a cap of 10.
- One whole-tree test, test_the_source_tree_keeps_its_structural_invariants,
  parses src/ once through _parse_src().
- The parity test and the hook's subprocess spawns are gone.

Removed: devops_cli.security.structural_invariants, analyze_file_complexity
and FileComplexityReport.

* fix(ai): a web_fetch budget cut inside a code block closes the fence before the truncation note and boundary tag (#1298) (#1462)

* feat(review): review tools install from a tools lock with exact versions, binary checksums and hashed Python requirements, and every review records them (#1142) (#1467)

* fix(security): mask_secrets masks every GitHub token prefix, ghu_, ghs_ and ghr_ included (#1398) (#1464)

* fix(config): the secrets audit never prints a config line it cannot parse, and an unparsable file is not reported clean (#1022) (#1461)

* fix(cli): `devops branches create` creates the branch instead of failing on `checkout -b --` (#900) (#1460)

* fix(security): kube-linter findings carry their own check, message and manifest file, and scan reports keep each one (#1045) (#1471)

* feat(review): devops review score scores saved review sessions against a label file offline and reproduces the S11 and loop baselines (#1138) (#1472)

* feat(release): v0.2.30

---------

Co-authored-by: Daniel Petty <contact@danielpetty.com>
Co-authored-by: dan-petty-bot <dan-petty-bot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant