Gates
A test-run gate is a node that is done when a suite passes and critterstack observes it. What a gate is in a plan (its steps, and how a step is decided) is on Plans and nodes; this page is how a session or a person runs one, and what critterstack records while it runs.
What proves a gate
A gate is done when a run under its tag, {plan}/{node}, finishes green and critterstack observes it. Three kinds of evidence count, in this order:
- A Bobcat run under the tag. The suite's own Bobcat publisher sends it to critterstack, on 5525.
- A command run through
critterstack gate exec, which records the start, the exit code and the commit. - An asserted result (
report_gate_result), only where a person pressed allow asserted on the gate's card.
A suite that reports nowhere leaves the gate waiting however green it is. A gate takes no go-ahead: what proves it is fixed by the plan.
critterstack gate exec
critterstack gate exec my-plan/providers -- dotnet test --project src/Persistence/PostgresqlTestsIt runs the command, tells critterstack it started and how it exited (with the commit, and whether the tree was dirty), and exits with the command's own code.
- The gate is the first argument,
<plan>/<node>. With none it is read fromBOBCAT_RUN_TAG; with neither, exec saysno gate: name it as <plan>/<node>, or run under BOBCAT_RUN_TAG. --step <id>reports one step of a gate that declares several. The gate is done when every declared step passed.--cwd,--env NAME=VALUEand--timeoutare a step's declaredcwd,envandtimeout(Gate steps). A run killed at its timeout exits 124.--urlnames the critterstack server, thenCRITTERSTACK_URL, thenhttp://localhost:5525.
The tag is critterstack's to stamp. Exec sets BOBCAT_RUN_TAG on the command, {plan}/{node} or {plan}/{node}/{step}, so a suite that publishes to Bobcat is matched to the gate with no configuration. A command that sets its own, as --env BOBCAT_RUN_TAG=… or as BOBCAT_RUN_TAG=… command the way a shell writes it (a Nuke target that sets one, say), still runs, under critterstack's tag, and exec says so in one line: critterstack gate exec: step core set BOBCAT_RUN_TAG=nuke/inner; replaced with my-plan/providers/core, the tag critterstack stamps.
The run reaches critterstack with nothing added. A Bobcat publisher sends to 5525 by default, which is critterstack's own address, so exec leaves BOBCAT_MONITOR_URL as the command inherited it. (Earlier versions added a run receiver on 5527 to it; that is retired.)
critterstack never fails the command. An unreachable critterstack, or one that refuses the evidence, is said on standard error and the exit code stands.
What it says
On standard error:
critterstack: step http for my-plan/providers is running (run 7f3a…) — it has no result until this prints its exit code
critterstack: step http for my-plan/providers finished: failed (exit 1) after 7s, exit code 1 — recordedor NOT recorded after the reason. The first line is never a result: the gate has none until the second. Wait for the exit code in the foreground. A report_node or release_node while a gate run of the node is still going answers gateRunning.
Exec records its own process id. If the session running it is killed mid-run, critterstack sees that process gone and the run reads failed straight away, which leaves the gate ready to run again.
The finish carries how long the command ran and the last 1 KB of its output, both streams, since MSBuild writes its errors to standard output and a build that died before any test ran leaves standard error empty. The card, the step chip and the Activity show it as exited 1 after 7s: …error NETSDK1005…: a description of the failure, never evidence.
Waiting for the machine
A node that uses a machine resource (uses: [heavy], or a resource declared with scope: machine; see Shared resources) waits for room before it starts, asking again every 15 seconds and saying who holds it:
critterstack: step http for my-plan/providers has not started: waiting on heavy, held by polecat/pc-gate for 41 minutes--no-wait runs it at once. While the machine is reserved for an exclusive node, exec says so and goes ahead: a gate run by hand is never refused, and the exclusive node waits for it to finish.
critterstack gate run: every step
A gate that declares several steps can be run whole:
critterstack gate run <plan>/<node> [--parallel N] [--step <id>]... [--no-wait] [--url <critterstack>]It reads the gate's declared steps from critterstack and runs each one exactly as critterstack gate exec --step <id> runs it, with the step's run, cwd, env and timeout, so every step's start and finish is recorded on the gate as it happens and the card's step chips move while the rest are still running. Steps start in the order the plan declares them, at most --parallel at once; the default is 1, one after another. Every selected step runs whatever an earlier one did, since the gate needs each step's own evidence. --step (repeatable) runs only the steps named.
A step's cwd is relative to the root of the checkout gate run is started in. A gate that names its repo: runs only from a checkout of that repository; from any other it is refused (in JasperFx/marten, not this checkout (JasperFx/critterstack) — run it from a checkout of that repository), exit code 2. A step with no run: is said and skipped: run it by hand with gate exec --step.
With steps side by side, every line of their output starts with [step], so two suites never split each other's lines. At the end it prints a line per step, and exits with the worst step's exit code (0 only when every step that ran passed):
critterstack gate run wolverine-providers/providers-green --parallel 4critterstack: running 5 steps of wolverine-providers/providers-green, up to 4 at once: core, http, postgres, sqlserver, rabbitmq
[core] critterstack: step core for wolverine-providers/providers-green is running (run 7f3a09c1) — it has no result until this prints its exit code
[http] critterstack: step http for wolverine-providers/providers-green is running (run 2be1d4f0) — it has no result until this prints its exit code
...
critterstack: gate run wolverine-providers/providers-green
core passed 2m 41s
http passed 1m 12s
postgres failed (exit 1) 4m 3s
sqlserver passed 3m 55s
rabbitmq passed 6m 20sReading a red step
A red step says what kind of red it is, on its chip: build ✕ (hatched) when it died before any test ran (no Bobcat run started while it ran, or its output ends on a compiler, MSBuild, NuGet or SDK error), tests ✕ 12 when tests failed, timeout ✕ when it was killed at its timeout and gone ✕ when its process vanished; a pass under another command keeps its dashed outline. The chip's tooltip names up to five failing tests with the first line of each message, and the node's zoom lists every one, each linked to its specification page. The names come from the runs critterstack's run console holds in memory, so a run it no longer holds still says the kind and the count, without the names. A gate with no steps says the same on its card. None of it decides anything: the step is red because of its exit code and its runs.
A pass under another command than the step's declared run: never passes the step; see Checked when it is written, and when it runs. Which evidence decides when a step has both a Bobcat run and an exec run is on How a step is decided.
A red gate becomes findings, then fix work
Running the whole gate again rarely explains a red step. The session holding the gate diagnoses it instead:
Re-run the failing test classes alone, with no tag, so a partial run never stands in for the gate:
bashenv -u BOBCAT_RUN_TAG dotnet test --project … --filter-class "*Class"Read the failures with
failing_tests,failing_specandflaky_ledger, compare target frameworks, and group them by cause.Record one finding per cause with
submit_reviewon the gate it holds. Each carries a cause:product(a real break, naming the repository),test(an expectation that changed on purpose upstream),environment(an SDK, Xcode, a service),tooling(the build script),flaky, orlane-clash(passes alone, fails under the gate's lanes); a suggested repository; and evidence (the failing tests, the step, the framework, what the re-run alone showed).
While a finding waits, the gate reads findings: not ready, and a need on the plan. The card's findings button opens the same dialog as a review's. Accepting a finding adds an unbound issue in the suggested repository (else the gate's), its brief carrying the evidence, or a person step for an environment ("install Xcode"), and makes the gate depend on it; rejecting one takes a reason. A finding never becomes plan work without a person (or the plan's lead relaying one with decide_review). Once every accepted fix is done the gate is ready again.
Verifying again
⟲ re-verify on a done gate (or the plan's lead relaying it with reverify_gate) makes every pass from before the request stop counting. The gate reads stale and is ready again, while what depends on it waits. On a gate with steps, every step reads pending until it is run again, even one whose run finished after the request but started before it; the older runs stay in the node's zoom and its Activity as history.
reverify: on-branch-change on a gate says it verifies a whole branch, so its pass stands only for the tree it ran on. It is the plan's statement, exported with it. critterstack watches no branch: whoever works the plan runs the gate again when the branch has moved, or a person asks with ⟲.
A pass on a dirty tree
A done gate says what it proved: proven at 96b9202. A run that passed with uncommitted changes in the tree proved something no commit carries, so the gate reads stale rather than done (proven at 96b9202 · dirty), ready again while what depends on it waits. Its passed steps read stale too, so whoever runs it next runs them again.
A Bobcat run carries no commit, so a run-backed pass says the commit of the critterstack gate exec run that launched it; one nothing launched says no commit.
A person may accept it as it stands (the card's button, POST /api/plans/{slug}/nodes/{id}/accept-stale, or the plan's live lead relaying your word with accept_stale_gate_pass). The acceptance is for that pass: a newer run is judged on its own. The card's ✓ accepted stale takes it back.
Asserting a result
For a suite that can be run neither way, an agent can assert the result with report_gate_result. That decides the gate only where a person pressed allow asserted on its card, and the card then marks it asserted, never as observed. The grant is cleared when the node changes.
A repository's own gates
GitHub CI is not the only way to know a change is good. A repository whose real checks are local build targets (./build.sh CommitGate) can declare them with a role, and they are then run on an issue or pr node's work:
declare_repository_gatewithrole: commitis a gate run on the work's final commit:critterstack gate run <plan>/<node>from the checkout runs it and records the commit it ran on.role: pushis a gate that runs before work reaches the default branch.checkout: primaryis for a gate that cannot run from a worktree, such as one that resets docker.critterstack gate runrefuses to run it from a worktree; name it with--stepfrom the primary checkout.timeout: 90mkills the gate past that time.scopeis Markdown saying which part of a long gate covers which code, for running only what a change needs.
The node's zoom lists each gate with where it stands and the command that runs it again. A pass proves a commit, never a node: it counts only on the commit it ran on, with a clean tree, under the declared command, so a rebase makes it stale and another command a mismatch. A session's word moves nothing. critterstack never runs a gate itself.
On the Repositories page, stand in for CI on a gate says its passes are read in place of CI's checks for a merge-on-green PR in that repository. Only a person can turn it on (or the plan's lead relaying it with set_gate_stand_in), because an agent able to set it could have a PR merged on a gate that proves nothing. Changing the gate's command or checkout takes it back.
BOBCAT_RUN_TAG: how a gate finds its run
A suite run from a checkout reports on every specification it ran. Without a tag, a gate could not tell its own run from anyone else's run of the same suite.
critterstack gate exec and critterstack gate run stamp the tag themselves. A session that starts a Bobcat suite directly sets it: BOBCAT_RUN_TAG=<plan>/<node> (or <plan>/<node>/<step> for a step).
WARNING
Write the tag exactly. Matching accepts the canonical form and the bare node id, and nothing looser: not a truncated id, not an id with a timestamp appended. A tag matched to the wrong node would mark it done off another node's run, and node ids often share long prefixes. An unrecognised tag is ignored; losing evidence is the safer error.
See also
- Gate steps — declaring steps, and how a step is decided
- Runs and evidence — the runs a gate reads
- Working a plan with a supervising agent — where running a gate fits in the loop
