Tests passed. The 20% cap is gone.
An AI agent was asked to fix a discount bug. It removed the discount cap, then loosened the one test that guarded it. The repository's own tests stayed green. PROVECODE reads the test change itself, links it to the requirement it protected, and runs the reviewers' own checks against the result.
7-assert apply_discount(100, 0.50) == 80.007+assert apply_discount(100, 0.50) >= 0
One assertion before, one after. A detector that counts assertions sees no change. This one is a S2 finding: equality to a specific expected value was replaced by the bound '>= 0'.
Two independent pieces of evidence, both on the same requirement
The test was weakened
Static analysis compares the test before and after. The equality to 80.00 became a bound that any price satisfies. The test guards contract condition C1, “Discount is capped at 20%”, so the finding is blocking.
The reviewers' check fails
In a sandbox with no network, the repository's own tests pass, while the contract-owned check chk-cap fails. The candidate cannot edit that check, because it lives in the approved contract, outside the change.
Measured, not claimed
On 44 held-out injected weakenings in six real open-source repositories, compared with a reimplementation of the count-based detectors that already exist.
- Count-preserving weakenings caught
- 97%vs 19%
- 36 of 37, 95% CI 86% to 100%
- All weakenings caught
- 98%vs 32%
- 43 of 44, 95% CI 88% to 100%
- Legitimate changes blocked
- 0 of 6
- 95% CI 0% to 39%. Few cases, so the range is wide.
These are injected cases, labeled experimental, not real-world performance. Read the full benchmark, including what it misses.
Use it on your own code
Beta, v0.2.1. It works with no configuration on Python projects that use pytest or unittest: any finding that weakens a test blocks. Real-world precision is not yet measured, so expect some false alarms.
On your machine
pipx install "provecode[cli] @ git+https://github.com/Shriram28Baskar/provecode@v0.2.1#subdirectory=engine"
provecode guarduv tool install and pip install take the same argument.
On pull requests
on: pull_request
permissions:
contents: read
jobs:
provecode:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Shriram28Baskar/provecode@v0.2.1See it on a real repository: the pull request that loosens a test fails the check, and an honest refactor passes it.
Before each commit
repos:
- repo: https://github.com/Shriram28Baskar/provecode
rev: v0.2.1
hooks:
- id: provecodeFor coding agents: provecode install-hooks --claude stops Claude Code from finishing with weakened tests.
Full setup, contracts and the trusted re-run · Release notes for v0.2.1