Skip to content
PROVECODE

Tier A benchmark

Injected cases on real repositories (experimental). Not real-world performance.

50 held-out cases (44 weakenings, 6 legitimate edits), drawn from 168 cases built by mechanically editing real test functions in 6 permissively licensed repositories. The held-out split was frozen before any detector code existed, and only the tuning split was looked at while developing the rules.

Detection on held-out cases

0%25%50%75%100%All weakeningsPROVECODE: 43 of 44 (98%), 95% CI 88% to 100%Count-based baseline: 14 of 44 (32%), 95% CI 20% to 47%Count-preservingPROVECODE: 36 of 37 (97%), 95% CI 86% to 100%Count-based baseline: 7 of 37 (19%), 95% CI 9% to 34%Count-reducingPROVECODE: 7 of 7 (100%), 95% CI 65% to 100%Count-based baseline: 7 of 7 (100%), 95% CI 65% to 100%Legitimate, flaggedPROVECODE: 0 of 6 (0%), 95% CI 0% to 39%Count-based baseline: 1 of 6 (17%), 95% CI 3% to 56%
PROVECODECount-based baseline (reimplementation)Lines show 95% Wilson intervals. Held-out split, n = 44 weakenings.
Held-outPROVECODEBaselinePaired test
All weakenings43 of 44 (98%)
95% CI 88% to 100%
14 of 44 (32%)
95% CI 20% to 47%
Only PROVECODE caught 29; only the baseline caught 0. Exact McNemar p = 3.7e-9.
Count-preserving36 of 37 (97%)
95% CI 86% to 100%
7 of 37 (19%)
95% CI 9% to 34%
Only PROVECODE caught 29; only the baseline caught 0. Exact McNemar p = 3.7e-9.
Count-reducing7 of 7 (100%)
95% CI 65% to 100%
7 of 7 (100%)
95% CI 65% to 100%
Only PROVECODE caught 0; only the baseline caught 0. Exact McNemar not testable (no disagreements).
Legitimate edits blocked0 of 6
95% CI 0% to 39%
1 of 6 flagged
the baseline has no severity
Only 6 legitimate held-out cases, so this interval is wide.

What counts as detected. PROVECODE: At least one S1-S5/B1-B4 finding with severity warning or blocking. Baseline: At least one finding from the count-based reimplementation.

Pre-registered hypotheses

  • F1, the core claim: supported on Tier A.

    On count-preserving held-out cases, PROVECODE recall exceeds the count-based baseline's. Exact McNemar p = 3.7e-9.

  • F2, parity where expected: parity held.

    On non-count-preserving cases (deletions, removed asserts), parity is expected; the baseline outperforming PROVECODE is reported. Both caught 7 of 7 deletions and removed asserts. PROVECODE claims no advantage here.

  • F3, false positives: 0 of 6 legitimate held-out edits blocked.

    95% CI 0% to 39%. A real-world precision audit (Tier C) is needed before claiming a false-positive rate.

What it misses

W17 to W19 were written on purpose to fall outside every rule, so the benchmark would show blind spots rather than hide them. Rules S5 and B4 were later added for them, after these results were seen, so Tier A recall on those patterns is no longer an unbiased estimate; Tier A-b below is their fresh test. Across all cases, PROVECODE still missed:

  • W17, assert A == B became assert A == A: caught 5 of 6 (baseline 0 of 6)

By kind of weakening

All 138 weakening cases (tuning and held-out). Each kind has few cases, so these are descriptive only.

0%25%50%75%100%Assertion removedPROVECODE: 12 of 12 (100%), 95% CI 76% to 100%Count-based baseline: 12 of 12 (100%), 95% CI 76% to 100%Comparison loosenedPROVECODE: 18 of 18 (100%), 95% CI 82% to 100%Count-based baseline: 0 of 18 (0%), 95% CI 0% to 18%Exception widenedPROVECODE: 18 of 18 (100%), 95% CI 82% to 100%Count-based baseline: 0 of 18 (0%), 95% CI 0% to 18%Not targeted by any rulePROVECODE: 17 of 18 (94%), 95% CI 74% to 99%Count-based baseline: 0 of 18 (0%), 95% CI 0% to 18%Parametrize cases removedPROVECODE: 12 of 12 (100%), 95% CI 76% to 100%Count-based baseline: 0 of 12 (0%), 95% CI 0% to 24%Skip or guard addedPROVECODE: 30 of 30 (100%), 95% CI 89% to 100%Count-based baseline: 24 of 30 (80%), 95% CI 63% to 90%Test deletedPROVECODE: 12 of 12 (100%), 95% CI 76% to 100%Count-based baseline: 12 of 12 (100%), 95% CI 76% to 100%Expected value made trivialPROVECODE: 18 of 18 (100%), 95% CI 82% to 100%Count-based baseline: 0 of 18 (0%), 95% CI 0% to 18%
PROVECODECount-based baseline (reimplementation)Lines show 95% Wilson intervals. Per category, all splits.

