Plan: CI runs the developer’s commands on one VM; xtask stops being CI tooling
Status
Done (2026-11-10) — U1–U5 merged: a car is one car job on one VM running the developer’s commands (validate::car_lines), the workspace compiles once (musl, in craig-tools) and the devstack images only copy the binaries, cargo xtask ci is gone, and a protected release-build job alone pushes images, after its smoke; the first green car took ~59 min wall, ~62 runner-min and 1 pool slot against the four-job car’s ~40–49 min, 70–90 runner-min and up to 4 slots (#3046); U3’s first green manual release waits on #3050
Erratum (2026-11-09): U2 runs cargo xtask test --unit in craig-tools from the one compile on every host, not only under CI=true (D1); U4’s test.rs item (--unit under CI re-execs into craig-tools) is therefore done.
Erratum (2026-11-09): a GitLab job named release already exists (the release-cli step that publishes a tag’s release), so D3’s new job is release-build and the existing release job needs it for the SBOM; every reference below to the new release job, the --push contract test included, means release-build.
Erratum (2026-11-09): U3’s acceptance "`grep -c 'ci images' .gitlab-ci.yml` is 0" holds only from U4, since the car’s build job keeps xtask ci images --publish-digests until U4 replaces the car; in U3 it means no promote, SBOM or scheduled-stack line runs ci images, ci devstack-up or --await-images.
Erratum (2026-11-09): D3’s bake file builds the twelve promoted targets with only the services' declared release-features a default build leaves off (plugin-ssa-screening), never the devstack/test-only features in BUILD_SPECS, which release-artifact-gate keeps out of shipped images; the three devstack-only side images form a local, never-pushed release-stack group the smoke needs; and release-build pushes last, only after the smoke on those same images passed.
Erratum (2026-11-09): release-build also runs off a tag, where changelog notes has no section to render, so the notes line runs in a tag-only release-notes job (no shell guard in a script line) and the release job needs both.
Erratum (2026-11-09): U3’s acceptance run (one green manual release) waits on #3050 (Georgia’s baseline places a test-only plugin, so the shipped composition cannot boot on it); the release smoke stays the shipped bytes.
Erratum (2026-11-09): U4’s car runs xtask config fetch right after cargo fmt --check --all, ahead of the gates (step 1), not in step 2: the scenario, citation and JDM gates read the locked layers (#3014); a train’s unit line is xtask test --unit $CRAIG_UNIT_FLAG, .car-rules setting --leave-to-battery.
Erratum (2026-11-09): U4’s e2e lines are xtask e2e and xtask e2e --degraded, not --no-refresh: on the car’s one stack the battery mutates the seeded rows the specs assert, so each run reseeds first (measured: --no-refresh after the battery failed every seeded-data spec).
Issues: #3042 (the plan) · U1 #3043 · U2 #3044 · U3 #3045 · U4 #3046 · U5 #3047, under epic &122 (which
ci-one-vm-car opened; this plan supersedes it from U2 on). Closes on the way: #3028 (an advisory MR check still joins the train; U4), #3026
(cars no longer pull the BuildKit builder; U4), #3041 (compile once; U2), #2779 and #3017 (the release job; U3).
Supersedes ci-one-vm-car’s U2–U5 (#3031–#3034), closed as superseded when this plan was filed.
Branches: chore/ci-dev-loop-u<N>.
Tree: written against origin/main (2026-11-08), which carries ci-one-vm-car U1 (!2248: ci car,
ci release, ci purge, images --local, devstack-up --local, LatestPolicy::TagOnly).
A Design + Scope plan: GitLab owns tracking; the plan freezes when U1 starts. Modelled on canopy’s plan
ci-runs-the-dev-loop (canopy #3351, approved 2026-11-08) after the maintainer’s direction: the local development
loop and upstream CI/CD are different things; CI must not need commands in the repository that re-implement shell;
xtask serves the developer. Findings are shared on the cicd channel; no components are shared.
Context
The car today
A car is up to six jobs on four VMs (.gitlab-ci.yml:152-194: check, build, battery, e2e, beside ci-image,
xtask and docs), each a cargo xtask ci <stage> verb. build pushes the tree’s devstack images to the registry
and battery and e2e pull them back (--await-images); main’s docker-promote retags them. The verbs live in
xtask/src/cmd/ci/ (25 modules, about 10,800 lines). Seven of the nine stages of full_plan
(xtask/src/cmd/ci/mod.rs:357) are thin wrappers over the developer’s functions: ci lint, ci clippy, ci unit
over validate.rs; ci build-tests and ci battery over validate::battery_test_binaries and
validate::run_devstack_battery; ci e2e and ci aux over the e2e, sdk-test, security and perf verbs. Two
are second copies with a registry inside: ci images (buildx.rs 780 lines, cook_cache.rs 553, hub_proxy.rs 538,
infra_images.rs 515, images.rs 1,389: tree tags, digests, the BuildKit registry cache) and ci devstack-up
(await_images.rs 453). hub_proxy.rs (538) is not CI-only: its hub_image and base_registry_* are called by
dev.rs, docker.rs, perf.rs, sdk_test.rs, security.rs, devtools.rs, cluster_tests.rs, validate.rs and
multibackend_bootstrap.rs (the dependency-proxy rewrite every pull makes on CI). pipeline_tests.rs (3,278 lines) pins the four-job shape and refuses any script: line
that is not an xtask verb. cargo xtask validate --profile full is itself a call to ci::full_plan
(xtask/src/cmd/validate.rs:428).
The car also compiles the workspace twice. dev start builds fifteen images serially from the root Dockerfile
(xtask/src/docker.rs:593, BUILD_SPECS, four cargo-chef groups), each a musl compile inside Alpine under
--profile devstack; measured at 12.6 min on a train (plan ci-one-vm-car § Context). build-tests then compiles the
whole test inventory again, glibc, inside craig-tools (target/craig-tools, xtask/src/docker.rs:1571): 10 min,
of which 478 s is the inventory and 602 s a re-exec that compiles it a second time. Under resolver 2 a test-building
invocation gives 35 shared third-party crates other feature hashes than a binaries-only one, so the two compiles
share nothing (canopy measured 0 of 46 workspace libraries reused on #3343).
What the loop already does
cargo xtask dev start (xtask/src/cmd/dev.rs:152, xtask/src/devstack.rs:185) builds the images, provisions the
field keys and the identity plane, brings the stack up by compose, waits for every service’s health and for
craig-seed to exit 0. cargo xtask test (xtask/src/cmd/test.rs:15-120) runs fmt, clippy and the unit lane on the
host (--unit-only stops after the unit lane); --fault-gate, and --integration with a --package, run the
battery body (validate::run_devstack_battery_standalone) inside craig-tools on the compose network. Its flags
are shaped for a developer picking one lane, not for a script naming each lane in turn; U1 reshapes them. cargo xtask e2e runs Playwright in the craig-e2e container, sdk-test,
security and perf run the aux suites. A CI VM running craig-ci with the VM’s docker socket is such a developer
box: builds_alias.rs already maps the /builds checkout and joins the job container to the compose network.
The precompilation gates compile no workspace code. All but three are verbs of their own: the 28 cargo xtask lints
<name> lints, quality-budgets, validate-authz-coverage, validate-evil-corpus-coverage,
validate-contention-coverage, validate-migration-constraints, validate-template-safety,
validate-web-query-strings, validate-rust-html, plan-lint, release-artifact-gate, api-docs --check,
changelog check, authority-evidence, scenarios, rules check, policy audit, and the plugins cargo fmt,
cargo machete, cargo deny. Six reach only through a sequencer (ci/lint.rs::run_after_format, validate.rs): check_spdx_headers
(validate.rs:2694), enforce_migration_apply_isolation (validate.rs:861), enforce_source_ownership
(validate.rs:1242), the .dockerignore secret-leak canary check_dockerignore_no_secret_leak (validate.rs:2569)
and gitleaks over HEAD’s history run_gitleaks (validate.rs:1498; both run from ci images today,
images.rs:288), and the rustdoc twins run_doc_gates (validate.rs:2960, a compile: it belongs with the lanes).
ci’s stage runner also fetches the policy lock before any stage (`config::fetch_locked, ci/mod.rs:451): the
developer’s cargo xtask config fetch.
Facts the design rests on
-
The workspace is pure Rust: rustls only (
deny.toml:119bans OpenSSL), pure-Rust sqlx, embedded tz data, nocfg(target_env)anywhere. Static musl binaries run in any container. -
release-artifact-gate(xtask/src/cmd/release_artifact_gate.rs:16-45) keeps test-only features out of production bytes by parsing theDockerfile’s `cargo buildunits. It stays valid as long as the release images are compiled by theDockerfilebuilder, which this plan keeps. -
craig-mock-serverandcraig-seedare compiled in a separatetools-builderstage (Dockerfile:203) socraig-state-ga/mockdoes not unify into the services; one workspace invocation would unify it. -
The 4xlarge reuses VMs (#2946): a previous job’s stack can hold ports and volumes;
ci purge(xtask/src/cmd/ci/devstack_up.rs:121) clears it today. -
Test binaries bake absolute paths (
CARGO_MANIFEST_DIR,CARGO_BIN_EXE_*, insta’s workspace root; canopy #3274): they must run where they compiled, which one VM with one bind-mounted checkout gives for free.
Design
D1. One compile, musl, inside craig-tools
cargo xtask dev start compiles the workspace once, inside craig-tools (the battery’s container, bind-mounted
checkout, target/craig-tools as build-tests uses today), as one invocation:
cargo build --locked --workspace --all-targets --target x86_64-unknown-linux-musl --profile devstack --features <BATTERY_FEATURES>
craig-tools gains the x86_64-unknown-linux-musl target (rustup target add in its Dockerfile stage; the linker
is U2’s measurement: self-contained rust-lld or mold, whichever links the inventory faster). The binaries are
static, so the images, the lanes and the job container all run them unchanged. BATTERY_FEATURES is one constant
in xtask/src/lanes.rs (new): today’s devstack features (craig-web/plugin-example, craig-web/plugin-ssa-screening,
authz-witness) plus what the tests enable; self-signed-tls stays out unless U2 shows it inert when unconfigured
(the shines-tls image then builds its own intake binary with a second, small invocation, as today’s group 4).
craig-state-ga/mock is confined so it does not unify into a service: the mock becomes its own crate
(crates/craig-state-ga-mock, the cheapest confinement) or stays a feature compiled by a second invocation for
craig-mock-server alone; U2’s measurement decides, with the acceptance "after the one invocation, the test build
and cargo test --doc compile nothing". A test pins the confinement: cargo tree -e features over the battery
invocation shows mock enabled for no service package.
[profile.devstack] (Cargo.toml:524) becomes the battery’s profile: debug = "line-tables-only" so a backtrace
keeps file and line (today .test-debuginfo sets it for the test profile alone). The test binaries and the service
binaries come from the same profile, as canopy’s car profile does.
The devstack images stop compiling. The Dockerfile gains a devstack-runtime stage per service that COPY`s the
binary from the build context (`target/craig-tools/x86_64-unknown-linux-musl/devstack/<bin>) into the same
alpine:3.23 runtime as production, with the same user, probe and static assets. dev start builds those fifteen
targets with the daemon’s own builder (no BuildKit container, no registry cache: #3026 is moot). The builder and
tools-builder chef stages stay for the release build only (D3); ADR-039’s Amendment #3003 (the cook layer inside
the image) is narrowed to the release images.
Locally, a developer’s dev start does the same: one compile in craig-tools, images by copy. cargo xtask test
keeps running fmt, clippy and the unit lane on the host; under CI=true its lanes re-exec into craig-tools against
the one target, as ci unit/ci battery do today (Stage::runs_in_craig_tools, ci/mod.rs:254).
D2. The car: one job, the developer’s commands
.gitlab-ci.yml gets one car job in place of check, build, battery and e2e (extends: [.xtask-bin,
.test-results, .stack-teardown], needs: [{job: xtask, artifacts: true}], timeout: 2h, interruptible: true,
$CI_RUNNER_TAG). GitLab stops at the first failing line. Per .xtask-bin (#2982) a job runs the xtask job’s
artifact as xtask <verb>, never cargo xtask; the lines below are written that way, and read as the developer’s
cargo xtask <verb>.
| Step | Lines | What it costs and catches |
|---|---|---|
1. Gates |
|
About 2–3 min, no workspace compile. A convention break fails here, before any compile. |
2. Compile once, stack up |
|
D1’s one invocation, the fifteen copy-only images, the infra images, identity, |
3. Lanes |
|
Nothing here compiles: every lane runs from the one target. Cheapest and most deterministic first. |
|
|
The stack’s logs when the car failed. |
On a train xtask test --unit is skipped (CRAIG_CHECK_FLAG, #2995: the battery runs those tests); the flag
becomes a plain rules: variable the line reads. The job’s BASE_REGISTRY is the dependency proxy, as today’s
build sets it; hub_proxy.rs keeps rewriting every pull through it (it moves, D5).
Contract tests move from xtask/src/cmd/ci/pipeline_tests.rs to xtask/src/pipeline_tests.rs and assert the new
shape: the car’s step-1 block equals validate’s gate sequence, one line per gate, in its order (U1 lifts the
sequence out of `run_static_policy_gates, run_static_security_lints (validate.rs:738, :1384) and
ci/lint.rs::run_after_format into one table both the sequencer and the test read); every script: line of the car is cargo fmt, cargo machete or xtask <verb> (the artifact; no xtask ci,
no docker, no cargo nextest, no cargo build); --push appears in no job but release; the car’s
rules block on a train and on a plain MR whose changes: match (D4); every job has needs:; the YAML stays under
500 lines. The feature literal appears in no YAML line (it lives in lanes.rs; dev start carries it).
D3. The release job
A release job, stage: promote, resource_group: release, on $CI_COMMIT_TAG, on $CI_PIPELINE_SOURCE ==
"schedule" (main; weekly baseline, settable in the schedule) and when: manual on main; on no merge-request or
train rule (a contract test reads its rules:). It replaces docker-promote and sbom, and the GitLab release
job needs it. Its lines:
-
docker buildx bake --file docker-bake.hcl release --push: a bake file (new) declares the fifteen production targets from theDockerfile’s `builder/tools-builderstages (CARGO_PROFILE=release, today’s per-image features fromBUILD_SPECS) with tags:<sha8>always, plus:<tag>and:lateston a tag (LatestPolicy::TagOnly’s rule, as bake variables from `CI_COMMIT_TAG). The bake file is the one place the production image set is named;release-artifact-gatereads theDockerfileas today and gains a check that bake’s targets name onlybuilderunits. -
cargo xtask dev start --release: the stack on the images just built (devstack-only side containers as today); thencargo xtask perf --profile smokeandcargo xtask security --phase public-api(today’sci smokeverbs,xtask/src/cmd/ci/smoke.rs:14). -
cargo xtask sbom --out … --job-env sbom.envandcargo xtask changelog notes(the formersbomjob’s lines; both are developer verbs already), artifactsexpire_in: never.
The scheduled stacks (pentest, perf-load, perf-stress) run cargo xtask dev start and their verb; they no
longer need build or --await-images. The tool images (craig-tools, craig-devtools, craig-gitleaks) are keyed by
input hash as today: a car pulls one when the registry holds it (a read) and builds it locally otherwise; only
the release and scheduled pipelines push them (dev start --push-tools, a flag those jobs' lines carry; the
--push contract test covers it).
D4. The plain MR pipeline
Carried from ci-one-vm-car D5: a plain MR whose changes match .car-rules’ list runs the car blocking
(`allow_failure: false), so the train never admits a red car its MR pipeline could have shown; a docs-only MR runs
docs alone. Closes #3028.
D5. What retires, what survives
Retired in U4: xtask/src/cmd/ci/ whole (aux, await_images, battery, build_tests, buildx, car, check,
clippy, cook_cache, devstack_up, e2e, hub_proxy, identity_multibackend, image, images, infra_images,
lint, mod, release, sbom, smoke, unit, pipeline_tests); the images*.env hand-off; the craig-tools
push on cars; the BuildKit container builder and registry cache. Moved, not retired: builds_alias.rs and
hub_proxy.rs → xtask/src/ (the /builds alias and the network join are the VM’s one difference from a developer
box; the proxy rewrite is every verb’s pull path on CI); image.rs → cargo xtask ci-image --ensure (the craig-ci toolchain image by input hash; a job must exist before xtask does);
identity_multibackend.rs → cargo xtask identity matrix (a developer verb; the identity-multibackend job calls
it); the purge → dev clean --any-project; full_plan’s stage list →
`validate.rs, which keeps its sequencing role for the developer (validate --profile full = steps 1–3 of D2 in
order, on the host).
Scope
| Unit | Files and work | Acceptance |
|---|---|---|
U1 (w3) — every gate a verb; the lanes selectable |
|
Each new verb runs the function the sequencer ran (regression test per verb); one contract test: the gate table
and the set of verbs agree, and |
U2 (w5) — |
|
Measured, on the issue: (a) after the one invocation, |
U3 (w3) — the release job |
|
One manual release run: its digests, tags and smoke result on the issue; one tag pipeline pushing |
U4 (w5) — the car; |
|
One green car on a merge request and one on a train, with GitLab’s per-line timings: wall and runner-minutes
against the four-job baseline (34 min wall, 68.5 runner-min over four slots); the unit, battery, e2e and aux counts
equal to the last four-job car’s; |
U5 (w2) — docs, ADRs, the close |
|
|
Order: U1 → U2 → U3 → U4 → U5. U3 lands before U4 so main never stops promoting: docker-promote leaves only when
release has pushed once.
Risks
| Risk | Class | Mitigation and the test that pins it |
|---|---|---|
musl’s allocator slows the parallel battery. |
fail-closed (a slow lane is still a gate) |
U2 (b) measures before the car depends on it; the erratum path is a glibc runtime base for the devstack images, not a return to two compiles. |
A test-only feature reaches a devstack binary through unification. |
silent |
The devstack bytes are not production bytes (they never were: |
A stale stack on a reused VM holds a port while the compile runs. |
fail-closed |
|
Test binaries baked with the compile path run elsewhere. |
fail-closed |
One VM, one bind-mounted checkout; the lanes run inside craig-tools from the target they compiled in. A pinned
test runs one insta snapshot and one |
The YAML and the code drift: a gate added to |
silent |
|
A car over the pool’s patience: one VM is serial. |
fail-open (throughput) |
Bound: 60 min wall on U4’s first cars (baseline 34 wall over four slots; the removed compile and waits pay for most of the serial cost). Over 75 min sends the plan back with the measured table. |
Decisions
| # | Decision | Why, and the alternative |
|---|---|---|
1 |
One musl compile, static binaries, images by copy. |
The workspace is pure Rust; production is musl already. Alternative: a glibc compile with a bookworm-slim devstack base (the erratum path if U2 (b) fails). |
2 |
The compile runs inside craig-tools with the musl target, not in a separate rust:alpine container or on the job image. |
One tool container, the one the lanes already re-exec into; the job image (craig-ci, glibc, the docker CLI) stays the small image a job must start from. Alternative: an alpine job image, which would also need the docker CLI and the Antora-free toolchain duplicated. |
3 |
Script lines are developer commands; no |
The maintainer’s direction (2026-11-08); the contract tests move from "every line is an xtask verb" to "every line is a developer command and the gate block equals the tables". |
4 |
The release images are built by |
Fifteen targets
in one declarative file that bake, a part of buildx, already reads; |
5 |
|
ci-one-vm-car D3, carried. |
6 |
U3 before U4. |
So main never stops promoting between units; U3 also moves the scheduled stacks off |
7 |
ci-one-vm-car U1’s |
Their purge and local
image build survive as |
Verification
-
cargo xtask testpasses at every unit;cargo xtask validate(full) runs D2’s steps on a developer box. -
U2’s four measurements and U4’s car table on their issues; U3’s digests and smoke.
-
Every unit merges on a green train.
Documentation Updates
-
quality-gates.adoc: the gate table names each verb (U1); § CI: the car’s shape and the contracts (U4) -
testing-reference.adoc§ CI stages: the car; the battery from one target (U2, U4) -
local-dev.adoc:dev startcompiles once, where the binaries land, the musl target (U2) -
the release page: the release job, schedule, tags, bake (U3)
-
ADR-086, ADR-039, ADR-080 amendments;
plans/ci-one-vm-car.adocStatus (U5) -
changelog.d/: one fragment per unit