Plan: cross-process chaos harness — phase 2, contested-environment parity (epic &80)
Status: In progress
Epic: &80 — prior art &50 (phase 1, closed)
Children: #1589–#1605 (filed 2026-08-25)
Phase 2 — contested-environment parity (epic &80)
Why
CRAIG (sibling project, gadhs/application/ccwis/craig) ran a 25-unit
contested-environment program (their epic &83, closed 2026-08-21): adversity —
severed connections, black-holed sockets, fault schedules, crash residue,
bursts — became a first-class deterministic test input, backed by a
per-surface registry and a blocking ratchet. Yield: ~32 findings, 15
product-code defects, clustered in exactly four families — broker liveness
(their worst: an AMQP path accepting TCP but never answering pinned a consume
supervisor forever), unbounded awaits, auth-plane error handling (5 defects
from wiremock alone), and write-path degraded UX (every mutating form lost all
typed data on a backend blip). Their burst/ordering floods and pool-contention
rig found zero product defects.
A four-reviewer parity assessment (2026-08-25; architecture, tooling/style, coverage/findings, canopy inventory + synthesis) mapped that program against canopy. Canopy is at or above parity on several capabilities (below) but has eight real gaps, and canopy’s two known unbounded awaits (#1320 write verbs, #1587 auth-exchange leg) sit squarely in CRAIG’s highest-yield defect family. This phase closes the gaps; the doctrine and enforcement spine keep them closed.
What canopy already has (do not redo)
-
Race/barrier harnesses — ADR-038 finalize race matrix (
finalize_acceptance_test.rs), watch-channel-driven idempotency lease-steal suite (idempotency_concurrency_test.rs), 16-racer breaker probe, advisory / window-fence election tests, multi-replica fixture. At parity with CRAIG’sconcurrent.rs; no unit filed. -
Duplicate-delivery convergence — pinned across eligibility, renewals, security, notices, scheduler fencing. CRAIG’s dup storms found zero defects.
-
Lane partitioning — set-verified disjoint lanes (
test-lanes-lint --verify-partition); ahead of CRAIG’s run-ignored monolith. Phase-2 gating lands as a new verified lane, never--run-ignored=all. -
L7 fault injection —
EvilLayer(latency jitter, failure rate, connection drop, payload tamper — tamper is ahead: TCP toxics cannot express it), per-servicefail_on_step/commit_then_fail_on_stepmocks, the shipped phase-1 chaos module. -
Compile-stripped fault surface —
/test/fault+ thetest-faultfeature (#1325): absence-by-construction, a stronger model than CRAIG’s default-off feature fields. Read-path degraded-page e2e already proven (tests/e2e/specs/fault-injection.spec.ts).
Gaps (ranked by expected yield)
-
AMQP transport severance/black-hole — no true-severance tooling (
EvilLayerreturns 502s rather than dropping sockets); the lapin no-reconnect trap is documented-and-accepted (xtask/src/cmd/e2e.rs:288). CRAIG’s worst defects were inexpressible in-process. -
Timeout legs on the known unbounded awaits — #1320 (write verbs), #1587 (auth exchange). Highest yield-per-weight; needs no new infra.
-
Auth-plane contested contract — JWKS/discovery/introspection under adversity; the phase-1 chaos harness is a ready substrate.
-
Write-path degraded-UX browser legs — form-data preservation, outage-renders-as-outage, redirect honesty under IdP outage.
-
Silent-skip — 3 of the 4
evil_proxy_test.rschaos tests, all 4 multi-replica tests, and all 3 reconnect tests are#[ignore]opt-in, structurally never running (onlyjwks_rotationruns in the default battery): the exact pattern CRAIG deleted. Multiplies every other gap’s yield. -
Crash-residue reap — sweeps/workers have races tested but not crash-window residue (a crashed run stranded as in-flight forever).
-
Pool exhaustion + typed DB degradation posture — lowest defect yield, but canopy lacks the production posture (phase-aware acquire/statement/ commit error taxonomy,
Retry-After) entirely. -
CLI lost-response recovery (verified during this review — CRAIG’s C18 class is real here) —
tools/canopy-cliissues POST/PUT/DELETE across applications/persons/renewals with zero idempotency-key handling; a rerun after a lost response may double-apply.
Doctrine (ratified in U1)
-
Deterministic adversity: force the condition (barrier, fault schedule, severed proxy), never load-at-scale hoping to hit it.
-
Two-path rule: a graceful protocol close and a TCP severance are different failures; every MQ surface needs both. Record the lever rationale in-code at the call site.
-
Lever taxonomy: L1 in-process (
EvilLayer, the in-treemock.rsrouters, per-service mocks, crash armers) · L2 transport (toxiproxy) · fault surface (compile-stripped features). L7 tampering staysEvilLayer; severance is L2’s job. No wiremock: canopy’s hand-rolled mock routers already cover the shape, per the hand-rolled-over-wrapper divergence. -
Never make the battery easier: timeout budgets are fixture ceilings, never assertion widening; zero serialization/envelope hunks unless semantically required and called out; breach needs a plan amendment.
-
Seed-and-replay: every randomized draw env-pinned, failure output prints a copy-pasteable replay command.
-
Arbitration: GREEN (fix the fixture, never easier) / RED (real defect
seeded repro) / CANNOT-RUN (fault-layer owner). Transient/environmental is never a terminal disposition. A zero-fault green battery is a FAILURE once accounting (U13) lands. -
Non-vacuous oracles: reconnect must land on a connection whose name differs from the pre-sever capture; barriers derive from the app’s own constants, never round numbers.
-
Honest claims: in-code residue lists name what a gate cannot prove; "machine-enforced absence", never "impossible"; closeout counts separate product defects from test-infra/tooling/residue.
Deliberate divergences from CRAIG
-
Keep canopy’s set-verified lane partition (fault = a new verified lane).
-
Keep the compile-stripped fault-surface model; the cargo-tree gate (U16) is belt-and-suspenders, not the primary control.
-
Typed
thiserrorerrors everywhere in NEW phase-2 code, test-lib included (noanyhowat pub boundaries). Phase-1’s shippedspawn_outbox_drainer_for_chaosanyhowboundary is grandfathered; retrofit only if a unit touches that file. -
Skip the 6-axis tag lint — coverage forcing comes from the registry ratchet (U12), which is machine-decidable.
-
Skip the Postgres port-lease allocator until contention is measured (the integration lane is 4-thread; nextest test-groups serialize).
Units
Weights are implementation complexity (1/2/3/5/8). Issue refs are appended
to each Unit cell (as #N) when children are filed under epic &80.
| Unit | Scope + acceptance criteria | W | Status |
|---|---|---|---|
U1 (#1589) |
Doctrine (docs). ADR-020 Amendment 1 — the contested-environment doctrine above, verbatim; Testing gains the doctrine section + the never-easier checklist as a blocking review item; CHANGELOG. |
2 |
Done (2026-11-18) |
U2 (#1590) |
EvilLayer determinism retrofit. Replace the unseeded |
2 |
Done (2026-11-18) |
U3 (#1591) |
Toxiproxy fault layer in the devstack. Opt-in compose |
5 |
Done (2026-11-19) |
U4 (#1592) |
MQ two-path contested legs. Per consumer surface: graceful mgmt-close
AND proxy-disable severance; establishment black-hole leg (TCP accepted,
never answered) against consume supervisors; outbox-drainer severance
catch-up (backlog slope ≤ 0 after heal); publisher-channel invalid-state
confrontation of the documented lapin trap ( |
8 |
In progress |
U5 (#1593) |
DB + object-store L2 legs. Acquire/statement/commit-phase severance on canopy-db (per-phase behavior pinned); ambiguous-commit pin (severed between COMMIT send and ack ⇒ outcome-unknown, no double-apply); canopy-store timeout + ambiguous-put legs. |
3 |
In progress |
U6 (#1594) |
Deadline audit + timeout legs for S2S write verbs. Inventory every
S2S write call’s deadline posture (the #1320 class); an |
5 |
In progress |
U7 (#1595) |
Auth-plane contested contract. JWKS refresh under non-200 (a proxied
503 must not wipe the live key cache); discovery outage classified as outage,
not not-configured; introspection/validation clock-skew leeway pinned against
token exp/nbf; JWKS stale-serve bound; RFC 8693 exchange deadline (#1587).
Substrate: |
3 |
Not started |
U8 (#1596) |
Degraded-UX write-path e2e legs. Mutating-form data preservation on
backend failure; outage renders as outage (never 404) on detail + write
handlers; download/login redirect honesty under IdP/backend outage.
Status/latency legs ride |
5 |
In progress |
U9 (#1597) |
Crash-residue armer + reap legs. A crash armer in canopy-test-lib
(CRAIG’s |
5 |
In progress |
U10 (#1598) |
Pool-contention rig. Pinned contender matrix vs canopy-db’s
|
3 |
Done (2026-11-20) |
U11 (#1599) |
DB degradation posture ADR + typed taxonomy. Phase-aware mapping —
acquire timeout ⇒ 503 + |
5 |
In progress |
U12 (#1600) |
contested-surfaces registry + AST census + per-class ratchet. Typed
|
8 |
In progress |
U13 (#1601) |
Executed-fault accounting + program gate. Fault-record primitive (countdown + recorder); reset/verify stamp pair around the battery; armed ⇒ fired; per-class fired floors starting mq-class only (U10’s rig emits fault records and adds the pool floor when it lands — U13 sits before U10 in the suggested order, so the floor set must not assume the rig); honest in-code residue list naming unrecorded classes. |
5 |
In progress |
U14 (#1602) |
Fault lane + silent-skip deletion. Promote the 10 |
3 |
Done (2026-11-20) |
U15 (#1603) |
Arbitration runbook (docs). GREEN/RED/CANNOT-RUN ladder; transient-never-terminal; capacity attribution only via a recorded GREEN; seeded-replay instructions. Extends the chaos runbook. |
2 |
Done (2026-11-18) |
U16 (#1604) |
Release-artifact gate. A cargo-tree assertion in |
1 |
Done (2026-11-18) |
U17 (#1605) |
CLI lost-response/idempotency legs. Characterize canopy-cli’s recovery
contract for its mutating verbs (verified: zero idempotency handling in
|
2 |
Done (2026-11-18) |
Total ≈ 67 weight vs CRAIG’s ~97 — the discount is the standing inventory above. Plan-drift fix #1588 (weight 1) closed 2026-08-25 with the MR that landed this phase-2 section.
Dependency spine + suggested order
Hard blocks (encoded as GitLab blocked-by at filing): U3 → {U4, U5, U8, U14}; U12 → U13; U10 → U11.
Suggested order (yield-first): U1/U2 → U6 + U7 + U17 (no infra, highest yield-per-weight) → U3 → U4/U5 → U9 → U8 → U12 → U13/U14 → U10/U11 → U15/U16.
Skip list (evidence-backed)
-
Barrier/race harness unit — at parity (inventory above).
-
Burst/ordering flood legs — CRAIG harvested zero product defects; canopy duplicate-convergence already strong. The per-consumer ordering-contract declaration lands inside U12; the seed retrofit is U2.
-
Cluster docker-kill rig (their C20/L3) — deferred; the multi-replica fixture + RabbitMQ-restart tests cover most of the value. Revisit after U4 confronts the lapin trap.
Verification (phase 2)
-
Every unit: the full pre-push battery (the sole functional gate).
-
U3:
cargo xtask fault-preflight --requiredgreen on a fault-profile devstack; compose-drift pin test green. -
U12/U13: ratchet + program gate run inside
cargo xtask validate; a fabricated uncovered surface / unfired armed fault fails the battery (negative test). -
U14: the fault lane appears in the verified lane partition; deleting a lane test breaks the nextest inventory check.
-
Program closeout: defect census counted product vs test-infra vs residue (honest-claims doctrine).
Links
Epic: &80 (phase 2) — prior art &50 (phase 1, closed).
Children: #1589–#1605 (filed 2026-08-25; refs in the units table).
Related issues: #1320 (write-verb bounds — U6 pins, #1320 fixes; open);
#1587 (exchange deadline) and #1271 (ELE fault harness) closed after filing —
see Errata; #1588 (plan drift) resolved by the 2026-08-25 scope-expansion MR.
Provenance: four-reviewer parity workflow, 2026-08-25 (session artifact;
CRAIG evidence cited against gadhs/application/ccwis/craig at its
2026-08-25 state, incl. their contested-surfaces.toml, ADR-067/ADR-068,
xtask contested.rs/program_gate.rs/fault_preflight.rs, and issues
CRAIG-#1520–#1547).
Errata
-
Erratum (2026-09-16): #1587 (the exchange leg of worker write actions is bounded) and #1271 (the ELE sweep fault-injection harness) closed after this section was drafted; U6 and U7 keep the write-verb (#1320) and the JWKS / discovery / introspection legs, and #1271 is prior art rather than a sibling to relate.
-
Erratum (2026-09-16):
eligibility_circuit_breakerruns in-process in the default lane since #1860, socrates/canopy-test-lib/tests/evil_proxy_test.rscarries two#[ignore]-gated tests today (inbox_dedup_at_100_percent_failure,outbox_catches_up) and its header comment already says only those need the devstack — U14’s promotion set is those two plus themulti_replica_test.rsandreconnect_test.rssuites, and its header-comment sub-task is done; Gap 5’s "onlyjwks_rotationruns in the default battery" is superseded the same way. -
Erratum (2026-09-16): the
e2e.rs,lib.rsandevil.rsline anchors in the Gaps list and the unit table are as of 2026-08-25 — grep by name (the lapin no-reconnect comment,acquire_timeout,rand::rng()). -
Erratum (2026-11-18): the maintainer ratified this phase on 2026-11-14 (recorded on #1589), so the draft banner and the
planning::needs-plannote on the children are removed and the Status is In progress. -
Erratum (2026-11-18): U16's gate is its own verb,
cargo xtask shipped-features, run byvalidateand the car's lint step, and it refuses anytest-*feature of a workspace crate, nottest-faultalone. It reads the dependency graphs of the three builds the release job runs (services, CLI, portal server), not the Dockerfiles, which only copy those builds' output. -
Erratum (2026-11-18): U17's lost-response shape lives in canopy-cli's own loopback recorder (
tools/canopy-cli/src/cmd/request_recorder.rs), which the CLI's command pins already drive, not in canopy-test-lib'smock.rs. The unit pins the contract as it stands (a rerun is a new key, or none); the defect it found is #3473. -
Erratum (2026-11-19): U3's image is pinned by tag (
ghcr.io/shopify/toxiproxy:2.13.0), not by digest: the maintainer ruled on #1591 that the tags-only rule for container images (#2631) covers it. Its third mirror is the upstream the devstack runs (Kanidm by default), not Keycloak specifically. Its ports are fixed loopback ports rather than a sampled range, so the pin test compares constants. The client swallows no teardown error, so it carries noSILENT-OKmarker: a guard'srestore()returns its failure and an unreleased guard panics. The preflight proves each mirror against the running devstack; it is not avalidatestage or a car step, since no lane starts the layer until U14. -
Erratum (2026-11-19): U4's first legs (
crates/canopy-mq/tests/reconnect_test/contested.rs) cover the plain subscriber and the outbox drainer and are opt-in (--run-ignored only) until U14's lane. They found #3475 (an unanswered connection attempt hung reconnect for ever), fixed separately. Not yet written: the batched, exclusive and broadcast subscriber surfaces, and the publisher-channel confrontation. -
Erratum (2026-11-19): U5's database legs (
crates/canopy-db/tests/db_test/contested.rs) pin a canopy-db pool through thepostgresmirror at the acquire, statement and commit phases, opt-in until U14's lane. The ambiguous commit is pinned at the driver: the commit call errors although the server committed, and a retry under the same key is refused as a duplicate. No canopy code records an outcome as "unknown" today, so nothing is asserted about that. Not yet written: the canopy-store timeout and ambiguous-put legs, which need a mirror in front of the object store that the fault layer does not have. -
Erratum (2026-11-19): U9's armer is
canopy_test_lib::crash_armer::CrashArmer. It arms one table: a statement-level trigger counts writes through a sequence and terminates the session issuing the Nth, once. Its guard is an allow rule, not a DSN denylist: it arms only in a schema namedtest_…, which is what a test'sEphemeralSchemais. Of the four reap legs, the scan worker's is written (a_worker_killed_before_its_settle_strands_the_row_until_the_lease_lapses): a worker killed between claim and settle leaves the row claimed, and it looks in flight until its lease lapses, when the next drain reclaims it. So is the enact sweep's (a_sweep_killed_inside_the_enact_strands_its_claim_until_the_lease_lapses): a pass killed inside the enact leaves the actionscheduledunder its claim, the enrollment untouched, and the first pass after the lease enacts it. So is the renewals scheduler's (a_pass_killed_mid_drain_leaves_whole_certifications_and_the_next_pass_finishes), for its renewal-due drain: that drain holds no claim, so a killed pass strands nothing; each certification's event and fence commit together and the next pass emits the remainder. And the chain drainer's (a_drainer_killed_at_its_dequeue_chains_nothing_and_the_next_drain_resumes, canopy-security's audit staging drainer): a segment is one transaction, so a drainer killed at its dequeue chains nothing and the next drain chains every row once. Not covered: the scheduler's other legs (interim contacts, periodic reports, expiration notices) and the FTI chain's append path in canopy-medicaid and canopy-tanf. -
Erratum (2026-11-20): U14's lane is
cargo xtask test --fault, selected by module path (FAULT_FILTER: acontestedmodule of atests/target) and held in the verified partition beside the unit and integration lanes; the car runs it. It takes in the eight fault-layer legs of U4 and U5. The two devstack-onlyevil_proxy_test.rstests and the chaos outbox helper's test use no fault layer and no container restart, so they lose#[ignore]and run in the integration lane, each on an outbox of its own. Still carrying#[ignore]: the three broker-restart tests (they bounce the broker every other test shares; fixed in #3478) and the four multi-replica tests (their fixture no longer boots a replica and they assert nothing, #3395). -
Erratum (2026-11-20): U8's first leg is
tests/e2e/specs/fault-write-paths.spec.ts, in thefaultPlaywright project the car runs: form-data preservation on the intake section save, and the case page answering a failing canopy-applications with a 500 "Something went wrong", never the 404 an unknown case gets. A notice download with canopy-notices failing answers 502 and an error page, not a PDF or a redirect. A SNAP process-page write action with canopy-applications failing answers 502 "Couldn't load the application", where an unknown application answers 404, and neither redirects. An uploaded, scan-cleared document's download with canopy-applications failing answers 502 and an uncacheable error page, with none of the document's bytes. A case action (recording a TANF interim contact) with canopy-renewals failing sends no success redirect and says the contact was not recorded; healthy, it redirects onto the case. That leg found #3480: the failure is a bare page on HTTP 200 that names the upstream. Not yet written: login redirect honesty, and any true-severance leg through the fault layer's mirrors. -
Erratum (2026-11-20): the three broker-restart tests are in the fault lane too (
crates/canopy-mq/tests/reconnect_test/broker.rs, under thecontestedmodule). Each bounces the one broker the stack shares, so each ends by waiting until every service queue has its consumers back. Of U14's promotion set only the four multi-replica tests still carry#[ignore](#3395). -
Erratum (2026-11-20): the multi-replica tests are three, not four, and run in the fault lane (
crates/canopy-test-lib/tests/multi_replica_test.rs, #3395). Each now drives a workload and reads its invariant: an event on two audit queues is chained once and the chain does not fork; rows in an outbox three drainers share are each published once; an event for browsers reaches every canopy-web replica's own queue. The fourth, an inbox dedup race on canopy-eligibility, is deleted: the audit test exercises the same inbox path across processes. With that, nothing in U14's promotion set carries#[ignore]. -
Erratum (2026-11-20): U12's first slice is
cargo xtask contested-surfacesovercompliance/contested-surfaces.toml, avalidatestage and a car lint. It censuses the broker seams of canopy-mq and every production consumer;Subscriber::subscribeandOutboxDrainer::spawnare promoted on the U4 and U14 legs, five subscriber variants are report-only, and all 39 consumers are registered with their ordering contract undeclared, each count locked by the register's[ratchet]. A leg is checked by parsing its file for a test function of that name that is not ignored, not by a nextest listing, so the gate needs no build. Not yet censused: sweeps, background workers and service-to-service clients. -
Erratum (2026-11-20):
Subscriber::subscribe_broadcastis promoted on two legs of its own (graceful close, severance), whose oracle adds that the attach hook ran a second time. Four subscriber variants stay report-only; three of them (subscribe_raw,subscribe_with_options,subscribe_exclusive) have no production caller. -
Erratum (2026-11-20): U13's record is
canopy_test_lib::fault_ledger, a directory of armed and fired markers the fault lane resets before its run and verifies after it (cargo xtask test --fault), not a stage ofvalidate: the lane is where faults are armed. Every severance and toxic on the fault layer is recorded armed by the control client; a test marks it fired after the assertion only the fault explains. The broker class has a floor of one; the database class is counted without one. The unrecorded classes are listed inUNRECORDEDand printed by each run. -
Erratum (2026-11-20): the ledger now also records the broker's graceful close and its container's restart, stop and replacement, each armed by its test and marked fired on an observation only that fault explains. Three kinds remain in
UNRECORDED: the crash armer's ended session, HTTP faults fromEvilLayeror a mock router, and the services'/test/faultsurface. -
Erratum (2026-11-20): U10's rig is
crates/canopy-db/tests/db_test/pool_contention.rs, in the integration lane: six cells of pool size by contenders, each winner holding 7 s against the 5 s bound. It asserts only the split (as many winners as connections, the rest timed out between the bound and two seconds past it) and writestest-results/pool-contention.json, which the car keeps as an artifact. Over two runs on the devstack every timeout was reported 5,000 to 5,002 ms after the acquire began, and a winner that needed a new connection waited up to 140 ms. -
Erratum (2026-11-20): U11 has a plan and a decision record of its own, database-degradation-posture and ADR-053, approved by the maintainer on 2026-11-20 in six units. It adds a fleet-wide statement budget (30 s on every service pool) and a typed commit to what this row lists.
-
Erratum (2026-11-21):
Subscriber::subscribe_raw_batchedis promoted on two legs of its own (graceful close, severance), whose oracle is that every event is handled exactly once across the fault. Three subscriber variants stay report-only (subscribe_raw,subscribe_with_options,subscribe_exclusive); none has a production caller. -
Erratum (2026-11-21): the publisher-channel confrontation of U4 is a severance leg for a drainer with no subscriber on its connection. It found no defect: the drain loop's own reconnect recovers it, and the leg fails without that reconnect.