Plan: CI runs the developer’s commands on one VM; xtask stops being CI tooling (#3351)

Status: In progress
Epic: none
Issues: #3351 (parent) · U1 #3352 (w3) · U2 #3353 (w5) · U3 #3354 (w5) · U4 #3355 (w3); U4 closes the parent
Branches: chore/lints-as-verbs, feat/dev-start-one-build, feat/ci-car-is-the-dev-loop, feat/ci-release-job

Erratum (2026-11-08): rules lint-inputs and rules processing-days were already verbs (Command::Rules dispatches rules::Action), so U1 adds three, not five: spdx-lint, mandatory-docs-lint and portability-lint. The 42 gates measured 288 s warm on luchs (r390), not about 2 minutes; quality-budgets, test-lanes-lint --static and neutrality lead.

Erratum (2026-11-08), U2: dev start does not compile --all-targets itself. A developer's test runs on the host toolchain (glibc, target/debug), so it never shared dev start's CI-image build, and a wider dev start would only be slower. The maintainer chose: the car's step 2 runs the one cargo build --profile car --workspace --all-targets --features BATTERY_FEATURES and the portal's dx build as YAML lines, and dev start packages a devstack build already under target/car/ when it is newer than every file git sees, carries the test surface and names no glibc loader (devstack_binaries::build), as a general rule a second local dev start benefits from too. The in-network environment reuses validate_in_network::service_mesh_env (now given the workspace the broker inputs are read under) rather than a new lanes::in_network_env(): it is already held to the host renderer's key set. The second-compile acceptance moves to U3's car.

Erratum (2026-11-08), U3: it lands as two MRs, U3a the car job and U3b the rest of the xtask ci surface (validate reads the gate tables and devstack_binaries the binary sets, so they move before ci/ goes). ci-config-lint stays a lint of step 1: only its job-shape rules go (the script-line allow-list, the build, stack-job and docker-promote checks), which the car cannot pass; its supply-chain checks (pinned and verified downloads, telemetry off, the toolchain pin, no compile in a Dockerfile) are worth keeping and are not CI tooling. The /builds alias is three shell lines in the car's before_script (docker ps, docker inspect, mount --bind), not an xtask entry. cargo xtask test gains --cargo-profile, so the car's unit lane reuses the one build with the lane environment test already sets.

Erratum (2026-11-09), U3b: docker-compose.prebuilt.yml stays, as the deployment override: the Scaling & Deployment runbook, and the rollback in security operations, deploy promoted images through it. Only CI's use retires: xtask's CANOPY_PREBUILT_IMAGES mode and the file's canopy-integration entry. The --archive runs of identity conformance and test-lanes-lint go with ci identity and ci unit, their only callers, and under CI identity conformance joins the compose network itself, as ci identity did for it.

Erratum (2026-11-09), U4: it lands as two MRs, U4a the release job, the fixture smoke and the docs, and U4b the Kanidm registry pull (the first train car's dev start took 14.7 minutes, most of it Kanidm's build). The release set compiles in the car profile, as every image has shipped since #3271, not --release; dev start needs no --release flag, since with CANOPY_CARGO_FEATURES unset it runs the release set, and it reuses a fresh release build as it does a devstack one, refusing any binary that carries a test route. The job pushes the images the smoke ran, tagged, rather than a buildx rebuild. The ci-image job keeps its own push of the CI image.

Erratum (2026-11-09), U4b: the Kanidm pull is BuildKit's, not dev start's. Compose builds every service that has a build: section, so dev start cannot skip Kanidm's build. Instead the release job pushes the image built with inline cache, and each stack job runs docker build --cache-from against it before dev start, whose compose build is then a local cache hit. No xtask change.

Supersedes plan ci-one-vm-car (#3342) from U2 on. That plan’s file never reached main (its MR, !2044, left the train); its U1 (#3343, BATTERY_FEATURES, 50e26c9e8) stands, since one feature set is a cargo fact the local lanes use too. Its U2–U5 (#3344–#3347) close as superseded by this plan’s units, and #3342 closes with a pointer here.

The maintainer’s direction (2026-11-08). The local development loop and upstream CI/CD are different things. CI must not need commands in the repository that re-implement shell, and xtask serves the developer. A car runs the cheap precompilation lints first, all of them, each its own verb; compiles once; and runs what a developer runs. Coverage gaps while this lands are accepted.

Context

A car today is four jobs on four VMs (build, infra, e2e, smoke), each a cargo xtask ci <stage> verb (xtask/src/cmd/ci/, about 4,800 lines, plus ci_config_lint, which refuses a script: line that is not one). build compiles the workspace, pushes three image sets to the registry, and the stack jobs pull them back; main’s docker-promote retags the digests by tree. The verbs are a second copy of the developer path: ci build is cargo build/nextest archive, ci images is the compose image build dev start runs, ci devstack is devstack_guard::cold_start, ci infra wraps test --integration, ci e2e wraps e2e. Two copies of one bring-up drift, and every CI change became Rust.

The developer loop already does the work, on a box with docker. cargo xtask dev start compiles the devstack binaries and bundles the portal with dx inside the CI image (devstack_binaries::build: rust:1.99.0-alpine, so the binaries are musl and the Alpine images only COPY them from target/car/bin/<set>/ and target/car/portal/), builds the images by compose, prepares the identity plane and brings the stack up healthy, Kanidm included. cargo xtask test runs the lanes; cargo xtask e2e runs Playwright as the canopy-e2e compose service inside the network; cargo xtask identity matrix runs the three upstream conformance suites (Kanidm, Keycloak, ZITADEL), each against the upstream it provisions. A CI VM running the CI image with the VM’s docker socket is such a box.

What the VM changes, and nothing else: the job’s script already runs inside a container (the CI image), its /builds checkout is not the same path on the VM (builds_alias::run_inside_if_needed, 470 lines, already handles the bind mount), and the job container sits outside the compose network (one docker network connect, already builds_alias::join_project_network). Everything else about the four-job design, the registry round-trip and the nextest archive that let tests travel between VMs, was a consequence of using four VMs.

The 42 gates ci lint sequences (ci/lint.rs STEPS; validate runs the same tables as PRECONDITION_GATES, STATIC_GATES and its build-gate stage) compile nothing: they parse the tree (syn over .rs, TOML, JSON rulesets, YAML, AsciiDoc) or read Cargo.lock (cargo deny, cargo machete, cargo tree). 37 are verbs of their own already; five reach only through the sequencers: spdx (check_spdx_headers) and docs (check_mandatory_docs), private in ci/lint.rs; xtask-unix-guard (portability_lint::run_check); rules-lint-inputs (rules_lint::run) and processing-days-parity (processing_days_lint::run), which rules's action enum dispatches but cmd/mod.rs exposes under no verb of their own.

One cost the loop carries today, which a cold car makes visible: dev start builds the service binaries (-p <services> --bin …) and test then builds the test targets, as two invocations. Resolver 2 unifies dev-dependency features into shared crates only in an invocation that builds tests, so the second invocation gives 35 third-party crates other feature hashes and recompiles every workspace library (measured on #3343: 0 of 46 reused; one --workspace --all-targets invocation built all 21 binaries and the test build after it compiled nothing). Fixed in the loop, CI gets it free.

Design

The car: one job, the developer’s commands

.gitlab-ci.yml gets one car job in place of build, infra, e2e and smoke (extends: .stack, rules: *stack-rules, timeout: 3h, cache: []). Its script: is commands a developer could type, and GitLab stops at the first that fails.

Step Lines What it costs and catches

1. Lints

cargo fmt --check --all, then the 42 gates, one line each, every one cargo xtask <verb> or a cargo plugin (cargo deny check, cargo machete …)

About 2 minutes, no workspace compile; xtask compiles once (45 to 90 s cold) and every later line reuses it. A convention break fails here.

2. Compile once, stack up

cargo xtask dev start

One cargo build --locked --profile car --workspace --all-targets --features BATTERY_FEATURES in the CI image into the workspace’s target/: the service binaries, the token broker and every test binary, musl, from one resolution; the portal through dx; the binaries staged under target/car/bin/devstack/; the images by compose (COPY); the identity plane; up; health. Kanidm’s image is built here as locally.

3. Lanes

su-exec tester cargo xtask test --unit; cargo xtask test --integration --no-refresh; cargo clippy --locked --all-targets --features <BATTERY_FEATURES> — -D warnings; cargo doc … and cargo test --doc … with the same features; cargo xtask api-docs; cargo xtask e2e --no-refresh; cargo xtask identity matrix

Cheapest and most deterministic first. Nothing here compiles: the lanes run from the one target/, and clippy, rustdoc and the doctests reuse its units. The matrix runs the merge request’s range, as today, and --all on main.

after_script

cargo xtask dev logs into test-results/stack-logs/

The stack’s logs when the job failed.

The three cargo lines in step 3 that name features carry the literal, and a lanes.rs test asserts it against the constant (contract test: the YAML against the code).

The integration lane under CI. Locally test --integration builds the nextest archive, the canopy-integration runner image from it, and runs the lane in that container, because a developer’s shell is outside the compose network (ADR-015). That local shape stays. Under CANOPY_CI=true the job is already a container: test --integration joins it to the project’s network (join_project_network, as api-docs does today), sets the in-network environment the canopy-integration compose service declares (lifted from docker-compose.yml into lanes::in_network_env(); a contract test reads the compose file and asserts the two agree), and runs cargo nextest run -E INTEG_FILTER --profile ci-integration from target/. No archive, no runner image, no second compile. The identity inputs the runner container took from named volumes are read from the workspace, as the host lane reads them. ADR-015 holds: the tests reach the services by compose name.

Users. The script runs as root, as the stack jobs did. test --unit keeps the one exception: the unit tests that assert a permission refusal root bypasses run under su-exec tester after chown -R tester target, as build does today.

Kanidm. Compiling it from its release tarball is about 11 minutes, cached locally and paid cold on every car. U3 records the first car’s figure. If it is over 5 minutes, U4 has dev start pull $CI_REGISTRY_IMAGE/devstack/kanidm:<version>-<h> when the registry holds it (a read; the release job pushes it) and build it otherwise.

What a car does not do

It pushes nothing. docker-promote leaves the push pipeline; images.env, images-test.env, images-shared.env, docker-compose.prebuilt.yml and the build/* staging repositories are retired. The nextest archive stays only for the local test --integration (its runner image is built from it), so Dockerfile.integration stays as the local runner.

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; never on a merge request or a train. Its script is cargo and docker: cargo build --locked --release of every BINARY_PACKAGES binary (one line); docker buildx build --provenance=false --build-arg BINARY_SET=release -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" --push . and the portal’s; cargo xtask dev start --release (the production set, for the smoke); cargo xtask perf --profile smoke; syft and cargo cyclonedx for the SBOMs; today’s latest guard and tag lines from docker-promote. fixture-smoke's three-pack matrix runs in the same scheduled pipeline. ADR-040 gets Amendment 9: build-once holds between the release build and its promotion. Two contract tests in lanes.rs read the YAML: the release-build line names every BINARY_PACKAGES binary, and no rule of release admits merge_request_event; --push appears in no job but release.

What is retired

xtask/src/cmd/ci/ whole (14 modules and their tests); ci_config_lint's job-shape rules (gating.rs, the promote and build-job checks; its download-digest check and Kanidm-ref pin become plain tests in lanes.rs); test_lanes_lint/archive.rs; devstack_binaries' ci build indirection (the container script runs cargo and dx directly); docker-compose.prebuilt.yml. validate keeps its sequencing role for the developer.

Kept, because they are the developer loop: dev, test, e2e, identity, perf, api-docs, validate, lanes.rs, the lint verbs, builds_alias, devstack_*, Dockerfile.integration and the canopy-integration compose service.

Scope

U1 (w3) — Every lint a verb

Files: xtask/src/cmd/mod.rs, xtask/src/cmd/ci/lint.rs, xtask/src/cmd/portability_lint.rs, xtask/src/cmd/docs.rs, xtask/src/cmd/rules.rs (the five become verbs, named to fit the existing ones; ci lint and validate call the verbs' functions), docs/modules/ROOT/pages/tooling/xtask-catalog.adoc, CHANGELOG.adoc.

Tests: each new verb runs the function ci lint ran (regression: the case that would catch a verb wired to nothing); one test asserts ci lint's STEPS and validate's three gate tables name the same gates (contract). Acceptance: cargo xtask <verb> exists for every one of the 42, and their total wall on a cold checkout, recorded on the issue (the figure the car’s step 1 is measured against).

U2 (w5) — dev start compiles once; test --integration runs in-network from the target under CI

Files: xtask/src/devstack_binaries.rs (the one --workspace --all-targets --features BATTERY_FEATURES build, then dx and the staging under target/car/; build_archive stays for the local runner), xtask/src/cmd/ci/build.rs (only what devstack_binaries still calls, until U3), xtask/src/cmd/test.rs (run_integration_tests_container: under CANOPY_CI=true join the network and run from target/; off CI, the container as today), xtask/src/lanes.rs (in_network_env() and its compose-agreement test), docker-compose.yml (canopy-integration's environment is in_network_env's definition), docs/modules/ROOT/pages/testing.adoc, local-dev.adoc, CHANGELOG.adoc.

Tests: dev start's build argv is one invocation with every target and the battery features (contract); in_network_env equals the compose block (contract); the CI shape joins the network and passes no --archive-file (regression). Acceptance, on the issue, from one developer box: dev start then test --unit, with the second’s compile count from --message-format json, against today’s.

U3 (w5) — The car job

Files: .gitlab-ci.yml (the car job; build, infra, e2e, smoke removed; docker-promote removed from the push pipeline; .stack-test, .prebuilt-stack and the images*.env artifacts removed), xtask/src/cmd/dev.rs, xtask/src/cmd/test.rs, xtask/src/cmd/e2e.rs, xtask/src/cmd/identity/matrix.rs (each enters the /builds alias under CANOPY_CI=true, as the ci verbs did), xtask/src/lanes.rs (the YAML tests: the lint block against STEPS, the feature literal, the digest and Kanidm-pin checks moved from ci_config_lint), xtask/src/cmd/ci/ (removed), xtask/src/cmd/ci_config_lint.rs and ci_config_lint/ (removed), xtask/src/cmd/test_lanes_lint/archive.rs (removed), docker-compose.prebuilt.yml (removed), docs/modules/ROOT/pages/testing.adoc, contributor-workflow.adoc, plans/compile-once-per-car.adoc (erratum), CHANGELOG.adoc.

Acceptance, on the issue: one green car on a merge request with GitLab’s per-line timings, wall and VM-minutes against the last four-job car (108.9 VM-min, 88.8 min wall); the unit, integration and e2e test counts equal to that car’s; step 1’s wall; free -m after dev start; Kanidm’s build time; grep -c "xtask ci " .gitlab-ci.yml is 0 and cargo xtask --help lists no ci. A deliberate SPDX-less file fails the car in step 1, before any compile.

U4 (w3) — The release job; docs; the close

Files: .gitlab-ci.yml (release; sbom folded in; fixture-smoke on the schedule), xtask/src/cmd/dev.rs (--release), xtask/src/lanes.rs (the release-job tests above), the Kanidm pull if U3’s figure calls for it, docs/modules/ROOT/pages/deployment-guide.adoc, adrs/adr-040-build-once-artifact-promotion.adoc (Amendment 9), security.adoc (cars push nothing), developer-guide.adoc, CHANGELOG.adoc. The maintainer is asked to protect the production repositories (recorded). Status Done; closes the parent; #3342 and #3344–#3347 closed as superseded.

Acceptance: one manual release run’s digests and smoke result; one tag pipeline promoting them.

Verification

  1. cargo xtask test passes at every unit.

  2. U2: the second compile count, on the issue.

  3. U3: one green car with the numbers above; the SPDX fault caught in step 1.

  4. U4: one release run and one tag promotion, digests on the issue.

  5. Every unit merges on a green train.

Risks

Risk Class Mitigation and the test that pins it

Between U3 and U4, main promotes no images and runs no production smoke.

fail-closed

Accepted by the maintainer (2026-11-08). Nothing deploys from a pipeline in that window; the last promoted digests stand. U4 follows U3 directly.

A cold car builds Kanidm from source on every run, about 11 minutes.

fail-closed

U3 records the figure. Over 5 minutes, U4 adds the registry pull with the local build as the fallback; a missing registry image costs time, never correctness.

The YAML and the code drift: a lint added to validate and not to the car, a feature literal in the YAML behind lanes.rs, a --push in a car job.

silent

The lanes.rs contract tests read .gitlab-ci.yml (U3, U4): the lint block equals STEPS, the literals equal the constants, --push appears only in release, release admits no merge-request rule.

The in-network environment test --integration sets under CI diverges from the compose service’s, so a CI run reaches a service the local lane does not, or the reverse.

silent

One definition, lanes::in_network_env(), and the contract test against docker-compose.yml (U2).

Running the whole script as root hides a permission-refusal test’s failure.

silent

test --unit runs under su-exec tester, as today; U3’s acceptance compares the unit count to the four-job car’s.

Documentation Updates

  • xtask-catalog.adoc: the five new verbs; the ci verbs gone

  • testing.adoc, local-dev.adoc: dev start compiles once; the integration lane’s two shapes; the car is the developer loop

  • contributor-workflow.adoc: the car

  • deployment-guide.adoc: the release job and schedule

  • adr-040: Amendment 9

  • security.adoc, developer-guide.adoc

Edit this page · default