Tier A-u: unittest-style tests

Injected unittest-style cases on real repositories (experimental, ADR 0009). Not real-world performance.

PROVECODE also reads unittest.TestCase classes, self.assert* checks and unittest skips. To measure that, a second benchmark was built the same way from 5 other permissively licensed repositories: 132 cases, 40 of them held out. Its patterns, cases and split were committed (bb6f3d5d2b83) before the detector change (6ed0cac06bf3). The pattern labels were written by the developer and await the owner's confirmation.

0%25%50%75%100%All weakeningsPROVECODE: 27 of 28 (96%), 95% CI 82% to 99%Count-based baseline: 10 of 28 (36%), 95% CI 21% to 54%Count-preservingPROVECODE: 20 of 21 (95%), 95% CI 77% to 99%Count-based baseline: 3 of 21 (14%), 95% CI 5% to 35%Count-reducingPROVECODE: 7 of 7 (100%), 95% CI 65% to 100%Count-based baseline: 7 of 7 (100%), 95% CI 65% to 100%Legitimate, flaggedPROVECODE: 0 of 12 (0%), 95% CI 0% to 24%Count-based baseline: 1 of 12 (8%), 95% CI 1% to 35%
PROVECODECount-based baseline (reimplementation)Lines show 95% Wilson intervals. Tier A-u held-out split, n = 28 weakenings.
  • Count-preserving weakenings caught: PROVECODE 20 of 21, baseline 3 of 21 (exact McNemar p = 1.5e-5).
  • Legitimate held-out edits blocked: 0 of 12 (95% CI 0% to 24%).
  • After the Tier A-u held-out results were first seen, the engine was revised following the SWE-bench Verified gold test-file measurement (docs/research), not Tier A-u data: a singular test/ directory no longer makes every module a test file (django/test/testcases.py is framework code); tests/ directories and test_*.py / *_test.py / tests.py names are unchanged. Effect on Tier A-u: none: no Tier A-u case is in a test/ directory; all 132 case results and all metrics identical before and after.
  • After the Tier A-u held-out results were first seen, the engine was revised following the ADR 0011 (rules S5 and B4), developed on the Tier A-b tuning split, not on Tier A-u: S5: a check replaced by a self-comparison or given an `or <true constant>`; B4: a check newly inside a try/except or contextlib.suppress that swallows AssertionError. Effect on Tier A-u: 11 case results changed, all of them U13-U14 weakenings, which these rules target and whose results had been seen; U13 6/6, U14 5/6 now flagged; held-out recall 23 -> 27 of 28; no legitimate case changed. The remaining miss, U14-04 (a swallowed self.assertRaises), is a known B4 gap, deliberately not fixed on seen data.
  • After the Tier A-u held-out results were first seen, the engine was revised following the inspection of S5/B4 hits on real commits (more-itertools 5c715d813a, pyparsing e0a6f21205), not benchmark data: S5 self-comparison fires only when the base check compared against a different expected value (assertTrue(r) -> assertEqual(r, r) is not a weakening); B4 matches swallowed checks by what they check, not their text, and fires only when more checks are swallowed than before (a reworded message inside an existing try/except is not a finding). Effect on Tier A-u: none: all 132 case results and all metrics identical before and after.
  • Missed, all splits: U06, Exception widened: caught 5 of 6 (baseline 0 of 6)
  • Missed, all splits: U14, the self.assert* call was wrapped in try / except AssertionError: caught 5 of 6 (baseline 0 of 6)

Engine source sha256 da6f05fbc01bb65c0cf930a489513e6b02845e973899f706beccd9f1fbf252dd; tierA_u.json sha256 86084f01fd8c95914ee833f73a5d62ac03e02df72b3a255c292d2b2d1686a10d.

Tier A-b: vacuous and swallowed checks

Injected vacuous and swallowed checks on real repositories (experimental, ADR 0011). Not real-world performance.

Rules S5 (a check made vacuous: A == A, or True) and B4 (an assertion failure swallowed by try/except) were judged on a fresh benchmark: 99 cases from 7 further repositories, including legitimate near-misses such as an added reflexivity check, a re-raise and try/finally. Its cases and split were committed (5b8a20ae7cf0) before the rule code (b6eeede391e8), and the rules were developed on the tuning split only.

  • Held-out weakenings caught: PROVECODE 22 of 22 (95% CI 85% to 100%), baseline 0 of 22.
  • Held-out legitimate edits flagged: 0 of 8 (95% CI 0% to 32%).
  • After the Tier A-b held-out results were first seen, the engine was revised following the inspection of S5/B4 hits on real commits (more-itertools 5c715d813a, pyparsing e0a6f21205), not benchmark data: S5 self-comparison fires only when the base check compared against a different expected value (assertTrue(r) -> assertEqual(r, r) is not a weakening); B4 matches swallowed checks by what they check, not their text, and fires only when more checks are swallowed than before (a reworded message inside an existing try/except is not a finding). Effect on Tier A-b: none: all 99 case results and all metrics identical before and after.
  • Tuning round 1, on the tuning split only: S5: A base self-comparison such as c == c is a real reflexivity test of a custom __eq__, not a vacuous check, so adding or True to it is S5; only an or-vacuous base check counts as already vacuous.
  • The patterns mirror the rules' stated targets, so this shows the rules work as specified on injected edits. It is not a real-world recall figure.

