Local Development

For a contributor setting up a dev machine: this page owns the first-run sequence and the cargo xtask dev lifecycle. Tests and the push gate live in Testing, variables in Configuration Reference, profiles / databases / health in Deployment Guide, and fixes in Troubleshooting.

Host dependencies

  • Rust — rust-toolchain.toml pins the exact toolchain (1.100.1, rustfmt + clippy, the wasm32-unknown-unknown target for the applicant portal); rustup installs it on first use. rust-version in Cargo.toml (1.100) is that toolchain's release line: canopy supports the one toolchain it pins.

  • Docker Engine with the Compose v2 plugin and BuildKit (the Dockerfile uses RUN --mount=type=cache); daemon running, your user in the docker group. Stock-distro compose 2.40.x works — xtask names dependency profiles explicitly on compose run (xtask/src/cmd/test.rs).

  • Required cargo subcommands — cargo xtask doctor and validate's preflight stage check for them (PREFLIGHT_CARGO_TOOLS in xtask/src/cmd/doctor.rs): cargo install cargo-nextest --locked, cargo install cargo-machete --locked and cargo install cargo-deny --locked. Validate’s deny stage (cargo deny check) blocks (#2239).

  • Optional: cargo install cargo-mutants --locked, needed only for cargo xtask mutants (Mutation testing).

  • Optional: glab (the visibility stage prints SKIP without it); git-lfs (design/** images are LFS-tracked in .gitattributes; the pre-push hook’s git lfs pre-push step is a no-op without it).

  • Host sizing: the full profile assumes a multi-GB-RAM machine — the shared Postgres runs with shared_buffers=4GB / effective_cache_size=12GB / maintenance_work_mem=256MB (#2197; the rationale is in the compose comments) and the clamav sidecar has mem_limit: 4g (docker-compose.yml).

  • Not needed on the host: Node.js / Playwright (canopy-e2e container), age / sops (canopy-devtools container), psql / pg_dump (docker exec), k6 (container), Antora (the CI pages job).

First run

git clone https://gitlab.com/gadhs/application/eligibility/canopy.git && cd canopy
git config core.hooksPath .githooks && chmod +x .githooks/*        # pre-commit, commit-msg, pre-push
git config commit.gpgsign true && git config user.signingkey <KEY>  # validate's `signing` stage checks both
cargo xtask secrets init      # optional: a dev age keypair — read the secrets note below first
cargo xtask dev start         # build the images, start the full profile, wait for health
cargo xtask dev status        # compose ps + the URL table (host ports are ephemeral)
cargo xtask test              # fmt + clippy + both test lanes
  • cargo xtask test, e2e, validate and coverage cold-start the devstack themselves when no .devstack/ markers exist (devstack_guard::ensure_ready), so dev start is optional on the very first run. With markers present they refresh instead, and the refresh asks docker whether any of the project’s locally-built canopy app containers is running before it trusts the markers (devstack_guard::check_readiness; a docker ps on the com.docker.compose.project label, kept to containers whose com.docker.compose.service label names a canopy application service — docker::is_fleet_service, the same selection as the anti-latch check, never the image name, #2598): a daemon that lost the containers and images — a moved data-root, docker system prune -a, a fresh clone that copied .devstack/ — is brought back up with a plain compose up -d (which builds any missing image) rather than reported up to date. Pulled infra and the observability pair validate layers in (prometheus, grafana) never count as the stack; a partially missing app fleet is still caught by validate's api-docs stage, and lost data volumes are not reseeded.

  • Secrets. dev start decrypts secrets/dev.yaml with the age key at ~/.config/sops/age/keys.txt and passes the values to compose; with no key it prints a warning, skips SOPS injection (xtask/src/cmd/dev.rs), and writes a random 32-byte CANOPY_ENCRYPTION_KEY into the workspace .env floor (xtask/src/docker.rs, #3090) when .env does not already carry one. A later run with the age key prefers the decrypted secret, and switching keys requires cargo xtask dev restart, because data sealed under the local key cannot be read under the team’s. secrets init mints a new recipient, which cannot decrypt the existing file — an existing recipient must first run cargo xtask secrets add-recipient <age1…> for your public key. All age/sops calls run inside canopy-devtools (xtask/src/cmd/secrets.rs).

  • Signing keys. dev start / reload / restart, dev refresh and every cargo xtask lane bring-up (devstack_guard::ensure_ready) generate any missing .keys/<program>-{private,public}.pem (and the .env CANOPY_ENCRYPTION_KEY floor above) before the containers come up (devstack_guard::ensure_signing_keys, called from each of those arms in xtask/src/cmd/dev.rs), so a fresh checkout without the decrypted secrets needs nothing beyond cargo xtask dev start. A program service prefers CANOPY_<SVC>__SIGNING_KEY from the decrypted secrets and falls back to .keys/ because the devstack sets CANOPY_ENV=development — outside development there is no file fallback (crates/canopy-signing/src/program_signer.rs; loader policy); the orchestrator seeds its verifier from CANOPY_VERIFY_KEY_<PROGRAM> or the public PEM on disk (crates/canopy-signing/src/verifier.rs, from_secrets) and resolves any other key id through canopy-security’s key history (services/canopy-eligibility/src/key_history.rs, HttpKeyHistoryProvider), where each program service registers its public key at boot (crates/canopy-api/src/signing_registration.rs). No .keys/ copying between machines is needed.

  • The tests need no /etc/hosts entry: canopy-test-lib falls back to 127.0.0.1 when host.docker.internal does not resolve (crates/canopy-test-lib/src/config.rs), and pins the devstack’s TLS names to their publications itself. A browser on the host does need entries, and the devstack CA trusted, to sign in to canopy-web, which publishes no http port (canopy-web’s origin and the ingress).

The federal and Georgia configuration

The federal and Georgia layers live in their own repositories (canopy-config-federal, canopy-config-georgia). config-sources.lock pins the commit of each that this source tree is tested against, and

cargo xtask config fetch

publishes them under target/config/<layer>/current, each commit verified against the public key in ci/config-trust/. Run it once after cloning and again when a pin moves (cargo xtask config bump moves one: A policy change). The cargo xtask checks that walk the layers, cargo xtask seed, a service run on the host (.cargo/config.toml points CANOPY_POLICY_ROOT there) and the tests of the real packs read that tree; a check that finds none names the command. The unit lane (cargo xtask test --unit) reads fixture packs only and needs neither the fetch nor the network.

Checking a configuration working copy

The fetch publishes only the commits the lock pins. To check a pack you are editing, before any pin moves, clone its repository and the federal one beside it and run canopy config check on the two directories. Until a canopy release ships the binary, run it from this checkout:

git clone https://gitlab.com/gadhs/application/eligibility/canopy-config-<jurisdiction>.git ../canopy-config-<jurisdiction>
git clone https://gitlab.com/gadhs/application/eligibility/canopy-config-federal.git ../canopy-config-federal

cargo run -p canopy-cli -- config check ../canopy-config-<jurisdiction> --federal ../canopy-config-federal

It needs no devstack, login or network. Edit the pack and run it again until it exits 0; 1 means a finding, each printed with its file, and 2 means a directory is not the layer its argument asks for. The first line names the federal commit checked against, so pull the federal clone when it is behind. A clean check proves the pack's own content and not that every service boots on it: the car of the pinned commit is the gate (Offline commands).

Devstack lifecycle

--profile accepts the six values in VALID_PROFILES (xtask/src/cmd/dev.rs), default full.

Command What it does Data

cargo xtask dev start [--profile P] [--shared-db]

Reserve ports, decrypt secrets, build the binaries in the CI image (The devstack’s binaries), a cached compose build of the images that copy them, then compose up -d; write .ports.env and the .devstack/ markers

kept

cargo xtask dev status

compose ps, the URL table, the staleness report (⚠ devstack is DOWN, naming dev refresh, when no canopy app container runs), notices naming any app container that runs older content than its image tag or could not be compared with it

—

cargo xtask dev refresh

Hash source (Rust, Askama templates, every member’s Cargo.toml, the Plugin.toml manifests and every other compiled-in file) / deps / Dockerfiles, the CI image and the toolchain / config / rulesets / migrations / seed, and the feature set (CANOPY_CARGO_FEATURES, sticky), against the markers and do the minimum rebuild (the binaries, then the images), restart or reseed; bring the stack up when no canopy app container is running

kept, unless the guard decides a volume wipe (VolumeAction::Wipe)

cargo xtask dev reload [--profile P] [--shared-db]

compose down then start — the forced bounce (every process restarts, so cached key sets and tokens go)

kept

cargo xtask dev restart [--profile P] [--shared-db]

down -v --remove-orphans --rmi local, then start (its cached build re-creates the images)

wiped

cargo xtask dev stop

compose stop

kept

cargo xtask dev clean --confirm

down -v --remove-orphans across all profiles, the opt-in idp-kanidm included; removes the devstack’s identity state (.devstack/idp/tls, .devstack/idp/kanidm-ca.pem, .devstack/idp/kanidm.json, .devstack/identity)

wiped

cargo xtask dev logs canopy-<svc> [--tail N] [--no-follow]

Follow one compose service; the name is validated against the compose list

—

cargo xtask dev sweep-schemas [--older-than H] [--include-unmarked]

Drop leftover test_* schemas older than the evidence floor (default 6 h) and reclaim dead runs' leases (at least six hours whatever the floor)

test schemas

  • refresh versus reload: refresh may report "up to date" when its hash misses a change; when services must restart, use reload.

  • The refresh’s anti-latch check, and the matching dev status notice, compare image content, not image ids (#2598). An image store that writes BuildKit provenance attestations moves every tag to a new manifest-list digest on each build, even a fully cached one. The image a container was created from may then no longer resolve at all. Under the containerd image store the check therefore compares the platform manifest the container records (ImageManifestDescriptor) with the manifests the tag’s index lists, read from the Engine API’s unix socket with manifests=1. Under the classic store it compares both images' layers and config. A container whose tag moved to the same content is current, and a container on older content is stale (stale_app_containers, devstack_guard.rs). A container neither way can compare is named in a "could not compare" warning, in dev status and in the refresh; only a confirmed stale container fails the refresh.

  • The .devstack/ markers record the tree as it was hashed before the build, not when they are written (TreeSnapshot, devstack_guard.rs, #2594). dev start, reload, restart, dev refresh and the lane bring-up hash first and stamp those values once the stack is healthy, so a file saved while a build runs (an editor save, a branch switch mid-battery) reads stale on the next dev status or refresh instead of being recorded as built.

  • Never drive the devstack with raw docker compose: the guard threads .ports.env, the decrypted secrets and --remove-orphans through every call (xtask/src/devstack_guard.rs); a bare compose up -d applies none of them.

  • Every rebuild — dev start, reload and restart, and a refresh for any changed input, the dependency manifests, Dockerfiles, CI image, toolchain and feature set included — is the binary build (The devstack’s binaries), then one cached compose --profile <p> build ahead of the up (devstack_build_args). The images compile nothing: each copies its binaries from target/car/, so an image build takes seconds. Nothing passes --no-cache (#2593): every input is already part of a BuildKit cache key.

  • config/canopy-portal/ is baked into the portal image, so an edit there is an image rebuild; refresh and reload pick it up through the dockerfile marker (devstack_guard.rs, CONFIG_DIRS).

  • An image’s build context holds the git tree of each directory its Dockerfile copies, and nothing git ignores there (#2637). A .dockerignore pattern matches from the context root, but a .gitignore pattern with no inner slash matches at any depth, so each such pattern has a **/ form in .dockerignore and tests/e2e/.dockerignore. A local-only path, such as the policy-source cache under target/policy-cache/<jurisdiction>/, therefore never ships in an image, and a change to it never misses the COPY layer cache. A gitignored path that a build needs stays in its context through a ! line, such as tests/e2e/lib/seed.ts for the Playwright image. Key material never does (#2639). The in-network test runner reads the devstack’s signing keys from the volume canopy_integration_keys, which cargo xtask test fills before each run and the runner mounts read-only at /app/.keys. Dockerfile.integration's whole-context copy once baked them into an image layer. The build_context unit test (xtask/src/cmd/ci_config_lint/build_context.rs) reads each build’s context from the compose files, its sources from its Dockerfile, and the paths git ignores from the checkout. It fails on any copied path that the build’s ignore file neither excludes nor declares. It also fails on the converse for a build that copies its whole context (#2772): each include_str! or include_bytes! path in a Rust file the build ships must stay in its context, so the root .dockerignore, which drops docs/, re-includes the two runbooks canopy-web’s session-store tests include, and the canopy-cli reference page its drift test reads at run time, which the guard cannot see.

  • After editing devstack/clamav/*, docker volume rm canopy_clamav_db re-initialises the baked signature database (docker-compose.yml, clamav).

  • A change of PostgreSQL major needs cargo xtask dev restart: the image refuses a data volume another major wrote (Troubleshooting, "PostgreSQL exits on start after a change of major version").

  • Dev database logins. devstack/postgres/init.sql runs only on an empty volume and provisions no login. The postgres-roles compose one-shot applies devstack/postgres/roles.sql as the superuser on every compose up: dev start, reload, restart, and any refresh that brings the stack up. It runs once postgres is healthy, and canopy-reporting and canopy-security start only after it exits 0 (service_completed_successfully). The file creates each least-privilege login when it is absent and otherwise re-asserts LOGIN and the dev password, so fresh and existing volumes converge alike. To add a dev login, add its row to roles.sql and run cargo xtask dev refresh: an edit under devstack/ restarts the stack, and no dev clean is needed.

  • The configuration fetcher. canopy-config-fetch is the stack's other one-shot (Deployment Guide › Fetching configuration): every canopy service waits for its exit 0 and mounts its canopy_policy volume read-only at /app/policy. The devstack's sources are path: working copies, so it finds nothing to fetch and exits at once. Export a CANOPY_CONFIG_SOURCE naming git+ sources before cargo xtask dev reload, with their trust roots mounted at /app/config-trust, to boot the stack from fetched, verified trees.

  • A failed reconcile exits non-zero, so its dependants never start. The recovery stuck-check exempts a one-shot only when it exited with code 0 (ONE_SHOT_SERVICES, xtask/src/docker.rs). A one-shot that exited non-zero is not a port conflict, so the bring-up stops at once, without port-recovery rounds, and names postgres-roles, its exit code and cargo xtask dev logs postgres-roles --no-follow, which prints the psql error.

  • A non-zero compose up stops dev start, reload, restart and refresh before any marker is written (#2596). The only exception is the host-port casualty the recovery rounds re-sample for: a daemon bind error in compose's output, or a stuck service whose recorded host port another process holds. A recovery re-samples only the ports the error named, or that the scrub found taken. A service stuck with neither is waiting on a dependency's health check, which no re-sample fixes. compose up runs once more with no teardown, and a stack still stuck fails naming the dependencies compose reported unhealthy (#3196). The error names the failed up, and the compose output above it names the cause. Before, a failed up that left the old containers running read as a healthy bring-up and was stamped current (round_verdict, xtask/src/docker.rs).

The devstack’s binaries

The service, portal and token broker images are COPY-only (#3273, ADR-040 Amendment 7): they package what the devstack build stages under target/car/, the binary sets in bin/release/ and bin/devstack/ and the portal bundle in portal/. The images are Alpine, so the binaries are musl. A host build with --target x86_64-unknown-linux-musl needs a musl C toolchain on a glibc host (aws-lc-sys and ring compile C through x86_64-linux-musl-gcc), so the devstack builds where CI does, inside the CI image:

  • The image. Dockerfile.ci, built locally as canopy-ci/ci:<tag> the first time it is missing (about five minutes), <tag> being the pipeline's CI_IMAGE_TAG, the content address of Dockerfile.ci and rust-toolchain.toml.

  • The build. docker run of that image with the checkout mounted at its own path, as the checkout's owner, running the set's cargo build, the CLI's own and the portal's dx build themselves (no xtask in the container), in the car profile, into the checkout's target/; the host then stages the set in target/car/bin/<set>/ and the bundle in target/car/portal/. Its CARGO_HOME is target/car-home/, so it never touches the host's. A from-zero build of one set took about 11 minutes on a 32-core host; an unchanged tree builds in seconds.

  • The CLI. The operator CLI canopy is not in the set's cargo build: cargo unifies features across the packages of one invocation, and the services would switch sqlx on for it. It is built alone, cargo build --locked --timings --profile car -p canopy-cli --bin canopy --target-dir target/car-cli, and read from target/car-cli/car/canopy for both sets. Staging copies it into target/car/bin/<set>/ with the rest and then refuses it if its symbols name sqlx_core or sqlx_postgres (#3414).

  • The token broker. The release set's cargo build leaves canopy-token-broker out too, and builds it afterwards on its own (-p canopy-token-broker --bin canopy-token-broker, into the same target/car/): the broker links canopy-test-lib, which in one invocation with the services compiled every one of them against the test-helpers of canopy-auth and canopy-config (#3469). The devstack set keeps it in its one build. cargo xtask shipped-features fails if a release build resolves a test-* feature again.

  • The set. CANOPY_CARGO_FEATURES picks it and compose passes it to the Dockerfiles as CANOPY_BINARY_SET: empty (the first-run default) is the release set, canopy-api/test-clock,canopy-api/test-fault the devstack set, which the battery's journey and fault lanes need. Any other list is refused. The opt-level-0 devstack cargo profile and CANOPY_CARGO_PROFILE are gone: the devstack runs the binaries a car ships.

  • Validate. devstack-warm runs the same build in the background while the gates run, so devstack-ready finds the binaries current.

  • A build already there. When target/car/ already holds a devstack build of the tree, the devstack set packages it instead of compiling (devstack_binaries::build, #3353): every binary (the CLI read from its own build under target/car-cli/) and the portal's dx bundle newer than every file git sees (tracked, or untracked and not ignored), every service binary carrying the test surface (the /test/clock and /test/fault routes), and no binary naming glibc's loader. The token broker is not judged by the test surface: it registers neither route, and a devstack build of it has held neither string (#3476). A release build writes the same paths without the test surface, and a host build on a glibc machine names a loader the Alpine images lack, so neither is taken for one. A second dev start with nothing edited skips the CI-image build; the car compiles once and dev start packages that build.

Profiles and databases

--profile selects one of snap-only, tanf-only, medicaid-chip, caps-only, wic-only, full; --shared-db puts the five program databases on the shared Postgres instead of their own instances. isolated-db, e2e, integration, observability, devtools and idp-kanidm (the conformance Kanidm’s) are compose profile names, not --profile values. Membership per profile, the database inventory and the health endpoints: Deployment Guide.

Ports

Host ports are ephemeral: dev start reserves a free port per mapping from HOST_PORT_RANGE (21000–31999, below every OS’s dynamic client range — Linux’s starts at 32768, Windows' at 49152 — so a co-running stack’s test clients cannot take it between the reservation and compose’s bind, #3160) and writes .ports.env (CANOPY_PORT_<SVC>_<PORT>=<host>, xtask/src/docker.rs); read them from cargo xtask dev status, never from a page. Container ports are catalogued in the Service Catalog.

The devstack’s upstream

The devstack runs one upstream IdP at a time: Kanidm by default, or Keycloak or ZITADEL, the supported alternatives (ADR-049 Amendment 26; xtask/src/devstack_upstream.rs).

cargo xtask dev start --idp kanidm|keycloak|zitadel   # dev reload and dev restart take it too
  • Sticky. The choice is recorded in .devstack/upstream, and every later bring-up runs it, dev refresh and the battery’s cold start included; with none recorded, Kanidm. dev restart records it again after clearing the markers.

  • One upstream holds the name. Each upstream’s TLS terminator (kanidm, keycloak, or ZITADEL’s front zitadel) is aliased idm.canopy.test and listens on its reserved port inside the network too (.ports.env's CANOPY_PORT_KANIDM_8443, CANOPY_PORT_KEYCLOAK_8443, CANOPY_PORT_ZITADEL_8443). So the devstack CA’s leaf, the issuer’s origin and the browser specs' SPKI pin hold whichever upstream runs. Each upstream’s services are in their own compose profile (upstream-kanidm, upstream-keycloak, upstream-zitadel), outside the deployment profiles, and every bring-up removes the other upstreams' containers before it starts the chosen one.

  • Order. Kanidm starts alone, with its cast. Keycloak and ZITADEL keep their state in the shared PostgreSQL, in the keycloak and zitadel databases and logins devstack/postgres/roles.sql creates when absent. That PostgreSQL is 19, a major neither vendor lists as supported yet (Keycloak 26.8.2 and ZITADEL v4.21.0 both list 14 to 18); each one's conformance suite passes on it (#3626). They start after PostgreSQL is healthy and its role reconciliation has run, ZITADEL’s core first, then Login V2, then its front. The upstream is then provisioned, canopy-identity’s upstream profile written from its credentials, and each service’s identity secrets written, all before the stack’s up.

  • A switch writes the new upstream’s profile, clears the token broker’s cached sessions, restarts canopy-security and canopy-web on the profile, and links the cast to its seeded subjects under the new issuer (seed links).

  • The CA keeps its name. .devstack/idp/kanidm-ca.pem is the shared devstack CA, whichever upstream runs.

  • Run the battery from Kanidm. A local battery run uses the devstack as it stands, and its e2e projects other than identity-plane are written against the default: auth.spec.ts expects canopy-web’s local sign-out, which an upstream with an end-session endpoint replaces. cargo xtask identity matrix --e2e runs identity-plane on each upstream (Keycloak’s and ZITADEL’s conformance graphs, and the identity matrix).

Upstream IdP: Kanidm

kanidm is Kanidm 1.12.2, the default upstream (ADR-050), built from the release tarball on Alpine by devstack/kanidm/Dockerfile (ADR-049 Amendment 11). canopy-web signs its workers in through it, and so does canopy-test-lib’s token broker (Testing › the token broker). The devstack’s upstream runs Keycloak or ZITADEL in its place.

  • One issuer string everywhere. The origin is https://idm.canopy.test:<P>;, P being the port .ports.env records as CANOPY_PORT_KANIDM_8443 (8443 only names the mapping). Kanidm listens on P inside the compose network too, and the network resolves idm.canopy.test to it, so the same URL names it inside the network and on the host. A client outside the network pins the name to the published address, which .ports.env records for the host lanes as CANOPY_TEST__UPSTREAM_ADDR (<docker host>:<P>: loopback, or a tcp:// DOCKER_HOST's host on CI); a test needs no hosts-file entry (curl --resolve idm.canopy.test:<P>:127.0.0.1 --cacert .devstack/idp/kanidm-ca.pem https://idm.canopy.test:<P>/status), though a browser does (canopy-web’s origin and the ingress). It is published on every interface, as most devstack services are, so it is also reachable on CI’s Docker-in-Docker daemon.

  • TLS. Before every bring-up xtask generates, when any file is absent or a certificate is within 30 days of expiry, a devstack CA and the two leaves it signs in the same pass (all valid 365 days; the CA key is never written, so a leaf added later needs a new CA, xtask/src/devstack_tls.rs): Kanidm’s for idm.canopy.test (.devstack/idp/tls/chain.pem, key.pem, 0600) and the ingress’s for web.canopy.test and web.canopy-xsite.test (.devstack/web/tls/chain.pem, key.pem, 0600), with the CA alone in .devstack/idp/kanidm-ca.pem. They are built under x509-cert’s CA/Browser Forum root and TLS subscriber profiles: the CA is CN=canopy devstack CA,O=canopy,C=US, and each leaf is for server authentication alone. It copies Kanidm’s chain and key into the kanidm-tls volume through a one-off kanidm container, and the ingress’s with its nginx template into the ingress volume through a one-off ingress container. A regenerated set restarts kanidm, canopy-security, canopy-web and both ingresses once the stack is healthy; a marker (.devstack/idp/tls/restart-pending) keeps that restart owed until it succeeds, so a failed one is retried by the next bring-up.

  • State. The database is the canopy_kanidm_data volume, so a restart keeps it; dev restart and dev clean --confirm remove it.

  • The cast (devstack/kanidm/migrations/00-canopy.hjson, ADR-049 Amendment 11): 20 persons, the devstack’s worker personas plus sec.admin, its first security administrator; applicants have no IdP account. The usernames are the retired Keycloak realm’s, except canopy.admin for its admin, which Kanidm reserves. Roles and programs are groups (11 canopy_role_* groups, 6 canopy_program_* groups, chip included), projected into the id_token by the canopy-web client’s claim maps. fti.auditor and data.steward hold five programs (canopy-identity refuses a federation with none), and jane.unscoped is programless, the refusal fixture.

  • The issuer’s configuration (ADR-049 Amendment 11). The devstack canopy-security’s canopy-identity issuer gets a generated client registry and upstream profile, which the repository never ships. Before every bring-up xtask writes .devstack/identity/: an ES256 key per confidential client under keys/ (owner-only, generated once and kept), identity-clients.yaml registering each key’s public half, identity-upstream.yaml (the kanidm profile for the current Kanidm port) and identity-upstream-ca.pem (the devstack CA). Compose mounts the last three read-only into canopy-security, which reads them at boot; a port that moves during the bring-up rewrites the profile and restarts canopy-security and canopy-web, and a regenerated CA restarts them with Kanidm. Each confidential client’s service gets its key through .devstack/identity/env/<client>.env (owner-only), which docker-compose.yml names as its env_file (required: false); canopy-web’s also carries its Kanidm client secret. A file rather than an interpolated variable, so every compose call, a run that starts dependencies included, computes the same environment.

  • Checking the issuer (ADR-049 Amendment 23). canopy-identity’s deploy gate is canopy-manage identity check, which has no devstack default: canopy-manage against the devstack gives the command line (IdP integration › Gating a deploy).

  • Provisioning. After every bring-up, and on demand with cargo xtask dev identity, xtask provisions what a migration cannot assert: each person’s random password and TOTP, and the canopy-web client secret. They go only into .devstack/idp/kanidm.json (mode 0600), with the SHA-256 of the cast file. Every bring-up also registers the canopy-web client’s redirects, each of canopy-web’s public origins' /auth/callback at the ingresses' ports, over REST as idm_admin, and records them in the file: the cast file declares none, because Kanidm re-applies it at every start and the ports are allocated. Provisioning starts from an empty data volume, because an enrolled person refuses a second TOTP, and runs only when the file is absent or unreadable, records another cast’s digest, or its idm_admin password no longer signs in (a down -v emptied the volume). When only the server’s port moved, the file’s origin and port are rewritten. A steady-state bring-up signs idm_admin in to re-register the redirects (sending nothing when they are in place) and rewrites the file only when its address or redirects changed. From a CI job container xtask reaches the server on the Docker-in-Docker daemon’s host (DOCKER_HOST), not loopback.

  • Seed links (ADR-049 §8, Amendment 11). The seed keys its households on fixed worker ids, the retired realm’s (SeedPerson::realm_subject(): jane.caseworker’s 00000000-0000-0000-0000-00000000000a, bob.smith’s …0002), and each cast person’s Kanidm id is that id with the fourth group 0001. So provisioning ends by signing sec.admin in through the token broker, stepped up, and, for every other cast person whose Kanidm pair does not already open as its realm id, creating the canopy subject at the realm id and linking the pair to it: two audited security-admin writes each (POST /identity/admin/subjects, POST /identity/admin/links). A cast worker’s delegation token then carries its realm id as sub. A linked cast is only read, and a 429 from the admin routes' 60-a-minute limit waits a second before the request is sent again. dev start, reload and restart sample new ports, which moves Kanidm’s port and so its issuer, so each links the cast again under the new issuer, and the links under earlier ones stay inert; the battery’s refresh keeps the ports and only reads. Right after canopy-security boots, the first call waits up to a minute for the issuer’s first signing key.

  • The device flow (ADR-049 §7, Amendment 21). canopy-security serves RFC 8628’s device authorization and code entry, its CANOPY_SECURITY__IDENTITY_DEVICE_VERIFICATION_URI set to https://web.canopy.test:<W>/device, at canopy-web’s public origin. canopy login prints that URI and a user code; the worker approves at canopy-web’s /device (services/canopy-web/src/device.rs), signing in again through Kanidm for the step-up. The battery approves through the same grants (Testing › the token broker).

  • Bring-ups. These steps run around every up that starts or recreates the devstack: dev start, reload, restart and refresh, and the cold start and refresh cargo xtask test, e2e and CI take (xtask/src/devstack_identity.rs). They are staged: the files first, then Kanidm alone with its cast, canopy-web’s redirects and the services' env files, then the stack’s up, then the restarts, a second redirect check on the ports the stack actually bound, and the seed links. canopy-web needs its Kanidm client secret at boot, and Kanidm mints it only when its migration creates the client, so the stack starts only after it is written; a re-provisioned cast’s new secret changes canopy-web’s env file, and the stack’s up recreates canopy-web on it. An edit under devstack/kanidm/ marks the infrastructure stale, so the next refresh recreates the service.

  • The first build compiles Kanidm’s server workspace from source with thin LTO: 11-12 minutes on a 32-thread workstation, with a final link that needs several GB of memory. Later bring-ups reuse the image.

canopy-web’s origin and the ingress

canopy-web’s public origin is https://web.canopy.test:<W>;, W being the port .ports.env records as CANOPY_PORT_INGRESS_443, and canopy-identity’s issuer identifier is its /identity (ADR-049 Amendment 22). canopy-web publishes no port of its own: the ingress is its one host entrance, so there is no http://localhost:<port>; worker portal and no CANOPY_PORT_CANOPY_WEB_8080.

  • The ingress. The ingress service, the upstream nginx-unprivileged image pinned by digest and never built, terminates TLS with the devstack CA’s ingress leaf and proxies to canopy-web. Like Kanidm it listens on its reserved port inside the network too, under the alias web.canopy.test, so one origin holds on the host and in the network. It overwrites X-Forwarded-For with the peer, never appending (devstack/ingress/default.conf.template), and resolves canopy-web per request, so a recreated canopy-web is reached at once. ingress-xsite does the same for web.canopy-xsite.test in front of canopy-web-xsite, on CANOPY_PORT_INGRESS_XSITE_443, in every profile, so that origin’s port, and its registered redirect, hold when no e2e run is up; without canopy-web-xsite it answers 502. The network alias web.canopy-xsite.test is ingress-xsite's, so in the network, as on the host, the name reaches the instance only over TLS.

  • Moving ports. dev start, reload and restart sample new ports, which moves canopy-web’s origin and so the issuer identifier: services are recreated on the new value, tokens minted under the old one are refused and minted again, and canopy-cli signs in again.

  • A browser on the host needs the names and the CA: add 127.0.0.1 web.canopy.test web.canopy-xsite.test idm.canopy.test to the hosts file, and trust .devstack/idp/kanidm-ca.pem (or accept the warning once per name). cargo xtask dev start and dev status print both and name the origin. Sign-in goes past the AC-8 notice to the upstream’s own pages; a cast person’s password and TOTP secret are in the upstream’s credentials file, .devstack/idp/kanidm.json, keycloak.json or zitadel.json.

  • Tests reach it as the test inputs name it: CANOPY_TESTWEB_ORIGIN, CANOPY_TESTXSITE_ORIGIN and, for a client outside the network, CANOPY_TEST__WEB_ADDR (the docker host’s publication, or the ingress in the network), which canopy_test_lib::web_origin::web_client pins the name to, trusting the devstack CA alone; TestConfig.web_url is the same origin. The Playwright battery reaches both origins from canopy-e2e through the ingresses' aliases, Node trusting the devstack CA and Chromium pinning the ingress leaf (Testing › Signing the battery in).

The conformance server

The Kanidm conformance suite runs against a disposable server of its own, the kanidm-conformance service in the compose profile idp-kanidm. No --profile value and no CI job starts it; port discovery skips it (OPT_IN_SERVICES, xtask/src/docker.rs). Its files and volume share no name with the devstack kanidm's, so a run leaves the devstack untouched. One command stands it up from nothing:

cargo xtask identity conformance --idp kanidm [--keep]
  1. Builds the image, timing the build.

  2. Removes the previous run’s container, then its kanidm-conformance-tls volume.

  3. Runs kanidmd cert-generate in a one-off container: a fresh CA, and a 5-day leaf whose only SAN is idm.canopy.test.

  4. Starts the service on a fresh ephemeral loopback port and waits for its health check.

  5. Copies the public CA to .devstack/idp/kanidm-conformance-ca.pem.

  6. Recovers idm_admin (kanidmd scripting recover-account).

  7. Reads every migrated entry back over REST (devstack/kanidm/migrations/00-canopy.hjson; Kanidm only logs a failed migration), gives each person a random password and a TOTP, and reads the canopy-web client secret (canopy_test_lib::upstream::kanidm::admin).

  8. Writes the origin, CA path, port, client credentials, the idm_admin password and each person’s credentials to .devstack/idp/kanidm-conformance.json, mode 0600.

  9. Lints the Kanidm conformance suite (crates/canopy-test-lib/tests/idp_conformance_kanidm.rs, feature canopy-test-lib/idp-conformance), then runs it alone (--test idp_conformance_kanidm, nextest profile idp-conformance, one test at a time) with CANOPY_IDP_CONFORMANCE__CREDENTIALS naming the file. Its JUnit, test-results/integration/idp-conformance.xml, holds only this suite. A failure stops the run here and leaves the service up.

  10. Removes the service’s container unless --keep is given (then the next run removes it), and prints this run’s build time, the latest cold and warm build times, and the image size.

    • It prints no secret: passwords, TOTP seeds and the client secret go only into the 0600 file.

    • A --keep or failed run leaves the container in the devstack’s compose project (a failed one as the failing step found it); dev start, dev refresh and the health wait ignore it (OPT_IN_SERVICES).

    • The database is a tmpfs, so every start is empty.

    • The suite signs in headlessly over Kanidm’s JSON API (canopy_test_lib::upstream::kanidm::login), and its cases every upstream shares are crates/canopy-test-lib/tests/idp_conformance/cases.rs. Every battery build compiles it (lanes::BATTERY_FEATURES, #3343), and clippy lints it, but no lane runs it: INTEG_FILTER leaves the conformance suites out.

    • dev clean --confirm also removes the kanidm-conformance container and its TLS volume.

Upstream IdP: Keycloak

cargo xtask dev start --idp keycloak runs keycloak: Keycloak 26.8.2 on alpine:3.24 with OpenJDK 21, from the release tarball (devstack/keycloak/Dockerfile; ADR-049 Amendment 26; ADR-050 Amendment 5).

  • The realm is a template with no secrets, devstack/keycloak/realm.json: realm canopy, an ES256 key, TOTP (HmacSHA256, 6 digits, 30 s), the canopy-browser flow whose OTP form every user must pass, CONFIGURE_TOTP disabled, and the canopy-web client with the canopy scope’s roles and primary_programs mappers. Only the devstack’s realm accepts a TOTP code more than once a step (otpPolicyCodeReusable), because the harness signs a person in many times a step; a deployment keeps Keycloak’s single-use default.

  • Secrets. Keycloak’s bootstrap administrator is generated into .devstack/identity/env/keycloak.env (0600), which compose names as its env_file. Provisioning creates the realm over the admin REST API, then the cast’s users with their passwords and OTP credentials, and reads the client secret. Everything goes only into .devstack/idp/keycloak.json (0600).

  • When it provisions. When the credentials file is absent or unreadable, records another cast’s digest, or the realm is gone. When the administrator no longer signs in, Keycloak’s database is emptied first. A steady-state bring-up registers canopy-web’s origins at the ingresses' ports, rewriting the file when they or Keycloak’s address moved.

  • Ids. A cast person’s Keycloak id is its cast UUID with the fourth group 0002, and the seed links map it to its realm id as Kanidm’s are.

Upstream IdP: ZITADEL

cargo xtask dev start --idp zitadel runs three services: zitadel-core (ZITADEL v4.21.0 on alpine:3.24), zitadel-login (Login V2 on node:26-alpine) and the front zitadel (the nginx-unprivileged image, TLS for idm.canopy.test, routing /ui/v2/login to Login V2 and the rest to the core; ADR-049 Amendment 26; ADR-050 Amendment 6).

  • First instance. The core runs zitadel init zitadel, then start-from-setup, as its own database login, and creates its first instance on an empty database with Login V2 and forced MFA (ForceMFALocalOnly, baked into its image). It writes the provisioner’s token into the zitadel-provisioner volume (0700, the core’s alone), and Login V2’s into zitadel-bootstrap (0750, the core’s group), which Login V2 reads through group_add. Login V2’s token is a credential of the IdP (AL4).

  • Secrets. The masterkey and first administrator’s password go into .devstack/identity/env/zitadel-core.env, and Login V2’s cookie secret into zitadel-login.env (each 0600). The masterkey must outlive the database it encrypts: dev restart and dev clean remove both together.

  • Provisioning over the v2 APIs: the project with its role assertion, canopy’s roles and program_* keys, the canopy-web application with its id_token assertions, redirects and post-logout redirects, the cast’s users with passwords and TOTP seeds, and their grants. The application’s secret is shown once, so an instance holding canopy’s project that .devstack/idp/zitadel.json does not record is reset (its database and token volumes emptied) and provisioned again. A steady-state bring-up registers canopy-web’s origins and Login V2’s base at the current ports.

  • Ids. A cast person’s ZITADEL id is its cast UUID with the fourth group 0003.

Keycloak’s and ZITADEL’s conformance graphs, and the identity matrix

cargo xtask identity conformance --idp keycloak|zitadel runs a vendor’s suite against a disposable graph of its own, as Kanidm’s does (ADR-049 Amendment 26). Keycloak’s graph is keycloak-conformance (profile idp-keycloak); ZITADEL’s is zitadel-conformance-core, zitadel-conformance-login and the front zitadel-conformance (profile idp-zitadel). Both use idp-conformance-postgres, whose database is a tmpfs. Each run:

  1. removes and recreates the graph, the PostgreSQL container included;

  2. issues a throwaway CA and leaf from xtask’s TLS generator (.devstack/idp/<idp>-conformance/);

  3. starts the graph on fresh ephemeral ports, published on every interface and reached at the docker host, so a Docker-in-Docker job reaches it;

  4. provisions it, writing .devstack/idp/<idp>-conformance.json (0600);

  5. runs the suite (idp_conformance_keycloak.rs or idp_conformance_zitadel.rs, nextest profile idp-conformance);

  6. removes the graph, pass or fail, unless --keep.

ZITADEL’s suite takes about five minutes: its driver waits out spent TOTP steps, and one case waits out canopy-web’s 60 s auth_time leeway.

cargo xtask identity matrix runs all three suites (ADR-049 Amendment 26):

  • From a push spec. Without --all it reads a push spec on stdin, in git's pre-push form (<local ref> <local sha> <remote ref> <remote sha> per line); the pre-push hook no longer runs it. Each pushed ref is ranged from the remote’s sha, or from its merge base with origin/main when it is new or the remote’s sha is not in the clone. When a range changes a file under IDENTITY_PATHS (xtask/src/cmd/identity/matrix.rs: the upstream profile and harness, the token broker, the upstreams' images and databases, docker-compose.yml, the devstack’s upstream and TLS code, the identity commands and .config/nextest.toml), every suite runs; otherwise none does.

  • --all runs them whatever the push. The car's last line feeds a merge request's range (CI_MERGE_REQUEST_DIFF_BASE_SHA..CI_COMMIT_SHA) as a push spec, and runs --all on a pipeline with no merge request. Under CANOPY_CI=true each conformance run joins the job container to the compose network and reaches its upstream by service name. The car passes --cargo-profile car, so each suite runs from the car's one build and compiles nothing (#3358).

  • --e2e also brings the devstack up on each upstream in turn and runs Playwright’s identity-plane project, then restores the devstack’s upstream. Run cargo xtask identity matrix --all --e2e on a release commit before tagging (Deployment Guide › Release).

  • Every suite runs, pass or fail, and the command fails naming each that failed. Each suite’s JUnit is kept as test-results/integration/idp-conformance-<idp>.xml.

Feature builds and the battery’s standing requirement

The battery’s bare cargo xtask e2e needs the full profile and the battery’s feature set, canopy-api/test-clock,canopy-api/test-fault: the clock lane (the journey specs and the clock-guarded worker specs) needs the test-clock build and the fault lane the test-fault build, and both are blocking lanes (Testing › The E2E battery and the journey-lane gate). Set it once — the feature set is sticky in .devstack/features across refreshes (xtask/src/devstack_guard.rs):

CANOPY_CARGO_FEATURES=canopy-api/test-clock,canopy-api/test-fault cargo xtask dev reload   # opt out: CANOPY_CARGO_FEATURES= cargo xtask dev reload

A battery on a devstack without either feature fails before the suite, naming the feature and this command; a fault or clock-lane spec that still skips fails the battery after it (#2602). An explicit CANOPY_CARGO_FEATURES replaces the sticky set rather than adding to it, so a reload names the whole set.

--profile snap-only remains fine for targeted iteration (cargo xtask e2e --devstack-profile snap-only), just not for the battery.

The cross-site sign-in instance

docker-compose.yml carries canopy-web-xsite, a second canopy-web for the e2e run only (compose profile e2e, #2509). It has canopy-web’s image, environment and database, except CANOPY_WEB__PUBLIC_ORIGIN, its own origin, https://web.canopy-xsite.test:<port>;, served by the ingress-xsite TLS proxy, which holds the web.canopy-xsite.test alias.

  • Why. canopy-web’s origin, web.canopy.test, shares its registrable domain with Kanidm’s idm.canopy.test, so the default sign-in is same-site. canopy-web-xsite is reached as web.canopy-xsite.test, another registrable domain, so Kanidm’s return to its callback is cross-site, as a hosted IdP’s is (IdP Integration › Cross-site IdPs). tests/e2e/specs/auth-cross-site.spec.ts and the @identity spec sign in through it.

  • Reach. The alias resolves only on the compose network; from the host, ingress-xsite's published port reaches it. canopy-web-xsite itself publishes no host port.

  • Lifecycle. cargo xtask e2e builds it with canopy-e2e (it shares canopy-web’s build anchor, so the build reuses the devstack build’s layers), canopy-e2e's depends_on starts it and waits for its health check, and the run removes it afterwards, pass or fail. No --profile value starts it, and dev start and dev refresh never build it. A run interrupted mid-suite leaves it running, because compose’s down and stop act only on services of an active profile: dev stop, dev reload, dev restart and a refresh’s down therefore remove it by name first (docker::remove_e2e_only_services, xtask/src/docker.rs), dev clean --confirm activates the e2e profile, and the next e2e run replaces it.

The token broker service

docker-compose.yml carries canopy-token-broker, canopy-test-lib’s token broker served over HTTP to the e2e and k6 harnesses (compose profile e2e; ADR-049 Amendment 24). Its image is tools/canopy-token-broker/Dockerfile: Alpine, the broker's binary copied from target/car/bin/<set>/, running as app (uid 1000) with a health check on /healthz, and never built by the root Dockerfile. Its routes are Testing › The token broker service.

  • Reach. It listens on 8099 on the compose network only and publishes no host port. It authenticates no caller, so that network is its boundary.

  • Inputs. It mounts canopy-integration's volumes: canopy_identity_inputs read-only (the upstream’s credentials, the devstack CA and every confidential client’s key, which xtask installs) and canopy_identity_broker_cache, the session cache. The in-network runner and the service therefore share one cache’s sessions and sign-in spacing. Its filesystem is otherwise read-only, and it writes no core dump.

  • Logs. It installs no log subscriber (an ADR-041 tool, not a deployed service), so nothing it traces is written. Its health is /healthz, a failed start is its exit, and a failed request’s answer is its response body.

  • Lifecycle. Each run that brings it up (every e2e run, since auth-setup and the given helpers sign in through it, and every k6 perf run) first packages its image from the devstack's binary set (the input install's run --build; the broker is built with the services, The devstack’s binaries), since the fleet’s refresh never builds it. On CI the build job packages and pushes it with the shared images, and the stack jobs pull it (#3273). An e2e teardown, a devstack teardown and dev clean remove it with the other e2e-only services.

The transport fault layer

docker-compose.yml carries toxiproxy, a Toxiproxy 2.13.0 server (compose profile fault; chaos plan U3, #1591). It is the devstack's transport lever: a contested-environment test dials one of its standing mirrors in place of the real service, then severs the mirror or poisons it. EvilLayer answers at the HTTP layer and cannot cut a socket or leave one open and silent; this can.

  • Opt-in. No cargo xtask dev profile starts it, and no canopy service is configured through a mirror. cargo xtask fault-preflight --up starts it on a running devstack, and so does the fault lane, cargo xtask test --fault --no-refresh, before it runs the tests that use it.

  • Mirrors. rabbitmq (the broker's AMQP port), postgres (the shared instance) and idp (the upstream the devstack runs, The devstack’s upstream). The preflight creates them; they last as long as the container.

  • Ports. Fixed, and published on loopback only, because the control API is unauthenticated and can proxy to any address: the API on 18474, the mirrors on 18475 (rabbitmq), 18476 (postgres) and 18477 (idp). Inside the compose network the same four are toxiproxy:8474 to toxiproxy:8477. canopy_test_lib::toxiproxy holds the numbers, and a test pins them to the compose file.

  • The preflight. cargo xtask fault-preflight holds the server to the pinned version, refuses a toxic or a severance an earlier test left behind, and proves each mirror: the real service answers through it, does not while it is severed, and answers again once restored. A layer that is not running passes with a report; --required makes that a failure (CANNOT-RUN), which is what a lane that needs the layer passes. --up recreates the container, which clears every fault.

  • The client. canopy_test_lib::toxiproxy: FaultLayer::from_env() gives the control client and each mirror's address (loopback on the host; the name in CANOPY_TEST__TOXIPROXY_HOST inside the network). poison and sever return a guard released by an awaited restore(). A guard dropped unreleased fails the test that dropped it, since the fault would otherwise reach every later test on that mirror.

  • Teardown. Every devstack down or stop removes the container first: dev stop, reload, restart and clean, a dev refresh that wipes volumes or follows a compose change, and a bring-up's port-conflict recovery. None restarts it; a refresh that only rebuilds images leaves it running.

canopy-manage against the devstack

canopy-manage has no devstack default (canopy-manage Reference): a developer gives it what an operator would. To apply a service’s migrations to its devstack database, from the checkout:

set -a; . ./.ports.env; set +a
CANOPY_ENV=development \
CANOPY_MIGRATE__DATABASE_URL="postgres://canopy:canopy@localhost:${CANOPY_PORT_POSTGRES_5432}/canopy_exchange" \
  cargo run -p canopy-manage -- migrate apply --service canopy-exchange

CANOPY_ENV=development admits the devstack’s plaintext connection. A program service with a database instance of its own is on that instance’s port in .ports.env, and a sealing service also needs CANOPY_ENCRYPTION_KEY. Nothing in the devstack needs this: every service applies its own migrations at boot.

To run canopy-identity’s deploy gate against the devstack, as canopy-eligibility:

set -a; . ./.ports.env; set +a
CANOPY_ENV=development \
CANOPY_ELIGIBILITY__IDENTITY_CLIENT_PRIVATE_KEY="$(cat .devstack/identity/keys/canopy-eligibility.pem)" \
  cargo run -p canopy-manage -- identity check \
    --issuer "https://web.canopy.test:${CANOPY_PORT_INGRESS_443}/identity" \
    --internal "http://localhost:${CANOPY_PORT_CANOPY_SECURITY_8012}/identity"

CANOPY_ENV=development admits the plain http internal URL. The key is the one the bring-up wrote for that client; the gate reads it only from the variable.

Seed data

cargo xtask seed [--seed <u64>] [--households <n>] [--jurisdiction <name>]   # defaults: random seed, 50, georgia
cargo xtask seed --manifest-only                                             # fresh checkout: write the e2e manifest so `npm run typecheck` works; keeps an existing one
cargo xtask seed-verify                                                      # cross-service integrity check

Without --seed the chosen seed is stamped to test-results/seed/last.txt for replay (xtask/src/cmd/seed.rs, DEFAULT_HOUSEHOLDS); there is no --reset flag. --jurisdiction names a pack under target/config/ or fixtures/config/; xtask hands canopy-seed that pack’s layer stack as --config-source with --config-allow-unverified (xtask/src/config_layers.rs). dev refresh reseeds when the seed marker (seed source, anything under fixtures/config/, or a pin in config-sources.lock) is stale. The replay contract: Testing › the canopy-seed harness.

Switching packs

The devstack boots every service on the federal and Georgia configuration repositories at the commits config-sources.lock pins: compose defaults CANOPY_CONFIG_SOURCE to them, the canopy-config-fetch one-shot fetches and verifies them against ci/config-trust/ into the canopy_policy volume, and every service reads that tree (Configuration Reference › Configuration source). rulesets/ is no longer part of this repository. To boot the whole stack on another pack, export CANOPY_CONFIG_SOURCE before cargo xtask dev reload; compose merges it into every service (x-canopy-shared-env in docker-compose.yml). A fixture pack is path: working copies, baked under /app/fixtures/config/, so it also needs CANOPY_CONFIG_ALLOW_UNVERIFIED=true; it ships no notices, so list the neutral notices layer beneath it:

export CANOPY_CONFIG_SOURCE=test-federal=path:fixtures/config/test-federal,notices-neutral=path:fixtures/config/notices-neutral,test-min=path:fixtures/config/test-min
export CANOPY_CONFIG_ALLOW_UNVERIFIED=true
cargo xtask dev reload
cargo xtask seed --jurisdiction test-min

Unset both (or set them empty) and reload to return to Georgia. To try an edit to the federal or Georgia layer, clone its repository and name the clone as a path: source the same way. The seed’s --jurisdiction and cargo xtask e2e --jurisdiction select the pack the seed and the tests read, not the one the services boot on, so keep them in step with the exported source. The scheduled fixture-smoke lane does the same: each of its packs exports its layer stack as CANOPY_CONFIG_SOURCE (a lanes.rs test holds each to config_layers) and passes the pack to e2e --jurisdiction.

Devstack-aggressive worker cadences

docker-compose.yml sets shortened poll and tick intervals for the devstack only (grep it for #1367); production defaults are unchanged. The knob domains are in Configuration Reference; what the in-process test workers receive is Testing › In-process worker cadences. Tune a cadence, never a test tolerance.

Container memory bounds

clamav carries an explicit mem_limit in docker-compose.yml; nothing else does, and that asymmetry is deliberate. A JVM or a signature-database service left unbounded reads the host’s RAM through the container, and its own ergonomics then size against a number the container will never be allowed to use: the retired devstack Keycloak’s JVM claimed a ~65 GiB heap ceiling for a ~1.3 GiB working set on a 94 GiB workstation, and a host with swap enabled paged the cold heap out (#1874). A memswap_limit equal to the mem_limit is the cgroup-v2 spelling of "this container never swaps" (the v1-only mem_swappiness key is ignored under cgroup v2).

Check any container the same way — resident against swapped, from the host:

grep -E 'VmRSS|VmSwap' /proc/$(docker inspect -f '{{.State.Pid}}' canopy-clamav-1)/status

A non-trivial VmSwap on a box with free RAM is the signature; add a bound to that service rather than widening a timeout downstream of it.

Running the car's lines locally

The merge train's car is one job whose script is the commands a developer types (car in .gitlab-ci.yml, #3354): the .lints block (cargo fmt --check, then one cargo xtask verb per gate validate runs before the devstack), one cargo build --locked --profile car --workspace --all-targets --features "$BATTERY_FEATURES", the CLI's own build (The devstack’s binaries) and the portal's dx build, cargo xtask dev start (which packages that build, The devstack’s binaries), then the lanes against the stack. Any line runs the same on your machine; copy it from the file. xtask has no ci verb: the pipeline calls the verbs, and xtask serves the developer (CI vs local).

cargo xtask validate            # optional: the fuller local loop (the same gates, then the lanes); nothing requires it
cargo xtask doctor              # this machine: tools, repository visibility, commit signing

Docker Hub images come from docker.io unless CANOPY_HUB names another registry prefix (a pull-through proxy or mirror): compose's images, every Dockerfile's Docker Hub FROM (as the CANOPY_HUB build argument), BuildKit and k6 all read it, and CI sets it to GitLab's Dependency Proxy (#3257).

Per-crate test lanes

Run one crate’s tests through the battery’s own path, not a bare cargo nextest run -p against the devstack, which leaves test_* schemas behind until the sweep’s evidence floor (xtask/src/cmd/test.rs):

cargo xtask test --unit -p <crate>
cargo xtask test --integration --host --no-refresh --skip-static -p <crate>   # add --run-ignored for #[ignore] tests

Flags, lanes and the schema sweep: Testing.

The battery’s offline gates

cargo xtask validate --offline runs every stage of the battery that needs no devstack, in the battery's order and with its arguments, and stops at the first failure as the battery does (#2481):

  • the preconditions and the static gates;

  • fmt, deny, machete, workspace clippy and the feature builds;

  • the policy, coverage and scenario audits;

  • the test build, the lane-partition check and the unit lane;

  • the rustdoc pass and the doctests.

Each live-only stage is recorded as a skip at its position in test-results/validate-report.json:

  • the port reconcile and the secrets decrypt;

  • the devstack stages and api-docs;

  • the live lane, its schema sweep and the test report;

  • the docker build.

Those stages are listed in xtask/src/validate_report.rs (LIVE_ONLY), beside the battery's inventory, so the two cannot drift.

The run ends by printing the per-crate integration command for the crates the branch touches (against the merge base with origin/main, committed or not), to run against a devstack if you want the live lane locally. --crates a,b names the crates instead.

The offline run needs no docker daemon, so it also runs from a git worktree with no devstack. A green offline run leaves only the live lane, api-docs and e2e for the merge train's pipeline to find once #3245 lands it.

Where a push’s time goes

The pre-push hook ends with each step’s wall time and the total, on stderr under === pre-push: step timings ===, whether it passed or failed (#3008). A local cargo xtask validate records each stage’s duration_ms in test-results/validate-report.json, and cargo xtask e2e prints its five slowest specs under e2e: slowest specs after Playwright. Detail: Testing › What git push runs.

Next

Edit this page · default