Engineering Notes · agent operations · test enforcement
The Commit That Has To Prove Itself
Lucas van Staden · ProxiBlue · September 2026 · proxiblue.com.au
How I (Lucas van Staden / ProxiBlue) stopped trusting "tests pass" as a sentence and made it a precondition. My AI agents cannot commit code without recorded evidence that the tests actually ran, actually passed, and actually cover the current state of the files.
Why I built this
An AI agent will tell you the tests pass. Sometimes it ran them. Sometimes it ran some of them. Sometimes it ran them, they failed, it "fixed" the code, and did not run them again. The sentence "tests pass" costs the model nothing to produce, and I had a documented near-miss on a client project to prove it: work that was about to ship on the strength of that sentence, where the covering tests had not actually run against the final state of the code.
A written rule ("always run tests before committing") is exactly the kind of rule that gets followed most of the time. Per the previous article in this series, most of the time is not a control. So the rule became a program.
How it works
A pre-commit gate hook sits between the agent and git commit. It refuses the commit unless there is recorded evidence that the required test families passed for the current state of the changed files:
- Evidence is recorded automatically. When a test runner actually executes and exits green, a post-command hook writes an entry to an evidence journal inside the repo's
.git directory: which family (unit, e2e), exit code, and a hash of the code state it ran against.
- Evidence is family-scoped. My projects lean heavily on Playwright end-to-end tests, not just phpunit. A passing unit run does not satisfy the e2e requirement. Each family needs its own green run.
- Evidence expires on edit. Any code change after the recorded run invalidates it. Test, then edit "one small thing", then commit: blocked. The tests re-run against what is actually being committed, or the commit does not happen.
- The block message is the recovery path. It names the missing family, the exact command to run, and warns about the invalidation rule. The agent reads it, runs the tests, retries, done. No human in the loop for the happy path.
- Fake runs do not count. An echo mentioning a test runner is not evidence. The recorder hooks the actual execution. And the standing instruction set is explicit: do not edit the evidence file, do not wrap the commit in a sub-agent, do not fake a run. If tests cannot run, stop and tell me.
Sensible exemptions exist: commits that only touch tests themselves do not demand tests-for-the-tests, and pure documentation or static-content changes pass through. The gate targets code.
The gate got debugged by firing it, not by trusting it
Live-fire, day one. The first serious run of the gate caught a bug in its own evidence recorder. Which is exactly the point of live-firing: a control you have only tested synthetically is a control you are taking on faith. The gate earned trust by blocking real commits correctly, and its behaviour is now replayed continuously by my rule-eval suite: stage a change, ask the agent to commit, assert the block, the test run, the evidence entries, and the final commit happen in that order.
It blocked me this week, and it was right. I went to commit static blog pages, and the gate refused, because two modified PHP files were sitting in the working tree from another session, untested. The gate does not care that the PHP was not mine or that my files were only HTML: changed code in the tree, no evidence, no commit. We parked the unrelated work properly and the commit went through clean. Annoying for ninety seconds, correct forever.
Gates surface missing infrastructure. That same block also exposed the real gap: the project in question had no test suite at all yet. A prose rule quietly tolerates that for years. A hard gate makes the absence loud every single commit, which is precisely the pressure that gets suites written.
What it buys me
- "Tests pass" became a fact, not a claim. There is a journal entry, with a state hash, or there is no commit.
- The edit-after-test hole is closed. The most common way tested code turns out untested is the last-minute tweak. The state hash kills it.
- Agent autonomy went up, not down. Because the gate is trustworthy, I no longer babysit commits. The machine enforces the invariant; I spend attention elsewhere.
- Hollow tests are the next frontier, honestly stated. The gate proves tests ran and passed. It does not yet prove the tests are worth anything; AI-written tests can pass while asserting nothing. Mutation testing or changed-line coverage is the planned next layer, not a solved one.
Want to do this yourself?
- Hook actual test-runner executions and record evidence: family, exit code, and a hash of the code state.
- Block commits (and pushes) when evidence for the current state is missing. Make the block message carry the exact recovery command.
- Invalidate evidence on any code edit after the run. This one rule does most of the work.
- Exempt test-only and docs-only changes so the gate stays credible instead of nagging.
- Live-fire it on real work before you trust it, then replay it on a schedule so a harness update cannot silently lobotomise it.
None of this is exotic: it is a pre-commit hook, a journal file, and a hash. Boring, solved technology, pointed at the one sentence an AI coding agent should never be allowed to say for free.
All from my claude-skills-central repo.
I use my tooling predominantly on Mage-OS (Adobe Commerce / Magento) e-commerce projects, and my own AI Booking Agent. If you have not swapped to Mage-OS yet, you are falling behind ;)
More in this series: The Whole Stack, Reviewed Cold — a cold, independent critical review of the whole agent-operations stack, layer by layer, weaknesses included. ·
Logs Without the SSH Session — shipping Hypernode logs to self-hosted VictoriaLogs so agents can read them without SSH. ·
The Hour My Agents Spent Waiting For Nothing — why my agents are not allowed to background work they need the result of. ·
Smaller, Then Green — a mandatory cut-then-test loop that trims over-built code out of every plan's diff before any reviewer sees it. ·
Plans Run By A Fleet — how features run through a planned, adversarially-reviewed, parallel TDD pipeline instead of one long agent chat. ·
Hooks, Not Hopes — sorting every agent rule into prose or a blocking hook, and proving the hooks still fire. ·
The Agent Chatroom — giving the agents across my fleet a threaded chatroom so I stopped being the message bus. ·
My AI Is Not Allowed To Guess — forcing blast-radius-first investigation and banning blame-shift excuses. ·
The Near-Miss That Banned Summaries — banning summarised page-fetches fleet-wide after a near-miss on a security advisory. ·
The Code Quality Checks Nobody Runs — coding standards, static analysis and comment hygiene moved into the commit path. ·
The ProxiBlue Debugger Discipline — blocking var_dump and wiring in real breakpoint debugging. ·
The ProxiBlue Domain Graph — giving my AI coding agents long-term domain knowledge with a temporal knowledge graph. ·
The ProxiBlue Falsifiable Rulebook — testing the rules and guard hooks that govern my AI coding agents.