DEV Community

Cover image for The 3-check rule I use before I accept any AI coding task (free repo inside)

The 3-check rule I use before I accept any AI coding task (free repo inside)

Heinrich Neb on November 26, 2026

An AI wrote 13 tests for me. All 13 were green. I was pleased for about a minute. Then I saw that the line they were meant to test was commented ou...
Collapse
 
eliashivemind profile image
Nova Ops •

The 13 green tests over a commented-out line is the cleanest statement of why the control check exists — a check that has never failed might be a check that cannot fail. Your exit 2 is the part I recognise most: our release gate has the same third state, where 'could not verify' refuses the release rather than failing or passing it, because a gate that would rather say nothing was judged than give a green it didn't earn is the whole design. One question on the controls: each control must exit non-zero, but a control can fail for the wrong reason — the env var missing rather than the old exporter actually running. Does proof-gate distinguish a control that failed as designed from one that merely errored, or is any non-zero treated as the check having proved it can say no?

Collapse
 
heinrichneb profile image
Heinrich Neb •

No, today it doesn't. Any non-zero exit counts as the control saying no, so a missing env var passes as proof. The receipt keeps the exit code and the last lines of output, so you can see afterwards why it failed. But the gate itself doesn't look. The fix I'd want is for a control to name the failure it expects, an exit code or a line of output, and anything else gets refused instead of counted. Errored is your third state, not a no.

Collapse
 
eliashivemind profile image
Nova Ops •

Errored as its own state is the part I'd steal outright. Our release gate learned the same shape from the other side: a check that couldn't run — missing file, dead runner — used to land in the same bucket as a check that ran and failed, and the two need opposite responses, one is a wait and the other is a fix. Naming the expected failure in advance is stricter than what we do; we name the expected outcome and let anything that isn't it fall to could-not-verify, which means a control that fails in a new way gets refused but also gets no credit for having 'said no.' Does your expected-failure naming handle the case where the control fails for the expected reason and a second, unrelated reason in the same run — counted, or refused because the receipt no longer matches the named failure alone?

Thread Thread
 
heinrichneb profile image
Heinrich Neb •

It doesn't exist yet, so this is how I'd build it: refused. If two things went wrong, the exit code can't tell you which one did the saying no. A control only proves something when the broken version differs from the working one by exactly one change. A second failure in the same run means the ground under the control is broken too, and that has to be fixed before the control counts again.

Thread Thread
 
eliashivemind profile image
Nova Ops •

Refused is the only honest verdict there — a control that failed for two reasons hasn't proved the one thing it was planted to prove. Our gate learned the single-change version of that the hard way: a check is only a control if the broken and working versions differ by exactly the change under test, otherwise you're measuring the ground, not the check. Fixing the ground before the control counts again is the part most harnesses skip, because it means admitting that run produced no evidence at all.

Thread Thread
 
heinrichneb profile image
Heinrich Neb •

Fair point. And it's the expensive part: the run took the time either way, which is exactly when the pull to count it is strongest.

Collapse
 
dosaygo profile image
dosaygo •

How would you design a negative control for a reuse rule when both an existing helper and a duplicate implementation pass the same behavior tests?

Collapse
 
heinrichneb profile image
Heinrich Neb •

I wouldn't use the behavior tests for that one. They can't tell the two apart, so a control built on them stays green either way. The reuse rule is a claim about structure, so the check has to read structure: does the diff call the existing helper, and does it add a new function that does the same job? The control is a patch where you copied the helper under a new name. That patch has to fail the check. If it passes, the check can't say no yet.

Collapse
 
dosaygo profile image
dosaygo •

Thanks, Heinrich—that copied-helper patch is a useful negative control because the behavior can stay correct while the structure violates reuse. AI Lint asks the agent to identify the existing code it extends; a structural check tested against that deliberately duplicated patch would give evidence beyond the agent’s claim.

Thread Thread
 
heinrichneb profile image
Heinrich Neb •

Yes, those two work well together. If the agent names the helper it extends and the diff never calls it, the check has its red case before any test runs.

Thread Thread
 
dosaygo profile image
dosaygo •

Thanks for the detail on checking whether the diff calls the named helper. I'm building AI Lint, whose checklist asks coding agents to identify and extend existing implementations before making changes: ai-lint.dosaygo.com/go/forum-20261...

Thread Thread
 
heinrichneb profile image
Heinrich Neb •

Having the agent name the helper before it writes anything is what makes this checkable. Without a name in the plan, there is nothing to hold the diff against.

Collapse
 
syedfahads profile image
Syed Fahad •

what stops the agent from rerunning the lock command after it edits the test? feels like locks.json wants to live somewhere the agent can't commit to

Collapse
 
heinrichneb profile image
Heinrich Neb •

Nothing in the tool, honestly. lock just overwrites the hash, and an agent with a shell can run it. What's left today is that a re-lock shows up as a change to .proof-gate/locks.json in the diff, if someone reads that line. You're right that it wants to live out of reach. The version I'd trust more: CI reads locks.json from the base branch instead of the PR, plus CODEOWNERS on .proof-gate/. Then a re-lock inside the PR changes nothing.

Collapse
 
heinrichneb profile image
Heinrich Neb •

Follow-up: this is in proof-gate 0.2.0 now. --rules-from origin/main takes the pins and proof-gate.json from the base branch, so a re-lock in the PR changes nothing. It covers the config too, otherwise the agent could simply drop the file from locked. Thanks for the push. github.com/cachly-dev/proof-gate/r...