Speed and the live path

Per case, the analyzer took a median 31 ms and at most 275 ms on CPython 3.11.3 (Windows), with peak memory of at most 18 MB. At the browser's input limits, the worst input took 418 ms. Over-limit input is refused before parsing.

The browser runs the same engine in Pyodide 314.0.8 (Python 3.14.2). All 642 cases (Tier A: 168, Tier A-u: 132, Tier A-b: 99, Tier H: 243) produced identical findings, severities and verdicts compared with CPython 3.11.

Read these numbers with care

  • Cases are injected edits, not real weakening commits. Real-world recall (Tier B) and precision (Tier C) are not measured yet.
  • The same author wrote the patterns, the cases and the detector. The patterns and split were committed before the detector, and that order is shown below.
  • One tuning round, on the tuning split only: B2: A top-level return / pytest.skip() / if False: counts as a guard whenever statements follow it (or sit inside it), not only when visible asserts follow; many tests check via helpers.
  • After the held-out results were first seen, the engine was revised following an independent code review of engine/src/provecode (not benchmark data): line splitting matches the tokenizer (form feeds no longer misalign lines); AST depth limit and RecursionError become input_limit gaps instead of crashes; S4 flags removed parametrize cases even when others are added; B2 covers class-level skips, `from pytest import mark`, and pytest.xfail(); ignores non-pytest .skip(); S1 handles positional approx tolerances and non-numeric approx; S3 flags match= loosened to match-anything; UTF-8 BOM files are analyzed; renamed test files keep their contract links. Effect on Tier A: none: all 168 case results and all metrics identical before and after.
  • After the held-out results were first seen, the engine was revised following an CI reproducibility check on Linux: case files are read as raw git objects instead of a Windows working tree where core.autocrlf had converted LF to CRLF; cases.lock.json byte hashes were regenerated. Effect on Tier A: none: same 168 case ids, patterns, sites and split; only base/head byte hashes changed; all case results and metrics identical.
  • After the held-out results were first seen, the engine was revised following an ADR 0009 (recognise unittest-style tests), from the landscape research report, not Tier A data: TestCase subclasses are test classes; self.assert* calls are checks mapped onto S1/S2/B3; self.assertRaises*/assertWarns* feed S3; the Regex argument counts as match=; unittest.skip/skipIf/skipUnless/expectedFailure and a leading self.skipTest() are B2; tests.py and modules under tests/ are test files; renames to uncollected names are B1. Effect on Tier A: none: all 168 case results and all metrics identical before and after.
  • After the held-out results were first seen, the engine was revised following an ADR 0011 (rules S5 and B4), developed on the Tier A-b tuning split, not on Tier A: S5: a check replaced by a self-comparison or given an `or <true constant>`; B4: a check newly inside a try/except or contextlib.suppress that swallows AssertionError. Effect on Tier A: 17 case results changed, all of them W17-W19 weakenings, which these rules target and whose results had been seen; W17 5/6, W18 6/6, W19 6/6 now flagged; held-out recall 37 -> 43 of 44; no legitimate case changed. Recall on W17-W19 is therefore no longer an unbiased estimate; Tier A-b is the fresh evaluation of these rules.
  • After the held-out results were first seen, the engine was revised following an inspection of S5/B4 hits on real commits (more-itertools 5c715d813a, pyparsing e0a6f21205), not benchmark data: S5 self-comparison fires only when the base check compared against a different expected value (assertTrue(r) -> assertEqual(r, r) is not a weakening); B4 matches swallowed checks by what they check, not their text, and fires only when more checks are swallowed than before (a reworded message inside an existing try/except is not a finding). Effect on Tier A: none: all 168 case results and all metrics identical before and after.
  • The baseline is a reimplementation of published rules, not the original tools.
  • The real-world feasibility spike (Gate 0) is paused, not finished; no result from it is claimed.

Provenance

Regenerate
python -m benchmark.regenerate
Patterns and split frozen
ce7de4fb1d93 at 2026-11-20T20:08:41+05:30
First detector code
d463856ca712 at 2026-11-20T20:19:15+05:30
Engine source sha256
da6f05fbc01bb65c0cf930a489513e6b02845e973899f706beccd9f1fbf252dd
tierA.json sha256
137f4b336f4486486dca1fff731a1e0ebdd5364709c68466e49f7881f1c1817d
Sources