Plan: Measure the release images

Status

Done (2026-11-27) — dev start --release takes --replicas and --bake; perf-load and perf-stress bake and measure their own commit’s release images; perf --profile identity --procedure runs the whole capacity procedure on release stacks it starts, and the manual issuer-capacity job runs it in CI. Its first run (#2744, note 4336697782): C ≥ 810/s on one replica, so R = 3; G6 fails at R − 1 (#3151), and G3 fails under a kill (#3152) and through rolling restarts (#3169). #3157 waits on its verdict run of the perf jobs on main.

Closes: #3166. Relates to: #3157 (closed by its verdict run, see Delivery), #2744, #3151, #3152, #3020.
Tree: main at bc6a966d4, where .gitlab-ci.yml is 489 lines (#3165 removed the triage job).
Rulings (maintainer, 2026-11-26): the perf jobs build optimized and their p95 limits stand as SLOs (#3157); the issuer capacity runs move to a manual CI job on the 4xlarge runner, a fresh VM each (#3166); both measure the shipped release images, not a release-profile copy of the devstack build; one xtask command runs the whole capacity procedure and computes R itself.

Context

perf-load and perf-stress (.gitlab-ci.yml) start their stack with xtask dev start, the devstack cargo profile: opt-level 0, with the test-only authz-witness feature (xtask/src/lanes.rs). Six read endpoints miss their p95 limits on it (tests/k6/scenarios/load.js), and no deployment runs that build.

The issuer capacity experiment (cargo xtask perf --profile identity, deployment-guide.adoc § Identity capacity) has only been run on luchs beside other sessions. One capacity cell gave 810/s twice and 155/s once, and the harness’s validity gate does not see disk pressure (#3020), so no reading so far is trusted. #3151 (the issuer pool at its ceiling) and #3152 (requests lost at a killed replica) hold the v0.5.0 cut and both need a trusted reading.

The release stack already exists. release-build bakes docker-bake.hcl’s `release group (release profile, the shipped features) and its local release-stack side images, starts the stack on them with xtask dev start --release, and runs the k6 smoke. On 2026-11-23 the two bakes took 16 minutes and the start 3. What is missing:

  • dev start --release refuses --replicas (xtask/src/cmd/dev.rs), which every capacity cell needs;

  • the bakes are two hand-written docker buildx lines that only release-build is allowed to carry (xtask/src/pipeline_tests.rs JOB_LINES);

  • the capacity procedure is a list of commands in the deployment guide whose later steps take R, which the first step prints. A CI job’s lines are xtask verbs, so no line can carry R to the next.

Scope

In:

  1. dev start --release takes --replicas, and --bake builds the release images first.

  2. perf-load and perf-stress run on the release images of their commit.

  3. perf --profile identity --procedure: the whole capacity procedure on release images, R read from the first step.

  4. A manual issuer-capacity job on main and on merge requests.

Out: pentest (stays on the devstack build; #3158 is decided after 2026-11-30); the k6 limits themselves; any fix to #3151 or #3152; the harness’s blind spot for disk pressure (#3020), which the summary’s host readings only expose; and `release-build’s container logs, which it does not keep today (#3167).

Design

D1. One command for the release stack

DevCommand::Start (xtask/src/cmd/dev.rs):

  • --release no longer conflicts with --replicas. devstack::start_release takes the replicas and builds its --scale arguments as bring_up_with_scenarios does (one shared helper), enabling the scale layer (docker-compose.scale.yml) when there are any. It still conflicts with --force and --no-cache.

  • --bake (requires --release): after the Dependency Proxy login and the registry-mirror staging the handler already does, run the two bakes, then start. The argv lives in xtask/src/bake.rs, release_bake_argv(group, load, cargo_home): buildx bake, --allow=fs.read=<CARGO_HOME>/registry when CARGO_HOME is set and not empty, --file docker-bake.hcl, the group, and --load for release only. They are the two lines release-build runs, and a pipeline test holds the YAML’s lines to this argv. Each runs through registry_retry::run, as the devstack’s image builds do.

  • CRAIG_IMAGE_TAG stays required in the environment, as --release requires it today (docker::release_tag_from): compose reads it on every later verb against the stack, so a flag could not stand in for it.

D2. The perf jobs

In .gitlab-ci.yml:

  • a hidden .release-stack: {stage: scan, variables: {CRAIG_IMAGE_TAG: $CI_COMMIT_SHORT_SHA}};

  • perf-load and perf-stress extend [.scheduled-stack, .release-stack], drop their own stage: scan, and their first script line becomes xtask dev start --release --bake. Their verbs, artifacts and rules are unchanged.

With D4’s job the file ends at 497 lines, under its bound (MAX_PIPELINE_LINES, fewer than 500).

Each job bakes its own images, about 16 minutes more than today’s dev start. Pulling the images release-build pushed would save little (the side images are never pushed, and building them compiles the builder stage anyway) and would tie the perf jobs to that job’s schedule rule and to its success.

D3. The procedure command

cargo xtask perf --profile identity --procedure [--steps <step>,…​] [--r <N>], with the existing --window-secs, --warmup-secs, --seed and --archive-rate passed through to every cell. It refuses --cell and --replicas. New module xtask/src/cmd/perf/identity/procedure.rs.

Where it runs. perf re-executes in craig-tools on the project network (main.rs runs_on_the_devstack_network). The procedure wipes and restarts that network, so it runs on the host: runs_on_the_devstack_network answers false for it, as it does for a diag that dials nothing. It runs each start and each cell as a child process of its own binary (std::env::current_exe), and each child re-executes as it does today.

Steps, in this order; --steps picks a subset, the default is all:

Step Replicas Cell

capacity

1

--cell capacity; writes C and R

gates

R

--cell gates

gates-below

R − 1

--cell gates

kill

R

--cell kill

rolling

R

--cell rolling-restart

keys

10

--cell rolling-restart

A pure function turns the chosen steps and R into the list of actions: a start before each step whose replica count differs from the stack the previous step left, then the step. kill and rolling therefore share one start. Every start is dev start --release --replicas craig-security-issuer=<N>, and the first of a run adds --bake. A release start wipes the stack, so every count begins on fresh databases and a fresh key registry.

R. The capacity cell (cells::report_capacity) also writes test-results/identity/capacity.json, a CapacityResult { c_per_second, replicas }. The procedure deletes that file before the step and reads it after. Without capacity among the steps, --r is required and a step that needs R takes it from there; with capacity, --r is refused. No file after the capacity step ends the run: no later step runs at a guessed size.

Failures. A start that fails ends the run. A cell that exits non-zero (a gate that did not pass) is recorded and the run goes on, since the remaining steps are still wanted. The command exits non-zero when any step did.

What it records. Under test-results/identity/: each child’s output, teed to the console and to <n>-<step>.log through one std::io::pipe that both of the child’s streams write; and summary.md, with the commit, CRAIG_IMAGE_TAG, the arguments, and one row per step: replicas, exit code, start and end, and the host before and after. The host reading (procedure/host.rs) is the CPU count, MemTotal, the three load averages and the 60 s some average of /proc/pressure/io. A value that cannot be read is written unknown.

D4. The job

# #3166: the issuer capacity procedure on this commit's release images, by hand on main or a merge request.
issuer-capacity:
  extends: [.xtask-bin, .stack-teardown, .release-stack]
  timeout: 4h
  script: [xtask perf --profile identity --procedure $ISSUER_CAPACITY_ARGS]
  artifacts: {paths: ["test-results/identity/", "test-results/container-logs/"], when: always, expire_in: 90 days}
  rules: [{if: $CI_MERGE_REQUEST_EVENT_TYPE == "merge_train" || $CI_PIPELINE_SOURCE == "schedule", when: never}, {if: $CI_MERGE_REQUEST_IID || $CI_COMMIT_BRANCH == "main", when: manual, allow_failure: true}]

ISSUER_CAPACITY_ARGS is empty unless whoever starts the job sets it, for example --steps kill --r 3. The job takes no key from the encrypted store: start_release generates the field keys when absent, as a car’s start does, so it runs on an unprotected merge-request ref. A merge request can run it to measure a fix for #3151 or #3152 before it lands. It is on no train and no schedule. The 2026-11-22 run of every step took 75 minutes on luchs; the bake and five release starts add about 30.

D5. Documentation

  • deployment-guide.adoc § Identity capacity: § The procedure becomes the one command and its steps, with the single-cell commands kept as the way to iterate on a devstack build; § How it measures, Build says a procedure’s figures are the release images'; § Figures gains the first quiet-host run. The page’s CI job table gains issuer-capacity and says perf-load and perf-stress bake and run the release images.

  • testing-reference.adoc (the scheduled stacks' paragraph and the perf-load / perf-stress entries), local-dev.adoc and developer-guide.adoc (dev start --release with --replicas and --bake), and `docker-bake.hcl’s header comment (the one-command form beside the four by hand).

Steps

Each step is one MR on the train; steps 3 and 4 stack on step 2.

  1. Plan page. This file under docs/modules/ROOT/pages/plans/, the nav entry.

  2. The release stack in one command (D1). dev.rs, devstack.rs, bake.rs, their tests, the two developer pages. Exercised on luchs: dev start --release --bake --replicas craig-security-issuer=2 brings up two healthy issuer replicas.

  3. The perf jobs (D2). The YAML, the pipeline tests, the docs, changelog.d/3157.changed.adoc. The jobs run only on main and the schedule (.scheduled-stack’s rules; its `before_script takes the field key from the encrypted store, which an unprotected ref cannot), so before landing the load profile is exercised on luchs: cargo xtask perf --profile load against a dev start --release --bake stack. That shows the profile runs on the release images; its figures are a shared host’s and are not the verdict (Delivery).

  4. The procedure and the job (D3–D5). The procedure, the capacity result file, the job, the tests, the docs, changelog.d/3166.added.adoc. Exercised on luchs with --steps capacity, then by the job on its own MR with every step; that run’s summary goes on #2744. The plan is archived on this branch.

Risks

Risk Mode Mitigation

A job measures images of another commit

silent

each job bakes its own tree under its own commit’s tag on a fresh VM, in the same line that starts the stack; the summary records the commit and the tag; pipeline test the_measuring_jobs_bake_and_run_this_commits_release_images

A later step runs at a replica count nobody measured

silent

R comes from the capacity step’s file, deleted before the step, or from --r; no file ends the run; the_actions_take_r_from_the_capacity_result and no_capacity_result_ends_the_run_before_any_step_that_needs_r

The procedure wipes a developer’s running devstack

silent

it is `dev start --release’s existing behaviour and both help texts say so; the stack’s data is the seed’s; the first line the command prints names the wipe

A k6 scenario or the harness needs something only the devstack build has

fail-closed

release-build already runs the k6 smoke on this stack; before landing, step 3 runs the load profile on luchs against a baked release stack and step 4’s job runs the procedure on its own MR

The bake makes a job outlast its timeout

fail-closed

16 minutes measured for both bakes; the perf jobs keep 2 h (perf-load took 32 minutes on 2026-11-23, its devstack start included), the capacity job has 4 h for about 105

A host value cannot be read and is taken for a quiet host

silent

it is written unknown, not zero; an_unreadable_host_value_is_unknown

A gate that did not pass reads as a broken run, or the reverse

silent

the summary gives each step’s exit code and a failed start ends the run with its own message; a_failed_cell_is_recorded_and_the_run_goes_on and a_failed_start_ends_the_run

The manual job appears on a merge train and holds a car

fail-closed

its first rule is when: never there; the_capacity_job_is_manual_on_main_and_merge_requests_and_absent_elsewhere

The pipeline file passes its line bound

fail-closed

the existing bound test; D2 states the count

--bake pushes an image

fail-open

its argv carries --load or nothing; the_bake_argv_never_pushes, and the existing only_release_build_pushes_and_only_the_release_group

Tests

  • Unit, dev.rs and bake.rs: start_release_parses_and_refuses_the_build_flags changes: --release --replicas now parses (the behaviour this plan adds); it still refuses --force and --no-cache. bake_requires_release. the_bake_argv_names_the_group_and_loads_only_the_release_group; the_bake_argv_grants_the_cargo_registry_only_when_cargo_home_is_set; the_bake_argv_never_pushes. a_release_start_scales_as_a_devstack_start_does (the shared --scale helper).

  • Unit, the procedure: the_actions_take_r_from_the_capacity_result; kill_and_rolling_share_one_start; only_the_first_start_bakes; steps_without_capacity_require_r_and_capacity_refuses_it; no_capacity_result_ends_the_run_before_any_step_that_needs_r; a_failed_cell_is_recorded_and_the_run_goes_on; a_failed_start_ends_the_run (the two over a fake runner of actions); the_summary_has_a_row_for_each_step_run; the_procedure_runs_on_the_host (runs_on_the_devstack_network), and the route’s refusals of --cell and --replicas.

  • Property: the capacity result round-trips through its JSON; the three /proc readers (load average, MemTotal, io pressure) return a value or unknown and do not panic on arbitrary text, and read back a rendered value.

  • Contract (the pipeline, pipeline_tests.rs), existing tests that change: the_scheduled_stacks_start_their_own_stack expects xtask dev start --release --bake as the two perf jobs' first line and xtask dev start as pentest’s. `devstack_jobs, which finds the jobs that own a stack to clean by the exact line xtask dev start, also matches a line that starts with xtask dev start --release --bake or with xtask perf --profile identity --procedure, so every_stack_job_captures_its_container_logs_developer_only_before_it_cleans expects [car, pentest, perf-load, perf-stress, issuer-capacity]. release-build’s `xtask dev start --release stays unmatched, as it is today: it keeps no container logs and its one artifact is the public SBOM (Scope, Out).

  • Contract, new: the_measuring_jobs_bake_and_run_this_commits_release_images (the first line and the tag variable of perf-load and perf-stress; the tag variable of issuer-capacity); release_builds_bake_lines_are_the_argv_dev_start_runs; the_capacity_job_is_manual_on_main_and_merge_requests_and_absent_elsewhere. The line bound’s test is unchanged.

  • Regression (the case that would catch the perf jobs going back to the devstack build): the_measuring_jobs_bake_and_run_this_commits_release_images.

  • Exercised, not unit-tested: the three runs named in Steps. No concurrency category applies: nothing here fixes a race, and one reader drains the children’s pipe.

Every never above and its test: "no later step runs at a guessed size" → no_capacity_result_ends_the_run_before_any_step_that_needs_r; "`--bake` never pushes" → the_bake_argv_never_pushes; "the job is never on a train" → the_capacity_job_is_manual_on_main_and_merge_requests_and_absent_elsewhere.

Delivery

  • Doc pages: docs/modules/ROOT/pages/deployment-guide.adoc § Identity capacity and its CI job table (D5); testing-reference.adoc; local-dev.adoc; developer-guide.adoc.

  • CHANGELOG entries: changelog.d/3157.changed.adoc (the perf jobs measure the release images; Ops: none) and changelog.d/3166.added.adoc (the procedure command, dev start --release --bake and --replicas, the job).

  • Close: Closes #3166 on step 4, with the first run’s summary on #2744 and a line on #3151 and #3152 that the job exists. #3157: after step 3 lands, perf-load and perf-stress are run by hand on main; their p95 figures go on the issue, which closes if every limit holds and otherwise stays open with the figures for the maintainer.

Review log

Round Vendor Resolved model Verdict

1

Anthropic (Vertex)

vertex-anthropic/claude-fable-5-2

FLAGS on the second question: step 3 had its MR run perf-load on its own pipeline, which the scheduled jobs' rules and field-key step do not allow on a merge request; and the existing log-capture pipeline test finds stack jobs by the exact line xtask dev start, which the plan changed without saying how that test follows. Step 3 now exercises the load profile on luchs, and Tests names the predicate change and the expected job list.

2

Google (Vertex)

vertex-gemini/gemini-4-carbon

CLEAN; the maintainer then approved the plan for implementation.

Erratum (2026-11-27, step 2): the step’s release note is the slugged fragment changelog.d/3166.release-stack.added.adoc, so the MR that adds --bake and --replicas carries its own; changelog.d/3166.added.adoc (step 4) covers the procedure and the job.

Erratum (2026-11-27, step 3): .gitlab-ci.yml ends at 498 lines, not 497, because .release-stack has a comment line. The load profile ran against the release images --bake built at step 2’s head; the services had not changed since.

Erratum (2026-11-27, step 4): --r takes 2 to 10, since gates-below needs R − 1 replicas and the cap is 10. The procedure also counts as a verb that hands the checkout to Docker (main.rs hands_paths_to_docker), so under a /builds volume it re-executes from the volume’s path before it starts any child.

Edit this page · latest