Plan: Runtime Coverage Matrix — Observed Axes, a Signature Gate, the @axis Retirement (#2301)
- Archive record
- Status
- Context
- Design
- Scope
- U1 —
test(test-lib): census the test HTTP calls that bypass the harness client - U2 —
feat(test-lib): record every harness HTTP request per test - U3 —
test: route the census’s matrix-service calls through the recorder - U4 —
feat(xtask): compute the coverage matrix from the battery’s recordings - U5 —
feat(xtask): gate missing coverage signatures with a shrink-only baseline - U6 —
chore(test): retire the // @axis: tags and the axis-coverage gate - U7 —
fix(api): declare the multipart upload request bodies in OpenAPI - U8 —
feat(api): mark replayed responses with Idempotent-Replayed: true
- U1 —
- Out of scope
- Risks
- Review log
Archive record
!1988 (the plan page, #2301) + !1993 (U2, #2701) + !1996 (U3, #2702) + !1997 (U4, #2703) + !1998 (U7, #2706) + !1999
(U8, #2707) + !2003 (U5, #2704, closes #888) + !2004 (U6, #2705, closes #2301); U1 #2700: no MR (the census is on the
issue) — 2026-10-26: a contextless round 1 (no-ship, 5 blockers folded) and the maintainer’s round 2 (OpenAI GPT Astra,
no-ship, 12 findings folded). What landed: the test harness records every HTTP request it sends, one JSONL file per test
(U2: craig_test_lib::recording, with method, path, status, client_request_id, timing, the craig_fault_core::window
arm flag and the replay header), and U3 routed the census’s 213 matrix-service sends through it. cargo xtask
coverage-matrix (U4) credits each record to a passed test’s final attempt through the nextest JUnit, matches it to a
route of the nine from-source OpenAPI specs (matchit) behind a 5‰ unmatched health floor, and derives per route
happy (2xx), sad (400, 404, 409, 422), evil (401, 403), fault (5xx while armed), replay (a 2xx carrying U8’s
Idempotent-Replayed: true) and conc (overlapping requests on one route in one test); U7 declared the eight multipart
upload bodies so the idempotency predicate sees them. U5’s coverage-signature gate (--check, blocking in every full
battery, provenance from run.json) requires success, refusal and, on an idempotent route, replay; its shrink-only
baseline xtask/coverage-signatures-baseline.txt was seeded at 155 lines (26 success, 57 refusal, 72 replay). U4
deleted the static matrix’s name/path crediting and the route-to-client mapping; U6 deleted the axis-coverage and
axis-sweep gates, their opt-out file and every // @axis: tag (12,308 in .rs, 228 of them keeping their prose; 186 in
the Playwright specs), and four plans took an erratum. Follow-up: #2764 (three replay paths without the header).
Context
The #2301 ruling (2026-10-23): a runtime matrix with observed axes, then the tags retire; this page, its nav entry and
U1–U8’s epic (to be filed) ship under it. The static matrix credits axes by test name or directory, routes by literal or
typed-client call: 18 of 2,820 cells over 470 routes (operations/coverage-matrix.adoc:62). The project-owned
// @axis: gate (quality-gates.adoc:335) checks a tag exists, not that the test exercises its axis. Verified on main,
2026-10-23. Bare test-lib files are in crates/craig-test-lib/src/, bare xtask ones in xtask/src/cmd/.
-
Idempotency key. No header:
client_request_idis a request-DTO field (crates/craig-api/src/request_claims.rs:14; the same id with another intent is a 409,:50) or a multipart text field. 142 of the 274 mutating operations list it, all JSON: no upload handler declares arequest_bodyin its#[utoipa::path](utoipa 5.4.0).
Design
D1. Recording (craig-test-lib; no production behaviour)
New module crates/craig-test-lib/src/recording.rs.
Recorder::send(&self, builder: reqwest::RequestBuilder, hint: CridHint) → reqwest::Result<reqwest::Response> is the
one sending path. It keeps reqwest’s error type, so a raw .send().await migrates mechanically, and it is not a
ServiceClient method (the F-054 ceiling). In order, it:
-
`build_split`s the builder (reqwest 0.12.28). A build error records nothing and is returned as is.
-
Reads the method, origin and path (query and fragment cut) and resolves the service (below).
-
Takes the key:
CridHint::Known(Uuid)as given;CridHint::Noneis null;CridHint::FromBodyparses the body bytes asCridProbe { client_request_id: Option<Uuid> }(top level, unknown fields ignored; non-JSON or a stream is null). -
Samples
armed(D2) andt0,execute`s, and takes `t1andreplayed(U8’s header) at the response head or error. -
Appends one record and returns the result unchanged.
-
Seam.
Recorder::new(dir, header)fixes its file,<dir>/<uuid-v7>.jsonl(Recorder::path()); the first record creates the dir and the file. EachRecorderowns its origin registry (register_origin(&self, base_url, service)); none is global. The freerecording::send/register_origindelegate to a globalOnceLock<Option<Recorder>>; whenNone,sendsends and records nothing. Tests read a tempdirRecorderback viapath()and the line parser. -
Activation and services. The global is
Someonly ifCRAIG_TEST__HTTP_RECORD_DIRis set (read inconfig.rsbyhttp_record_dir(), perlints.rs:1452) andNEXTEST_RUN_ID,NEXTEST_BINARY_ID,NEXTEST_TEST_NAMEandNEXTEST_ATTEMPTexist (pureRecorderConfig::resolve). Its registry seeds from theTestConfigURLs (config.rs:11; intake’s three URLs map tocraig-intake); an in-process server’sregister_origin(U3 adds the calls) replaces an entry; elsesvcis null. -
Callers.
ServiceClient’s `dispatch(client.rs:169) andsendtake aCridHintand send throughrecording::send; every JSON verb and the freedownload_stream(:465),get_unauthenticated(:495) andpost_unauthenticated(:515) passFromBody.post_multipart(:325, 13 call sites) takes its caller’s hint:post_upload_attempt_form(:351) and the typed upload clients inclients/cases/(reports.rs:224,contacts.rs:145,court_orders.rs:108) passKnown(crid); the nine test-file sites passKnown(crid)if the form carriesclient_request_id(checked per site), elseNone. The cleanup DELETE (harness.rs:873) stays raw. -
Format. One file per process, one
write_allper line (parking_lot::Mutex): a header{v: 1, run_id, binary_id, test, attempt}, then per request{svc, method, path, status, crid, t0_us, t1_us, armed, replayed}. xtask reusesRecordHeader/HttpRecord(serde,deny_unknown_fields),parse_lineandread_file(namingfile:line). Times areSystemTimeµs; a clock step back clampst1tot0. A failed create or write panics with the path. -
Battery wiring.
battery_preamble(validate.rs:1552) refuses nextest below 0.9.116 (CI’s is unpinned:.gitlab-ci.yml:368), removestest-results/http/records/after the C24 reset (:1579; stale records never count), and setsCRAIG_TEST__HTTP_RECORD_DIR=<workspace>/test-results/http/recordsfor nextest. Both batteries record; onlyrun_devstack_battery(:1613) reports (D5) and gates (D6): a partial battery cannot judge absence.
-
D2. The arm window
New module crates/craig-fault-core/src/window.rs: a process-global AtomicUsize, RAII ArmWindow::open() (increment,
decrement on Drop), ArmWindow::open_for_process() (never decrements), and pub fn armed() → bool, sampled at t0.
C24’s FaultRecord (craig-fault-core/src/record.rs:38) lacks test identity. The armers (U1 lists the rest):
-
PgFaultArmer::arm(fault/pg_armer.rs:106) opens one, held in the struct, dropped byfinish/disarm/Drop. -
ToxiproxyClient: one per(proxy, toxic)fromadd_toxic(fault/toxiproxy.rs:307) and per(proxy, "@disabled")fromset_enabled(false)(:429), in a global map;remove_toxic,set_enabled(true)anddelete_proxydrop them.s2s_stub::spawn_fault_server(fault/s2s_stub.rs:36) usesopen_for_process. Erratum (2026-10-25, U2 #2701): the map is a(proxy, toxic | "@disabled")set holding ONE window while non-empty;clippy::zero_sized_map_valuesrefuses a map whose value is the zero-sizedArmWindow, andarmed()is unchanged. -
OpCountdown(craig-fault-core/src/lib.rs:32) and craig-mq’sPreSendInjector(craig-mq/src/fault.rs:111) hold one in shared state only while their counter is above zero: a zero count never opens it, and the consult exhausting the counter drops it (should_fail,lib.rs:73;maybe_fail,fault.rs:141).arm_stage_fault(fault.rs:70) opens one itsStageFaultGuardholds. craig-mq’s default-offfault-injectionfeature gainsdep:craig-fault-core.
D3. Attribution and route matching
-
Test. A test is
(binary_id, test); one process is one attempt; files sharing(binary_id, test, attempt)are one test. Only a passed test earns credit, via only its final attempt’s records, per the nextest JUnit (test-results/<profile>/integration/results.xml, read attest_binaries.rs:112) scanned likewhole_binary_aborts(:90; no XML crate):<testsuite name=is thebinary_id,<testcase name=thetest; passed = no<failure,<erroror<skippedchild; final attempt = 1 + itsflakyFailure,flakyError,rerunFailureandrerunErrorchildren. A record of a test absent from the JUnit or above that attempt refuses the run, as do mixedrun_id`s, an unknown `v, an unparsable line (namedfile:line) and zero records (causes named: nextest < 0.9.116, no record dir). -
Routes. Per service, a
matchit::Routerholds every path key of its from-source spec;at(path)gives the template, the method the operation.matched,probe(/healthz,/livez,/readyz,/metrics: no spec serves them,crates/craig-api/src/lib.rs:584-587),unmatched-path,unmatched-methodandunattributed(svcnull or not inSERVICES) are counted. Two spec keys of one shape (InsertError::Conflict) fail the run, naming both. -
Health floor, before any report,
--checkor--bless: everySERVICESmember has a matched record, and the unattributed plus unmatched share (probeexcluded) is at mostrecords::MAX_UNMATCHED_PER_MILLE. U4 pins it at the next 5‰ step above its first, report-only battery’s figure (both on the U4 issue); shrink-only, a raise justified in its MR. A failure refuses as a recorder failure, never a coverage gap.
Erratum (2026-10-25, U4 #2703): the run also refuses a JUnit with no <testsuites uuid= or one whose uuid (nextest’s
NEXTEST_RUN_ID) is not the records' run_id, so a stale --junit cannot credit a test that failed in this run;
probe is decided first, by path alone, so a probe is never unattributed; and D4’s sweep orders by (t0_us, t1_us),
since a t0-only order flags a zero-length tie ([5,5) before [5,9)) that the pairwise rule does not.
D4. Axis derivation
-
Per record:
happystatus 2xx;sad400, 404, 409, 422;evil401, 403;fault5xx whilearmed;replay2xx withreplayed: true(the server’sIdempotent-Replayedheader, U8). -
Per group:
conc, ≥2 records on one route in one test whose[t0_us, t1_us)overlap:t0_a < t1_b && t0_b < t1_a. -
Independence. Each record credits its own status axis;
replayis additive; no record is suppressed. -
Concurrency. A
t0-ordered sweep: an overlap is at0below the running maximumt1; status (or none) is ignored. -
Reported, not credited. 1xx, 3xx, other 4xx (405, 406, 410, 412, 413, 415, 428, 429, …), unarmed 5xx, no response.
D5. The matrix and its provenance
cargo xtask coverage-matrix [--records <dir>] [--junit <xml>] [--output <md>] [--check] [--bless] keeps its name.
--records defaults to test-results/http/records, --junit to the integration profile’s report (the battery passes
its own); --output keeps its default, target/coverage-matrix.md, for the Markdown table. New code goes under
xtask/src/cmd/coverage_matrix/: spec_routes.rs (Route and extract_routes, coverage_matrix.rs:134, :419,
moved verbatim; the matchit table; D6’s idempotency predicate), records.rs (D3), axes.rs (D4), report.rs and, from
U5, signatures.rs. Specs: a new api_docs::from_source_specs(&SERVICES) (api_docs.rs:41), cut from api_docs::run;
spec_from_binary (:151) stays put.
-
Reports.
test-results/http/coverage-matrix.json(per route: method, template,idempotent, axis counts with observing tests, unarmed 5xx, unclassified; outcome totals) and the table embed theirrun_idand tree hash. A route’sreplay_attempts(records reusing an earliercridon it in one test) tells unsent from unconfirmed S3 gaps. -
Run manifest. Once nextest and its gates pass, the battery writes
test-results/http/run.json:kind: full,run_id(the records'), HEAD’s tree hash, a clean-tree flag, the specs' sha256;run_scoped_battery_withwrites{kind: "scoped"}after its nextest step (other fields optional). The preamble’s reset deletes it and both reports (as C24’s,program_gate.rs:149). The full battery then runs the matrix (BatteryIo::coverage_matrix): a D3 refusal fails it (a broken recorder is not an empty matrix); gaps fail nothing until U5.
D6. The gate
-
Required, over every operation of the nine specs: S1
success(happy), S2refusal(sad or evil), S3replayfor an idempotent route: POST, PUT, PATCH or DELETE whoseapplication/jsonor (U7)multipart/form-databody schema has aclient_request_idproperty in ANY$ref/allOf/oneOf/anyOfbranch. -
Provenance, check.
--checkand--blessrefuse unlessrun.jsonsayskind: full, itsrun_idis the records' and its tree hash, clean flag and spec digest equal the current ones.--check(a blocking full-battery step from U5) fails naming, with the route’s observing tests, each missing pair not in the baseline and each stale entry: any baseline entry not in the current required-but-missing set (observed, unserved or no longer idempotent). -
Baseline.
xtask/coverage-signatures-baseline.txt: sorted<service> <METHOD> <template> <signature>lines (#comments; absent = empty).--blessrewrites it, adding lines only when absent; hand edits need MR justification.
Scope
Order: U1 → U2 → U3 → U4; U7, and U8 after U2, merge before U5 → U5 → U6. Each unit is a child issue (labels
Plan::RUNTIME-COVERAGE-MATRIX, type, priority) on branch {type}/rcm-u<n>-<slug>. Every MR (U1 has none) carries its
CHANGELOG == Unreleased entry and named doc page (U3: none). U2’s MR sets In progress; nav entry to Active.
U1 — test(test-lib): census the test HTTP calls that bypass the harness client
Weight 2 · P3-low · no branch, MR or CHANGELOG: the census is recorded on the issue.
-
Inputs to re-count (2026-10-23): 236 raw
.send()sites in 90 files under/tests/(cases_url41,rules_url15, …); 30 raw sites in 12 craig-test-lib files outsideclient.rs; 30.oneshot(sites in 9 files under/tests/; 16 test files binding aTcpListener; 636MockServer::startcalls; armers outside D2 (fault/pg_terminate.rs, rawpg_terminate_backendSQL as atcraig-placement/tests/expiry_sweep.rs:1784,FaultInjectorflap/latency). -
Classes. M matrix service (
SERVICES, intake standalone URLs too); N other CRAIG service (keyring, web, portal); I infrastructure (IdPs, toxiproxy, RabbitMQ, mock-server, Garage; wiremock is one class); C cleanup; P in-process. -
The issue holds the per-site table (
path:line, class, target URL field), per-crate counts, the reproducing commands and the armers outside D2, explaining any count that differs from the inputs. It lists every M site and in-process matrix server for U3, and every P site with its.oneshot(URI for U4’s reachability follow-up.
U2 — feat(test-lib): record every harness HTTP request per test
Weight 5 · P3-low · feat/rcm-u2-record-http
-
Code. D1 and D2, plus craig-api’s inert
request_claims::IDEMPOTENT_REPLAYEDconst (the recorder reads it, U8 emits it). craig-test-lib’s[dev-dependencies](today onlytempfile) gainproptest = { workspace = true }; the one other new edge is craig-mq’sfault-injection→dep:craig-fault-core. -
Tests (
craig-test-lib/tests/recording.rs, a tempdirRecorder,s2s_stub::spawn_typed_response_server). Happy: a JSON POST records method, query-free path, status, bodycrid; multipart recordsKnown, andNonenull; a stub’s replay header recordsreplayed: true. Sad:RecorderConfig::resolveisNonewithout the dir orNEXTEST_TEST_NAME; an unregistered origin recordssvc: null,register_originsets it; a bad-URL builder returns its error, no file. Fault: a file as the dir panics, naming it;armedholds inside anArmWindowonly: not after its drop, for a zero-countOpCountdown/PreSendInjector, or after the exhausting consult (Erratum (2026-10-25): thePreSendInjectorandarm_stage_faultlegs are craig-mqfault.rsunit tests;maybe_failispub(crate)and craig-test-lib’s own tests build withoutfault-injection`). Proptest: `HttpRecord round-trips;parse_linenever panics. xtask: the version check takes 0.9.116, refuses 0.9.115 and unparsable output. -
Docs.
testing-reference.adocgains § HTTP recording under § Failure-path testing helpers; CHANGELOG=== Added. The issue gets the first green battery’s record count, bytes, file count and wall-time delta.
U3 — test: route the census’s matrix-service calls through the recorder
Weight 3 · P3-low · test/rcm-u3-route-census-calls
-
Each U1 M-class
.send().awaitbecomesrecording::send(builder, hint).awaitand every in-process matrix server U1 lists callsregister_origin; no assertion changes. The hint isFromBody(JSON only) for JSON,Known(crid)for a raw multipart form carryingclient_request_id(e.g.craig-placement/tests/api/portal_uploads.rs:51), elseNone. Sites left raw are on the issue with reasons; U1’s commands find no unlisted M site. CHANGELOG=== Changed.
U4 — feat(xtask): compute the coverage matrix from the battery’s recordings
Weight 5 · P3-low · feat/rcm-u4-runtime-matrix
-
Code. D3–D5 plus D6’s predicate.
matchit = "0.8.4"joins[workspace.dependencies](Cargo.lock:5019, via axum). -
Deleted. The old
coverage_matrix.rscrediting,coverage_matrix_mapping.rs,xtask/route-to-client-method.tomland its.unmapped.txt,enforce_route_client_mappingand its call (validate.rs:1209,:1282), subcommandCoverageMatrixMapping, flags--use-cache,--cache-path,--workspace,--emit-scorecard,--mapping-path,--floor(coverage_matrix.rs:96-131;--outputstays), orphaned helpers.api_docs.rs:245,:481andopenapi_registration.rs:31importcoverage_matrix::spec_routes. Reworded comments:lint_tokens.rs:51,lint_scan.rs:672-673,harness.rs:360,:374,:387,:649. craig-test-lib’stests/value_free_census.rsswaps itsservice_spec/read_cached_routespins (:220-223) forXTASKpins per new C2 hit; thespec_from_binarypin (:211) holds. -
Tests: one per D4 row; a
replayed: true2xx credits happy and replay, a 409 still credits sad; a re-sentcridwithout the header counts only inreplay_attempts; a failed test’s and a non-final attempt’s records are not credited; each D3 refusal; both health-floor refusals; the four non-matched outcomes; the spec-shape conflict; the reset; the manifest per battery kind; the predicate ($ref/allOf/oneOf/anyOf, multipart, never GET) and the realPOST /v1/financial/subsidy-agreements(CreateSubsidyAgreementRequest’s keyed arms, `crates/craig-financial-contracts/src/subsidy_agreements.rs:421). Proptests: the sweep matches a pairwise brute force (0–20 intervals); the JUnit scan never panics and round-trips a generated attempt count. After the first battery, U4 files one linked issue for the unobserved routes that only U1’s P sites reach. -
Docs.
operations/coverage-matrix.adocis rewritten (no committed baseline). Updated: thetesting-reference.adoccommand-table row;test-coverage-scorecard.adoc:106,:119;quality-gates.adoc:594(the coverage-matrix and coverage-matrix-mapping walkers),:696;CONTRIBUTING.adoc:313-319(stub prose);README.adoc:129-132(its "None of these are part of the pre-push gate" turns false). CHANGELOG=== Changed,=== Removed. Close #2636, #2637 and #2638 as superseded, with a pointer; comment on #888 that D6 supersedes--floor --enforce(U5’s MR closes it).
U5 — feat(xtask): gate missing coverage signatures with a shrink-only baseline
Weight 3 · P2-medium (the one gating unit) · feat/rcm-u5-signature-gate · after U4, U7 and U8 · closes #888
-
Code. D6:
signatures.rs,--check,--bless; anXTASKcensus pin per new C2 hit (therun.jsondecode). To seed: the branch’s first battery fails--check(no baseline),--blessseeds from that run, commit, push. -
Tests: an unbaselined missing pair fails, naming its observing tests; a stale entry fails (observed, unserved, no longer idempotent);
--checkreads no file as empty;--blessdrops stale lines, refuses additions, seeds an absent file; both refuse a missingrun.json,kind: scoped, a foreignrun_id, a tree or spec mismatch. -
Docs.
quality-gates.adocgains § Coverage-signature gate (with Risks' flapping rule); CHANGELOG=== Added.
U6 — chore(test): retire the // @axis: tags and the axis-coverage gate
Weight 3 · P3-low · chore/rcm-u6-retire-axis-tags · after U5 merges (U6’s own battery passes U5’s --check)
-
Deleted.
axis_coverage.rs,axis_sweep.rs,xtask/axis-coverage-opt-out.txt,enforce_axis_coverageand its call (validate.rs:523,:1051), theAxisCoverageandAxisSweepsubcommands and theirmod.rsdocs, andlint_scan::test_fn_headsif unused. Theaxis_coverage::ScanRegexescomment atplan_done.rs:80is reworded. -
Tags. All 11,870 line-leading
// @axis:tags go: a bare tag is deleted; each of the 221 prose tags keeps its prose as// <prose>. Three prose mentions are reworded:hold_release_upstream.rs:23,craig-mq/src/subscriber.rs:3298andcraig-auth/src/oidc_discovery.rs:587. Afterwardsgrep -rn '@axis' --include='*.rs'matches nothing. -
Docs.
quality-gates.adocloses § Axis-coverage enforcement gate, its:323xref and both axis walkers (:594). The suffix convention leavestesting-reference.adoc:1578,:1900andoperations/contested-environment.adoc:228. Plansafcars-dictionary-transcription,afcars-program,ive-determination-inputsandchanged-crate-mutants(its:299) each get a one-line erratum dropping the tag requirement and axis-coverage mentions.adr-078-afcars-cases-capture.adoc:202stays (history). CHANGELOG=== Removed. -
Close-out (as
plans/archive/battery-host-rows.adoc:212-215). U6’s MR closes #2301 and the plan: StatusDone (<date>) — !<U6>, agit mvintoplans/archive/, the nav line out, aplans/archive.adocrow in (MRs, as-built digest).cargo xtask plan-lint --doneon the archive path runs pre-merge with--allow-open 2301and--allow-missingfor the six cited paths that are deleted (xtask/route-to-client-method.toml,xtask/axis-coverage-opt-out.txt) or gitignored (D1’s and D5’s outputs), then onmainwithout--allow-open 2301, recorded in the closing note. No synced surface mentions@axisor the suffixes: local, nomacro-feedbackcomment.
U7 — fix(api): declare the multipart upload request bodies in OpenAPI
Weight 3 · P3-low · fix/rcm-u7-upload-request-bodies · production annotations and the docs renderer
-
Code. Each upload handler’s
[utoipa::path]gainsrequest_body(content = inline(<Form>), content_type = "multipart/form-data"),<Form>a[derive(ToSchema)]struct of the fields the handler parses: the file part (#[schema(value_type = String, format = Binary)]),client_request_id,file_sha256, the route’s kind field (first multipartrequest_bodyhere: read utoipa-gen 5.4.0’s docs first). craig-casesapi/report_attachments.rs:93,api/contact_attachments.rs:90,api/court_orders.rs:170(form parsed incourt_orders_multipart.rs); craig-exchangeapi/icpc/attachments.rs:61; craig-intakeapi/attachments.rs:261,:298(client_request_idoptional: the edge mints one); craig-placementapi/home_documents.rs:100,api/portal_documents.rs:207. -
Renderer.
render_request_body(api_docs.rs:570), today JSON-only, renders a multipart body as a field table too. -
Tests. Per service, a test beside its
ApiDocasserts each listed operation has amultipart/form-datarequest body with aclient_request_idproperty and a binary file property; a rendering test pins the field table. -
Golden. craig-cases'
openapi.sha256moves: runledger_lift_goldenwithLEDGER_LIFT_BLESS=1(it rewritestests/golden/ledger_lift/and fails by design), rerun it green, thencargo xtask dev reseedbefore the push. -
Docs.
cargo xtask api-docsrefreshesapi/craig-{cases,exchange,intake,placement}.adoc; CHANGELOG=== Fixed.
U8 — feat(api): mark replayed responses with Idempotent-Replayed: true
Weight 3 · P3-low · feat/rcm-u8-replay-header · production code · after U2 · merges before U5
-
Code. A craig-api
tokio::task_local!marker is set whererequest_claims.rs’s `classify(:465) yieldsClaimOutcome::Replay(claim_first:336,precheck:451) and whereresolve_claim(upload_attempts.rs:304) takesFetchPromoted/FetchSuperseded; a no-op unscoped. A layer inapply_global_layers(crates/craig-api/src/lib.rs:859; allrequest_claimsservices), just outsideceiling_middleware(:866; it stays innermost, spawns nothing), scopes it per request, addingIDEMPOTENT_REPLAYED: trueto a marked 2xx (the Stripe precedent): no per-handler edit. Intake’s edge (noApiServer,src/main.rs:895) relays it inrelay_response(api/attachments.rs:435) for its two proxied uploads (U7). -
Tests. craig-cases
tests/api/request_claims_routes.rs, replays viarecording::send(a rawshared_http_client()builder plustoken();ApiResponselacks headers): a same-id, same-intent replay carries the header (claim_first, and the safety route’sprecheckfast path); neither a first claim nor a key-conflict 409 does. An upload replay (upload_attempts_cases.rs, same dir) carries it; a first upload and an intent-mismatch 422 do not. A craig-api layer test: a marked 200 gets it, a marked 403 does not. Intake’sapi/attachments_tests.rsrelays it from a stub 200. -
Docs. A wire addition: CHANGELOG
=== Added;render_index_page(api_docs.rs:752) gains § Idempotency naming the header, regenerated intoapi/index.adoc; therequest_claimsrow atarchitecture.adoc:91names it too.
Out of scope
Recording oneshot tests, Playwright, SDK suites, the degraded stage; matrix rows for keyring, web, portal; gating conc
or fault; cross-route races; renaming tests; the synced category taxonomy; the B11 authz witness (it will read U2’s
records); the header on intake’s SubmitReportRequest routes (rebuilt at the edge, api/public.rs:354; U8 files it).
Risks
-
Observed is not asserted. A setup call’s 2xx credits happy; mutation testing stays the oracle for assertion strength. Bypasses are invisible: U1 counts them, U3 migrates them, the residue is listed on their issues.
-
Gate flapping. A signature seen only on a racy path flips between stale and missing. A required signature comes from a deterministic test; a flapping route is a test defect fixed under its own
fix:issue, never baseline churn. -
Precision. Clock skew can miss or add a conc credit; an armer outside D2 shows its 5xx unarmed; a fired single-shot armer (
arm_stage_fault,PgFaultArmer) stays armed until dropped, so a later 5xx creditsfault. None is gated. -
Size and cost. U4 (~7k deleted lines) and U6 (11,870 tag lines) exceed the 500-LOC guidance yet stay one MR each: U4’s cuts are one replacement’s compiler-reported fallout; U6 is one mechanical rule, reviewed as the rule plus the empty grep.
ci-integrationbuilds nine debug binaries for the specs; U4 posts the delta.
Review log
| Round | Vendor | Resolved model | Verdict |
|---|---|---|---|
1 |
Anthropic |
Claude Opus 5.5 (fresh subagent) |
no-ship (5 blockers, folded) |
2 |
OpenAI |
GPT Astra |
no-ship (12 findings, folded) |
After round 2: three independent fold checks (a per-finding checklist, an adversarial gap hunt, a residue verifier), each folded; the residue verdict was clean.