Verification routes
Require evidence that a test, build, or UI check ran on the exact diff before a push goes through.
Some changes need evidence the critic cannot produce by reading code: a test
suite, a Docker build, a Terraform plan, a UI check. A verification route
declares that evidence. When a change touches a route's paths, cerebe gate-push
blocks the push until the route's command has passed on that exact diff.
cerebe verify runs the routes and writes the evidence. A repository with no
routes enforces none.
Declare a route
Routes live in the evidence block of cerebe.yaml:
evidence:
validation:
verificationRoutes:
- id: unit-tests
trigger: ["src/**"]
category: test
command: "sh scripts/test.sh"
evidencePath: "cerebe/reviews/quality-gates/${sha}.json"
timeout: 10m
prerequisites:
- { version: 1, name: "Docker daemon", command: "docker info" }| Field | Meaning |
|---|---|
id | The route's name. |
trigger | Path globs. A change that touches one arms the route. An empty list is never armed; it runs only by name. |
category | A label for the kind of evidence, such as test or build. Required. |
command | Your command that checks the change, such as a test script. null declares a route that runs nothing; cerebe verify --list reports it as advisory. |
evidencePath | Required: a path when command is set, null when it is null. Use the value above; cerebe verify writes evidence to cerebe/reviews/quality-gates/<sha>.json. |
timeout | Optional. A duration such as 10m. The default is 30m. At the deadline the command's process group is killed and the route records a timeout, which blocks. |
prerequisites | Optional. Commands that check that a tool the route needs is available, such as docker info. They run before command; if one fails, command does not run and the route is skipped with exit 2. |
advisory | Optional. An advisory route is armed but not run by a bare cerebe verify, and the push gate does not require its evidence. |
exclusive | Optional. When an exclusive route is armed, it suppresses the others. |
A repository that still commits cerebe/config.json may declare the same table
under validation.verificationRoutes there. When cerebe.yaml has an
evidence block, its routes replace those; the two are not merged.
Validate the table with cerebe schemas validate cerebe.yaml before you rely on
it. It prints OK cerebe.yaml for a valid file and names the line of each
problem otherwise.
Run the routes
cerebe verify # run the required routes the change arms
cerebe verify --list # armed routes and their evidence, without running anything
cerebe verify --route unit-tests # run one routeA passing route prints PASS route[unit-tests], and the run ends with a
summary such as 1 ran — 1 green, 0 blocked, 0 soft-skipped. --list prints
one line per armed route, <id> required|advisory passed|failed|missing: for
example, unit-tests required missing before the first run.
Routes arm on the whole branch, not only the last commit: the base is the merge
base of HEAD and the remote default branch. A branch that changed src/ in an
earlier commit still arms the src/** route after a README-only commit.
Evidence is bound to the commit and a hash of its diff, so the gate can re-check
it against the diff being pushed. When a later commit leaves a route's trigger
paths and configuration unchanged, passing evidence from an earlier commit is
reused and verify prints REUSED.
--route with an id that is not in the table is a usage error and exits 2,
so a renamed route fails loudly in a script instead of verifying nothing. An id
whose trigger the change did not arm runs nothing and exits 0.
Exit codes
| Code | Meaning |
|---|---|
0 | Every route that ran passed, or no route was armed. cerebe verify --list also exits 0, including when a listed route is failed or missing. |
1 | A route failed or timed out, or the configuration is invalid. A command that is cerebe verify --route <id>, or an unreplaced df verify --route <id> placeholder, is invalid because it would run itself. |
2 | A route was skipped because a tool or prerequisite it needs is not available, or the command line is invalid, such as an unknown --route id. |
3 | With --triage-base, the failure happens the same way at the base. |
130 | The run was interrupted. Completed routes keep their evidence. |
A skip (exit 2) is not passing evidence: cerebe gate-push still blocks on a
required route that has none.
verify or gates
cerebe gates runs the same routes plus your static
validation.requiredQualityGates, and treats any route that did not pass,
including a skip, as a failure (exit 1). Use verify when something
downstream needs to tell a skip from a failure. Neither calls a model.
Is this failure mine?
When a gate fails on a change that did not touch it, compare it with the base:
cerebe verify --triage-base origin/main --route unit-tests
cerebe verify --triage-base origin/main --gate "make test"Triage reruns a failure once to confirm it, then runs the same gate in a
disposable worktree at the base. It exits 3 when the base fails the same way,
so the failure was inherited, and 1 when the failure is new in your change or
the result is inconclusive. Triage writes no evidence.
Prove a test can fail
A test that passes whether or not the code under test runs is not coverage.
cerebe prove-tests checks that claim for tests that carry a marker naming the
code they pin:
//cerebe:proves ParseConfig
func TestParseConfig_RejectsUnknownKeys(t *testing.T) { ... }// cerebe:proves src/config.ts:parseConfig
it("rejects unknown keys", () => { ... });For each marker it runs the test (it must pass), replaces the named function's body with a zero-value return (the package must still compile), and runs the test again (it must now fail). A test that still passes is reported as vacuous.
cerebe prove-tests --list # the markers it found
cerebe prove-tests --changed-from origin/main # only markers this change can affect
cerebe prove-tests --lang ts # TypeScript (vitest) markers onlyTypeScript markers need the service's own node_modules with typescript and
vitest installed. Run cerebe prove-tests --help for the full marker grammar.