Plan: One baselines directory, one bless verb
Status
Done (2026-11-24) — every recorded baseline is a typed TOML ledger under xtask/baselines/, read with no defaults; cargo xtask baselines bless rewrites the measured and run-fed ones; the contested registry holds no prose.
Closes: #2300, on the last step.
Tree: written against main at f143567d8.
Rulings (maintainer, 2026-11-23): plan #2300 next; the contested-surfaces review (criterion 4) is in scope; every
ledger becomes typed TOML read through one loader ("do it right, even if it takes longer").
Context
The gates in xtask compare the tree with recorded numbers and lists. Today those records live in three kinds of place:
-
Rust constants. For example
DTO_LENGTH_BASELINE(about 370 rows),DTO_UNTYPED_BOUNDS,DTO_OPAQUE_BOUNDSandDTO_OUT_OF_MODEL_CEILINGSinxtask/src/cmd/lints/dto_length.rs;UNTYPED_ENVELOPE_ALLOWLISTinlints/untyped_envelope.rs;STRUCT_METHOD_ALLOWLISTinlints.rs;UNGATED_BASELINEindevstack_gating.rs;CORS_EXEMPTincmd/security.rs; and the empty tables inlints/problem_type_status.rsandlints/undocumented_403.rs. Changing one handler means editing a constant in a lint’s source. -
Hand-typed universe floors. About sixteen
*_FLOORconstants andWORKSPACE_MEMBER_SEED_COUNT(cmd/lint_scan.rs). Each exists to notice a walk that stopped seeing the tree; each is a number someone typed. One lint may hold several (FILES_FLOOR,CONSTANTS_FLOORandJUDGED_FLOORinproblem_type_status.rs). -
Files, each with its own format and parser. Under
xtask/:quality-budgets.lock,fn-name-and-opt-out.txt,store-model-responses.toml,coverage-signatures-baseline.txt,evil-corpus-uncovered.txt,contention-uncovered.txt,audit-write-census.txt,authz-engine-wired.txt,authz-nil-id-exceptions.txt,authz-helpers.toml,mutants-baseline.toml. Elsewhere:crates/craig-api/authz-exempt-routes.txt,.coverage-baseline.json,contested-surfaces.toml. Different flags rewrite some of them (--bless,--write-pins,--write-lock,--baseline); several have no writer.
The 2026-10-23 tooling audit (note on #2300) found quality-budgets.lock fails open three ways:
a locked count of 0 reads as "unset" and falls back to a looser threshold; a missing or renamed key reads as 0
(read_lock(..).unwrap_or_default()); and the check only fails when the count rises, so a lock above the real count
is silent headroom.
contested-surfaces.toml is 3,301 lines for 136 surfaces. 92 carry an oracle string and there are 193 comment
lines of prose. That prose describes the consumer’s behaviour and sits two directories away from the consumer.
Scope
In: the records listed above; one loader; one verb to rewrite the measured ones; derived floors; the contested-surfaces shrink.
Out:
-
What any gate checks. No lint’s rule changes.
-
xtask/lint-policy.toml(policy, not a recorded measurement),deny.toml,.gitleaksignore,config-sources.lock. -
Vocabulary constants that are part of a rule (
FN_NAME_AND_ALLOWLIST,JURISDICTION_LITERAL_EXEMPT_TREES,SCREENING_ALLOWLISTS): they define the rule and stay in source. -
The
STRUCTURAL-VALUE/SILENT-OKmarkers as a class (carried from #2315): no census is removed by this plan, so none is removed for that reason. OneSILENT-OKgoes with the code it marks: the lock-file fallback D4 deletes. -
scenarios audit --bless: it records coverage moves incompliance/, not a baseline of an xtask gate.
Design
Erratum (2026-11-23, step 2): --allow-growth is accepted only with exactly one --only, so one reason cannot excuse
growth in a ledger its author did not name. Found by the commit review.
Erratum (2026-11-23, steps 3 and 4): there is no Direction type. Each ledger registers its own check and bless
functions, and the three behaviours live in the helpers they call. A fixture workspace that reaches a floored walk
writes its own floors file rather than passing a literal, because the floor is now read where the walk runs. The
partner-adapter seed count (PARSE_PROP_SEED_ADAPTERS) is not a *_FLOOR constant and stays in source.
D1. xtask/baselines/, all TOML
One directory holds every record, and every record is TOML deserialized into a typed struct by the one loader (D2).
The line formats in use today (a::b | reason, service METHOD path kind, service METHOD path — reason) each
have a hand-written parser; those parsers are deleted with their files. A row with a reason becomes a table with a
required reason key, so "a reason is present" is the type’s rule and not each parser’s.
Records are of three kinds, and the kind decides what bless may do (D3):
| Kind | Meaning | Records |
|---|---|---|
measured |
The gate can recompute it from the tree alone. |
the DTO tables, untyped envelope, struct-method, problem-type, undocumented-403, ungated devstack tests, CORS exemptions, quality budgets, fn-name opt-out, store-model baseline, the three authz pins, evil-corpus and contention ratchets, audit-write census, scan floors |
run-fed |
Recomputing needs the output of a run the verb does not start. |
coverage ( |
declared |
Written by a person; a gate reads it as input. There is nothing to recompute. |
|
Two files have a reader outside xtask and are settled here:
-
The authz exemption table.
crates/craig-api/src/authz_witness.rsembedscrates/craig-api/authz-exempt-routes.txtwithinclude_str!and parses it at run time. The ledger becomesxtask/baselines/authz-exempt-routes.toml; the witness embeds that file and deserializes it withtoml, replacing its line parser. craig-api gainstomlas an optional dependency of theauthz-witnessfeature and as a dev-dependency (the module also compiles for the crate’s own tests); production images build neither. One file, two typed readers, no generated copy. The Dockerfile copies the whole context, so the file is in the image build. -
The coverage baseline.
.coverage-baseline.jsoniscargo llvm-cov’s own export, of which the floor reads one number. The ledger becomes `xtask/baselines/coverage.tomlholdinglines_percent; the tool’s JSON is no longer committed.
D2. One loader: xtask/src/baseline.rs
A small module, expected about 300 lines of production code, with no scanning of its own:
-
load::<T>(name)readsxtask/baselines/<name>.tomland refuses a missing file, an unparsable file, an unknown key and a missing key. There is no default. -
Directionsays how a record may move without a reason:-
ShrinkOnly: a count or row set. The gate fails when the measurement is above the record (new debt) and when it is below (a stale record, to be blessed down in the same MR), which is whatreconcile_site_allowlistalready demands of the per-file tables. -
Exact: a generated listing that must equal the scan. -
Floor { slack }: the gate fails when the measurement falls below the record less its slack; a rise is fine and needs no action. Coverage uses a slack of 0.5 points (today’sFLOOR_TOLERANCE_PERCENT); scan floors use one fifth (D5).
-
-
write(name, value, header)renders deterministically (sorted, stable formatting), keeping a file’s hand-written header lines as the fn-name opt-out does today.
Each record registers one Ledger value: its name, kind, direction, and for a measured record how to measure it.
D3. One verb: cargo xtask baselines
-
baselines checkruns every measured ledger’s comparison and prints one line each; it loads the run-fed and declared ledgers to prove they parse. Each gate keeps calling its own comparison invalidateand the car;checkreaches the same code by name. -
baselines bless [--only <name>…]rewrites measured ledgers from the tree. For a run-fed ledger it reads the run’s output and refuses, naming the command to run, when that output is absent. It never touches a declared ledger. -
A change against a record’s direction needs a reason:
--allow-growth <reason>to raise aShrinkOnlyrecord,--allow-lower <reason>to lower aFloor. The reason must be non-empty and is written into the file’s header (last_exception = "<date>: <reason>"), so the diff a reviewer reads carries it.
Removed, each in the step that converts its record, with no alias: lints fn-name-and --bless,
lints store-model-baseline --bless, validate-authz-coverage --write-pins, quality-budgets --write-lock,
coverage-matrix --bless, coverage --baseline. contested-census --bless stays: it seeds stub rows for a person
to complete, which is authoring a declared ledger, not rewriting a measurement. Expected size of the verb: about 200
lines.
D4. Quality budgets
quality-budgets.lock becomes xtask/baselines/quality-budgets.toml, read through D2 as ShrinkOnly. That closes
the three audit findings: every budget key is required; a locked 0 is a ceiling of 0; and a count below its lock
fails as stale. The threshold fallback (ceiling = if locked > 0 { locked } else { threshold }) and the
unwrap_or_default read are deleted, since every budget is locked.
D5. Floors recorded, not typed
xtask/baselines/scan-floors.toml holds one entry per floor, keyed <lint>.<what> (so problem-type-status.files,
.constants and .judged are three entries, and workspace.members replaces WORKSPACE_MEMBER_SEED_COUNT). Each
is a Floor with a slack of one fifth, the proportion the hand-typed floors were set at. bless raises an entry to
the measured count freely and lowers one only with --allow-lower, so a walk that has already broken cannot
quietly record its broken count.
require_files_floor(lint, scanned, floor) keeps its three parameters. Production callers pass the loaded entry;
the tests that scan a TempDir keep passing their own literal, so no fixture needs the real tree’s counts. The
*_FLOOR constants are deleted.
D6. Contested surfaces
The registry keeps, per surface: id, class, crate, status, ordering, the anchor, the tests rows, and
for a skip its reason, owner and review date. The prose comments leave the file, and two fields are removed from
the Surface struct and from the stub text contested-census --bless writes: oracle (documented in
contested.rs as "not validated") and levers (no row uses it).
Where the prose goes, per surface, decided by reading the consumer the anchor names:
-
The consumer’s doc comment already says what the prose says: the prose is dropped.
-
It does not: the behaviour is written into that doc comment, as a description of the code (what it converges to, under what delivery order, and why), with no plan or unit label.
-
The prose describes the test rather than the consumer: it goes on the test’s doc comment.
No check changes: covered still requires tests, as today.
Steps
Each step is one MR on the merge train. Steps 2 to 6 stack; 7 to 10 stack on 6.
-
This page.
-
baseline.rs, thebaselinesverb, and quality budgets (D2, D3, D4). The verb starts with one ledger. -
In-source tables become TOML ledgers: the four DTO tables, untyped envelope, struct-method, problem-type, undocumented-403, ungated devstack tests, CORS exemptions.
-
Recorded floors (D5).
-
Existing record files, first half: the three authz pins (with the witness’s reader), the fn-name opt-out, the store-model baseline, the coverage signatures. Each becomes typed TOML; its parser and old write flag go.
-
Existing record files, second half: evil-corpus and contention ratchets, the audit-write census, authz helpers, the mutants catalogue, the coverage baseline, and
contested-surfaces.toml(moved, not yet shrunk).CODEOWNERS,CONTRIBUTING.adocand every doc that names an old path follow. -
Contested surfaces:
mq-consumer,outbox-workerandpartner-crate(32 surfaces). -
Contested surfaces:
worker(58). -
Contested surfaces:
s2s-client,auth-plane,pool,browser-flow(46); thenoracleandleversare removed from the struct. -
Close: the docs below, the plan archived, #2300 closed.
Tests
| Category | What |
|---|---|
Regression (the audit’s three findings) |
A budgets file without a budget’s key is refused. A locked 0 with a measured 1 fails. A measured count below its
lock fails as stale. Each is a test that fails on today’s |
Unit |
|
Property |
For an arbitrary ledger value, |
Contract (no gate weakened) |
For each record converted in steps 3, 5 and 6 that a gate reads, the gate’s existing tests pass unchanged, and one test per ledger plants a violation in a temporary tree and sees the gate fail. In each of those steps a conversion check loads the old record with its old parser and the new file with the loader and compares the two row sets for equality, before the old parser is deleted in the same MR. The authz witness’s existing tests pass on the TOML table. The mutants catalogue has no gate; its conversion check is the row-set equality alone. |
Contested surfaces |
The registry’s existing structural tests pass at each of steps 7 to 9. After step 9, a |
Risks
| Risk | Mode | Mitigation |
|---|---|---|
A row is lost when a table moves from source to a file, so a gate admits what it refused. |
fail-open |
The conversion check in the contract tests; for a |
A format conversion drops or alters a row. |
fail-open |
The conversion check (old parser against the loader, row sets equal) runs in the MR that converts. |
A record file is missing or misnamed in a checkout or in the CI image. |
fail-closed |
|
The authz witness reads a table its build does not contain. |
fail-closed |
|
|
silent |
The reason lands in the file header in the same diff, so a reviewer sees every use. No further mechanism is added. |
A floor is refreshed after a walk has already broken, recording the broken count. |
fail-open |
|
Oracle prose is lost rather than moved. |
silent |
Steps 7 to 9 list in each MR, per surface, whether its prose was moved, already present, or dropped and why. The commit review reads each new comment against the code. |
A doc comment written from the registry’s prose claims more than the code does. |
silent |
The comment describes what the code does and names the test that shows it; the review checks claims against the tree. |
The stale-record rule makes an unrelated MR fail when a count happens to fall. |
fail-closed |
That is the intent (the record must follow the truth); the failure message gives the bless command. |
Erratum (2026-11-24, steps 5 to 9): steps 5 and 6 each landed as more than one commit, step 5 as two MRs. The conversion check was done once per file by a script before the old file was deleted, not kept as a test. The audit-write census is not registered with the verb: its module is test-only and its tests are its check. For steps 7 and 8 each surface’s prose was read against the code; for step 9 the check was mechanical (identifiers named in the prose found in the anchor and test files), and the untested paths the prose recorded were filed as #3154. Release notes are one fragment per MR, not one for the plan.
Delivery
-
Doc page:
docs/modules/ROOT/pages/quality-gates.adocgains § Baselines (the directory, the three kinds, the three directions, the verb, exception reasons, recorded floors) and loses each per-gate description of its own write flag.operations/contested-environment.adocdescribes the smaller registry. -
CHANGELOG entry: one
changelog.d/2300.changed.adocfragment (this repository’s release notes are fragments, folded intoCHANGELOG.adocat a release); Ops: none (developer tooling). -
Close: #2300 with the last merge; the plan archived with its review log.
Review log
| Round | Vendor | Resolved model | Verdict |
|---|---|---|---|
1 |
Anthropic (Vertex) |
|
FLAGS: step numbering, |
2 |
Google (Vertex) |
|
Read the edited plan with round one beside it; the maintainer then approved it for implementation. |