Plan: A docs-only merge request skips the stack and the lanes

Status

Done (2026-11-18) — the car decides from git whether its change is documentation alone and then stops after its gates; the whole-car path ran live, and the docs-only stop is first exercised by this page’s own archive merge request.

Closes: #3101.
Tree: written against main.
Ruling (maintainer, 2026-11-15; #1654 item 8, #2968 question 4, #3099 finding 3): a docs-only merge request runs the docs and lint jobs and skips the car.
Ruling (maintainer, 2026-11-17, in plan mode): a docs-only car runs its gate block, then stops before the stack.

Erratum (2026-11-18): the census reads every tracked .rs file and any non-comment line, not five named roots and one-line string literals; the first form missed plugins/ and strings that span lines.

Erratum (2026-11-18): the verb reports "the whole car runs" as an error, so that main turns it into the non-zero exit; a full car’s log carries one Error: car-scope: the whole car runs: <reason> line, which is the answer and not a failure.

Context

A car takes 42 to 46 minutes on a 4xlarge runner. A merge request that only moves a plan page to the archive pays all of it: it builds every image, boots the stack and runs about 17,600 tests that cannot read the change.

What the tree does today (.gitlab-ci.yml:63-75):

  • On a train, car always runs, whatever changed.

  • On a plain merge request, car runs only when a changed path matches a list of code globs. A path the list forgot counts as documentation, so the list fails open: services/craig-web/templates/, sdks/, compliance/ and mock/ are not on it, and a merge request changing only an Askama template runs no car until the train.

rules:changes cannot express the ruling. It is an OR over globs (run when any file matches) and has no negation, so "skip only when every file is documentation" has to be decided inside the job.

Facts the design rests on, each read from the tree or from live pipelines:

  • A car checks out a merge commit GitLab made. Its first parent is main plus the cars ahead; its second is the source branch head. Seen on pipelines 3080503215 (refs/merge-requests/2417/merge), 3080615481 and 3080783857 (…/train): two parents each. The project’s merge method is merge, with merged-results pipelines and merge trains on.

  • The car clones at full depth (GIT_DEPTH: "0"), so both parents are present.

  • No image can see documentation: .dockerignore drops docs/, changelog/, changelog.d/ and root *.adoc. Only gates and tests that read the checkout can.

  • The gate block is cheap. In car 18117845951 it ran from cargo fmt to the end of xtask gitleaks in 67 seconds; dev start to the first lane took 12 minutes, and the lanes the rest.

  • Some documentation is read by a lane, so it is not "documentation" for this purpose: pages/api/** (api-docs --check and two xtask tests), testing-reference.adoc (crates/craig-test-lib/tests/invariants_catalog.rs), deployment-guide.adoc (services/craig-cases/tests/api/scheme_rewrite.rs), operations/contested-environment.adoc (include_str! in xtask/src/devstack_guard.rs).

  • A successful job is all the merge needs: only_allow_merge_if_pipeline_succeeds is true and allow_merge_on_skipped_pipeline is false, and a car that stops early is a successful job, not a skipped one. No project setting changes.

Design

D1. One definition of "documentation", in xtask

A new module xtask/src/car_scope.rs holds the definition and nothing else decides it.

A path is documentation when it is one of:

  • under docs/modules/ with the extension adoc, png or svg;

  • under changelog.d/ or changelog/ with the extension adoc;

  • CHANGELOG.adoc, README.adoc, CONTRIBUTING.adoc or SECURITY.adoc at the root;

and it is not under a LANE_READ entry: docs/modules/ROOT/pages/api/, docs/modules/ROOT/pages/testing-reference.adoc, docs/modules/ROOT/pages/deployment-guide.adoc, docs/modules/ROOT/pages/operations/contested-environment.adoc.

It is an allowlist. Everything else is code: docs/extensions/*.js, docs/antora.yml, the SHINES JSON attachments, AGENTS.md, fixtures/config/README.adoc, every path not named above.

A change set is docs-only when it is non-empty and every path in it is documentation.

D2. The change set comes from git, and doubt runs the car

xtask car-scope first proves that HEAD is the merge commit GitLab made for this pipeline, then computes the change set as git diff --name-only -z --no-renames HEAD^1 HEAD.

The proof, all three required:

  • CI_MERGE_REQUEST_EVENT_TYPE is merged_result or merge_train. A detached pipeline checks out the source branch head, which may itself be a two-parent merge a developer made (a docs branch merged into a code branch); its diff against its first parent would show only the merged-in documentation.

  • HEAD has exactly two parents.

  • HEAD^1 equals CI_MERGE_REQUEST_TARGET_BRANCH_SHA and HEAD^2 equals CI_MERGE_REQUEST_SOURCE_BRANCH_SHA. GitLab sets both only on merged-results and train pipelines, and on a train they are the car’s two parents (seen on live pipelines, #3101’s research note).

The verb takes the three values as read from the environment through one function, so the tests pass them in.

  • --no-renames lists a renamed file as a deletion and an addition, so moving a code file under docs/ shows the code path.

  • A deleted path counts like a changed one.

It exits 0 only when it established docs-only. It exits non-zero, and prints the reason and the first non-documentation path, when the set has a code path, when the set is empty, when any part of the proof fails or a variable is unset, or when git fails. A detached merge-request pipeline therefore always runs the whole car.

D3. The car runs its gates, then stops

One line goes into the car’s script, after xtask gitleaks and before xtask dev clean --any-project:

if xtask car-scope; then exit 0; fi

GitLab runs a job’s script lines as one shell script, so exit 0 ends the job as a success. The line sits after the gates on purpose: a docs-only car still runs every gate (changelog check, doc-attr-refs, plan-lint, scenarios audit, gitleaks and the rest), so no list of "gates that read documentation" has to exist. Only the stack and the lanes are skipped, and LANE_READ covers exactly what those read.

In xtask/src/cmd/validate/car.rs the line is a CarLine of step CarStep::Stack with a new Needs::Scope, the first Stack line, ahead of the purge. on_host returns OnHost::Drop for Needs::Scope under every flag combination, on CI or off: validate --profile full never stops early, since a developer chose to run the whole car. (The purge differs: off CI it is marked skipped, and dropped only under --skip-devstack.)

The existing test the_car_is_the_gates_then_the_stack_then_the_lanes pins the Stack step to exactly the purge and dev start; its Stack list gains the scope line as the first entry. The gate count and the last two gates are unchanged. This is reported in the merge request as a changed assertion.

The docs job and the xtask job’s three doc lints run on every merge request and train as they do now.

D4. A plain merge request uses the same decision

.car-rules loses its changes: list. car starts on every merge request and every train, and D3’s line decides. This removes the second, fail-open definition: a merge request that changes only a template or an SDK file runs the car on the merge request, where today it waits for the train to find a failure.

Cost: a docs-only merge request starts one car job that ends after the gates.

D5. A census keeps LANE_READ true

A test in xtask/src/car_scope.rs scans every tracked *.rs under crates/, services/, tools/, tests/ and xtask/ for string literals (and include_str! arguments) that name a path inside D1’s allowlist roots. Each file with a hit has a row in a table: Gate (read by a line before D3’s exit), Lane with the paths it reads, or Text (a message or a fixture, not a read), each with a reason. The test fails on a file with a hit and no row, on a row with no hit, and on a Lane path that D1 does not reject.

A new reader of a documentation file is added in a .rs change, which runs the full car, where this test fails until the row and the LANE_READ entry exist.

Limit: it reads Rust only. TypeScript, TOML, YAML and the Dockerfiles were surveyed by hand for this plan and name no documentation path as an input (docker-compose.yml mounts the screenshots directory for writing).

Scope and order

One merge request, since the verb, the car line and the pipeline tests cannot be green apart.

  1. xtask/src/car_scope.rs: the definition, the git read, the verb xtask car-scope, the census.

  2. xtask/src/cmd/validate/car.rs: Needs::Scope and the line.

  3. .gitlab-ci.yml: the line in car; .car-rules without changes:; the header comments. The file stays under 500 lines (497 today; one line added, four removed).

  4. xtask/src/pipeline_tests.rs and xtask/src/ci_changes.rs: the tests below; the .car-rules row leaves WATCHED_DIRS.

  5. Docs and the release note (Delivery).

Out of scope: skipping ci-image or xtask (about four minutes together, and xtask runs the doc lints); the scans; any change to docs.

Risks

Risk Mode Mitigation

A lane reads a documentation path that LANE_READ omits, so a docs-only change that breaks that lane’s test merges.

fail-open

D5’s census fails the merge request that adds the reader. Residual: a non-Rust reader; the next full car on `main’s train shows it.

xtask car-scope errors (git missing a parent, a non-merge HEAD, an empty set).

fail-closed

Non-zero exit runs the whole car; the git tests below pin each case.

GitLab stops making two-parent merge commits for cars (a fast-forward method).

fail-closed

One parent is "run the car"; every car is then full, which is today’s cost.

A detached pipeline whose branch head is a developer’s merge commit looks like a docs-only merge.

fail-closed

D2’s proof: the event type and both parent SHAs must match GitLab’s variables; pinned by two git tests.

GitLab runs script lines so that exit 0 does not end the job.

fail-closed

The car continues into the stack and the lanes; seen as a 45-minute docs-only car on the first live run.

A code file is renamed into docs/, or deleted, in a change that otherwise touches documentation.

fail-closed

--no-renames and counting deletions; pinned by test.

A docs-only car produces no junit, so merge notes and the watcher that read results.xml find none.

silent

The verb prints one line saying the stack and lanes were skipped; known-issues.adoc says a docs-only car has no junit.

after_script runs dev logs and dev clean on a VM with no stack.

silent

Both lines already end in || true; checked on the first live run.

A plain merge request that changes only a path the old list forgot now runs the car.

fail-closed

Intended (D4); the train ran it anyway.

Tests

Every test is a non-devstack xtask test and gets a red proof (the mutation that turns it red is recorded in the merge request).

  • Unit, the definition: a table of paths with the expected answer, including the lookalikes docs/x.rs, changelog.d.rs, docs/modules/ROOT/attachments/x.json, docs/antora.yml, Docs/modules/a.adoc, each LANE_READ entry and a page under pages/api/. An empty set is not docs-only.

  • Property: for any generated set of documentation paths, adding one generated non-documentation path makes it not docs-only (pins "every path", D1).

  • Git, the change set (temporary repositories, built with workspace::hermetic_git): a docs-only merge answers yes; a merge with one .rs answers no; a code file renamed under docs/modules/ answers no; a deleted code file answers no; a HEAD with one parent answers no; a merge whose first parent’s objects are absent answers no; a docs-only merge under event type detached answers no; a branch head that is a developer’s own merge of a docs branch into a code branch, with parents that do not equal the two SHA variables, answers no; each of the three variables unset answers no (together these pin D2’s "doubt runs the car").

  • Contract, the pipeline (pipeline_tests.rs): the car’s script is car_lines() in order, with the scope line directly after xtask gitleaks and directly before xtask dev clean --any-project; no line before it starts the stack; .car-rules carries no changes: and admits every merge request and every train; the scope line is the one non-verb line allowed in car beside cargo fmt and cargo machete; the line bound holds. a_code_changing_mr_runs_the_blocking_car_and_a_docs_only_mr_runs_docs is rewritten to assert that both run the four jobs (its docs-only half can no longer hold; reported in the merge request).

  • Contract, the host: on_host(Needs::Scope, ..) is Drop for all eight combinations of skip_docker, skip_devstack and on_ci; the_car_is_the_gates_then_the_stack_then_the_lanes holds with the scope line first in the Stack step.

  • Census: D5.

  • Observed, live: two cars after the implementation merges. The implementation’s own car is a code change and must be a full car with junit. The plan’s close-out merge request (the archive move, documentation only) is the first docs-only car: its car job must succeed in minutes with the skip line in its log, on the merge request and on the train. Until that second car, "a docs-only car skips" is unverified, and #3101 says so.

Delivery

  • Canonical page: docs/modules/ROOT/pages/quality-gates.adoc § CI: the car (what a docs-only car runs, and the definition’s home).

  • Also: a dated amendment in adrs/adr-086-merge-trains-are-the-gate.adoc; known-issues.adoc § Landing an MR (a docs-only car, and that it has no junit).

  • CHANGELOG entry: changelog.d/3101.changed.adoc, with its Ops: clause.

  • Close: the implementation merge request says Closes #3101, and its merge note carries the merge SHA and the full-car observation, stating that the docs-only skip is not yet observed. Then cargo xtask plan-lint --done and the archive move, as their own merge request; its car is the docs-only observation, posted on #3101 as a second note. If that car does not stop early, #3101 is reopened and the fix lands before the plan is archived.

Review log

Round Vendor Resolved model Verdict

1

Anthropic

claude-fable-5-2

FLAGS (1): a detached pipeline on a developer’s merge commit would read as docs-only; the scope line had no step and the purge was misdescribed; folded.

2

Google

gemini-4-carbon

FLAGS (1): the live observation and the close contradicted each other; folded. Approved by the maintainer in plan mode, 2026-11-17.

Edit this page · latest