ADR-080: CI Server-Side Devstack Battery — a Non-Blocking Detector, Not the Merge Gate

Status

Accepted (2026-09-29); partially superseded by ADR-086 (D3, D4), 2026-11-06. Resolves #1189 through its acceptance criterion’s second branch: the residual "merge needs no green server-side gate" is re-accepted here, with tripwires, under the maintainer’s standing ruling that the local pre-push battery is the merge gate. Depends on #1645 (the cma-runner-craig runner). Re-landed from Aravinth Manivannan’s !1560.

Partially superseded by ADR-086 (D3, D4) (2026-11-06, #2923): merge trains on the dhs-aws-autoscaler-docker-4xlarge runner are the merge gate, and the firewall rules are gone with the host-free devstack. D1 and D2 stand.

Amended 2026-11-10 (#3043–#3046): the battery runs inside the one car job from the one musl compile; cargo xtask ci is gone. See § Amendment — #3043–#3046 below.

Context

Before this decision the only CI job that ran tests, ci-tests, called cargo xtask validate --skip-devstack, whose nextest run is --lib --bins: no tests/ target compiled and none of the #[ignore = "requires devstack"] suites ran server-side (#1189 counted about 1,897 integration-test declarations and 1,312 devstack-gated tests). The ci-tests change filter did not match services//migrations/*, so a migrations-only MR ran no compile or test job, and docker-promote did not rebuild on a migration change although every service embeds its migrations at compile time through sqlx::migrate!().

The pre-push hook runs the whole battery and is the project’s functional-correctness gate (Testing Reference (CRAIG)). A client hook can be skipped — --no-verify, a lost exec bit, an unset core.hooksPath, a web edit — and the project setting only_allow_merge_if_pipeline_succeeds is off, so nothing server-side noticed a push that skipped it. Recurring disk exhaustion on the shared .2xlarge runner made a server-side battery impractical until #1645 moved the workspace-build jobs to cma-runner-craig.

The maintainer’s standing ruling: GitLab CI is not the merge gate; the local pre-push battery is.

Decision

D1 — ci-integration runs the pre-push devstack battery server-side

A scan-stage job on cma-runner-craig (a fleeting instance executor: a bare microVM, image: ignored) runs, as one serial job:

  1. the .cma-runner-bootstrap toolchain (apt, rustup from rust-toolchain.toml, git-lfs), then Docker — from the runner image, or from the distro-signed docker.io, docker-compose-v2 and docker-buildx packages when the image lacks it;

  2. an ephemeral 32-byte field-encryption key in devstack/field-key.env (mode 600, never printed, never an artifact) — not the sops-store key, because CRAIG_CI_AGE_KEY is protected and never reaches an MR ref. A fresh volume seeded under it has no key/data mismatch, so the ADR-048 §D3 boot check passes;

  3. cargo xtask check-docs, advisory while the template-sync debt stands (#1740); Erratum (2026-11-01, #2880): the step and the command are gone with the template sync engine;

  4. the raw-compose devstack — docker compose --profile fault build, then up -d --wait: Postgres, RabbitMQ, Keycloak, Garage, the migrate one-shots, the keyed seed and the Toxiproxy fault sidecar;

  5. cargo xtask test --skip-lint --profile ci-integration --fault-gate (D2);

  6. a reseed (down -v, up) and verify-seed --expect keyed, then cargo xtask e2e --no-refresh, sdk-test, security --skip-zap --skip-fuzz and perf --profile smoke.

test-results/ is uploaded with the JUnit reports (when: always, 30 days). The job runs on MR pipelines that touch code or an operational input the devstack run depends on: services//migrations/, devstack/, docker-compose.yml, Dockerfile, tools/craig-seed/, tests/, rulesets/, .config/nextest.toml and .gitlab-ci.yml. ci-tests and docker-promote also gain services/*/migrations/. Erratum (2026-10-11, #2219): GitLab matches changes: with Ruby File.fnmatch?, where dir/** is one level only, so the as-built directory entries are dir/**/*.

D2 — One battery body, two callers

cargo xtask test --fault-gate calls validate::run_devstack_battery_standalone, which runs the same private run_devstack_battery the pre-push devstack phase runs after ensure_ready: .ports.env reconciliation, the ADR-067 §M9 fault preflight, verify-seed --expect keyed, the template pre-warm, the C24 executed-fault reset, cargo nextest run --workspace --locked under the caller’s profile with --run-ignored=all, the C24 program-verification gate, the #860 invariants gate and the caregiver-coverage report. Reconciliation comes first so the fault preflight reads the test-plane Postgres port from .ports.env rather than falling back to the shared devstack Postgres (#1403). The callers differ only in the nextest profile: integration for the hook, ci-integration for CI (the same test-group overrides, held equal by the #1648 parity check, with a longer slow timeout for different hardware). A unit test fails if xtask/src/cmd/test.rs re-implements a battery step.

D3 — A detector, not the merge gate

Superseded by ADR-086 (2026-11-06): merge trains are the merge gate.

ci-integration is allow_failure: true, and only_allow_merge_if_pipeline_succeeds stays off by decision. A red run is a pipeline warning, never a merge blocker; the pre-push battery is the merge gate. What the job adds is detection: a push that skipped the hook still leaves a visible server-side result on its MR, and a CI-only failure on an MR whose battery passed locally is triaged as a finding. This re-accepts the #1189 residual — a merge needs neither the battery nor a green pipeline — under the tripwires below.

D4 — The host firewall opens to Docker-bridge traffic only

Superseded by ADR-086 (2026-11-06): no job runs these rules.

On a fresh microVM a container dialing host.docker.internal reaches the host’s own bridge address, a local address, so the packet is INPUT on the bridge interface; a default-deny INPUT drops it and e2e hangs at page.goto. The job inserts at the top of each chain ACCEPT for INPUT arriving on docker0 or br-+, and for FORWARD arriving on those bridges in conntrack state DNAT (a connection to a port Docker published). It changes no default policy, adds no unscoped ACCEPT and runs no ufw command: rules at the top of a chain already precede any ufw chain. local-dev § Linux + UFW gives the developer-machine equivalent.

2026-11-05 (#2922, plan merge-trains-gate U2): the devstack is host-free — no service publishes a host port outside the dev profile and nothing dials the host-gateway name, so no container-to-host traffic remains for these rules to admit (the developer-machine section they cited is gone from local-dev). The job keeps them, harmless, until U3 (#1739) deletes ci-integration; ADR-086 then supersedes this decision.

Tripwires

The residual stays accepted while none of these fires; any one reopens this decision.

  • A merge lands with a red ci-integration that the pre-push battery should have caught. The hook was skipped or has diverged from CI: file a fix: issue and establish which before the next merge.

  • ci-integration becomes blocking without a superseding ADR — its allow_failure flips, or the project turns only_allow_merge_if_pipeline_succeeds on. An xtask unit test pinning the job’s shape fails on the first.

  • The two battery callers drift — a battery step is copied into test.rs (the single-body unit test fails), or the job runs a nextest of its own (the job-shape unit test fails on nextest run or --run-ignored in the job).

  • The ci-integration and integration nextest profiles diverge in their test-group overrides. The #1648 parity check fails.

  • The firewall scope widens — a ufw command, an iptables / ip6tables / nft rule not scoped to a Docker bridge, or a pipe-to-shell installer in the job’s own lines. The job-shape unit test fails. The shared .cma-runner-bootstrap anchor, which installs rustup through its upstream installer, is outside that test.

  • The concurrent image build exhausts the runner’s memory. docker compose build builds targets concurrently, against the #1347 serial-build rule; if it fails for memory, give CI the serial builder rather than retrying.

  • The runner is missing or interrupted. With cma-runner-craig offline the job does not run (the hook is unaffected); a runner_interrupted failure is infrastructure and gets a retry, not a code investigation.

  • The single serial job reds as a whole on one flaky phase and a retry repeats the image build; decomposition is #1739.

Consequences

  • The devstack suites, e2e, the SDK suites, the security probes and perf smoke get a server-side run on every MR that can affect them, including migrations-only and devstack-only MRs.

  • The job builds the workspace twice (the service images and the test binaries), so it inherits the runner’s disk sizing requirement (Known Issues & Lessons Learned).

  • The ephemeral key means CI does not exercise the sops-store adoption path. Only the pre-push battery does, through cargo xtask dev; the secrets-policy job checks the store’s recipients, not adoption.

  • The hook, the integration profile and local cargo xtask validate behave as before: validate runs the same numbered steps, in the same order, with the same labels. The one reordering is the unnumbered .ports.env reconciliation, which now runs before the fault preflight (D2).

  • The template-managed .githooks/pre-push header still calls server-side CI the "target compliance gate". It is a synced file, so it is not edited here; the mismatch is reported to claude-quickstart. Erratum (2026-11-01, #2879): the hooks are CRAIG-owned since the move to gadhs/pi, so the header is CRAIG’s to correct; it still says "target compliance gate", which this ADR’s merge-gate ruling supersedes.

Alternatives considered

  • Make ci-integration the merge gate (blocking, plus only_allow_merge_if_pipeline_succeeds). Rejected by the ruling: every code MR would wait on a long serial job (its timeout is two hours) on a single dedicated runner that the project does not operate.

  • Run the battery inside ci-tests (cargo xtask validate without --skip-devstack). Rejected: that path drives the devstack through cargo xtask dev (sops adoption, .devstack/ markers, the #1636 checkout guard) and needs the protected age key on every MR; raw compose with an ephemeral key is MR-safe.

  • Run ci-integration only on main or a schedule. Rejected: a post-merge run cannot surface a hook-skipped push on the MR that made it.

  • Open the firewall with ufw default allow incoming / allow routed and unscoped ACCEPT rules. Rejected: that exposes every host listener on every interface and bypasses Docker’s inter-network isolation, where only bridge-to-host traffic is needed.

Amendment — #2999 (2026-11-08): the configuration layers left CRAIG’s source

ADR-087 U4 (#2955) moved the configuration layers out of CRAIG’s source. A rulesets/<j>/<file> path above now names <file> in layer <j>: the federal, Georgia and Texas layers are the craig-config-{federal,georgia,texas} repositories, pinned in config-sources.lock and fetched to target/config/layers/<j>/ by cargo xtask config fetch, and the synthetic testonia layer is fixtures/config/testonia/. The path filter’s rulesets/** entry is now config-sources.lock, fixtures/config/**/* and ci/config-trust/**/*. The decision above is unchanged.

Amendment — #3043–#3046 (2026-11-10): the battery runs inside the car from the one compile

Plan ci-dev-loop (#3042) reshaped the D2 battery’s callers and the Consequences above. D1’s server-side run and D2’s one body stand.

  • One body, one flag (U1, #3043). cargo xtask test --integration with no --package runs validate::run_devstack_battery_standalone, the body D2 names. The --fault-gate spelling is gone, with no alias.

  • The battery runs inside the car (U4, #3046). Server-side, the battery is the line xtask test --integration --profile ci-integration of the one car job, after the gates and dev start, on that job’s stack. cargo xtask validate --profile full runs the same lines in the same order on a developer’s host (validate::car_lines). cargo xtask ci and its battery and build-tests stages are gone.

  • The battery compiles nothing (U2, #3044). dev start compiles the workspace once, musl and static, in craig-tools, and the battery runs from that one target. The Consequences bullet "The job builds the workspace twice (the service images and the test binaries)" no longer holds: the images copy the binaries that compile produced.

D3 and D4 stay superseded by ADR-086, whose D2 records the car’s shape (amended 2026-11-10).

Edit this page · latest