Skip to main content

DB workflow rationale

This history was moved out of .github/workflows/db.yml when the workflow reached GitHub’s 500 KiB workflow-file limit. It remains the rationale for the load-bearing filter, gate-integrity, and derived-coverage controls.

Proofs run in the merge queue and nightly, not per PR (#4431)​

Measured before this change (2026-11-10/11): the three ~110-minute producers ran on every DB-relevant pull_request, so the required Migrate Up + Down could not finish until all three did. A docs PR that deleted two scripts (#4439) waited two hours. Two or three concurrent runs on the one Hetzner box flaked (teardown DROP DATABASE 20 s, go test 300 s), and rerun-failed-jobs cannot recover a red verdict, because the verdict refuses receipts from another run attempt by design.

Now, per event:

  • pull_request (draft or ready): the producers are skipped by the job-level && github.event_name != 'pull_request'. migrations still executes. Its Gate integrity accepts exactly those three as skipped with no outputs, and only because DEFERRED_ON_PULL_REQUEST names them and the runner's event is pull_request. check-db-proof-verdict.py independently requires the same and writes status: DEFERRED, proofs: deferred-to-merge-group. Nothing is downloaded, and a present download root is refused.
  • merge_group: unchanged and fail-closed. A relevant diff runs every proof (proofs: executed). A diff off the allow-list runs the existing executed no-op receipt protocol (proofs: not-relevant), which takes minutes and still binds run, attempt, event and source.
  • schedule (01:23 UTC, main): changes.outputs.db is forced 'true', so every proof runs against main whatever the allow-list says. The comparison base is main's first parent (write-db-proof-receipt.py context and both selector-baseline readers). Fail-closed like the queue.

The nightly has its own concurrency group and is not serialised with merge_group. A shared group would queue merge builds behind a 110-minute nightly or behind an ejected entry's still-running run, and would cancel pending queue builds once maximumEntriesToBuild exceeds 1. The residual risk is the nightly sharing the box with a queue build at 01:23 UTC, the quietest hour measured.

Merge-queue fail-fast (#4483)​

Measured on the 20 red merge_group runs among db.yml's 100 most recent queue runs (2026-10-27 to 2026-11-15) in which a producer failed: the required verdict reported a median 43.0 min after the first producer failure (max 68.0), and the other producers burned a median 60.4 slot-minutes (1,030 in total) after the outcome was already decided. GitHub does not cancel sibling jobs when one job fails, and the queue ejects only on a required check's failure/cancelled.

Each producer therefore has a canceller job, cancel-on-<producer>-failure: needs: <producer>, if: failure() && needs.<producer>.result == 'failure' && github.event_name == 'merge_group', on ubuntu-latest with a 3-minute job cap. Its one step (2-minute cap) runs /usr/bin/curl --max-time 30 to POST actions/runs/<github.run_id>/cancel. HTTP 202 is accepted, and so is 409 when a sibling got there first. Anything else is red. It starts only after the producer job has finished, so the failing producer's always() receipt, upload and export have already run and its full evidence is uploaded. The run cancel stops the sibling producers, because their job if: uses !cancelled(), and their own always() capture steps still upload what they have. The verdict is if: always() and is not a dependent of any canceller, so it still runs and refuses. check-db-proof-verdict.py requires result == 'success' for every producer, so a cancelled sibling, a missing execution output, or every producer cancelled is a refusal and never a PASS. The event gate excludes the nightly, so the nightly still reports every producer's failures from one run. The trigger is the producer's failure conclusion only: a producer that hits its 110-minute job cap is cancelled by GitHub, concludes cancelled, and no canceller fires. The verdict still refuses, and the siblings are then within minutes of their own caps, so the lost saving is near zero.

Token boundary (backend-security review on #4528): actions: write lets a token cancel or delete runs, logs and artifacts and workflow_dispatch other workflows. Giving it to the producer jobs was refused, even scoped to one step's env. Those jobs run the composed tree and third-party code for up to 110 min, and anything an earlier step writes to $GITHUB_ENV or $GITHUB_PATH reaches every later step. So only the three canceller jobs hold actions: write, and nothing else. They have no checkout, no uses: and no repository code, and they run on a fresh hosted VM. The run id comes from github.run_id in a format() expression, never from repository input. The producers declare permissions: contents: read and set persist-credentials: false on every checkout. db_proof.workflow_contract pins all of it twice: once against the pinned copy in db-proof-contract.json (cancellers), and once structurally, so that a joint workflow+contract edit is still refused. It also refuses any other job holding more than contents: read and any job that needs: a canceller. The cost is about 1 hosted minute per red queue build, and nothing on a green one. A single polling canceller job was rejected: it would hold a slot or about 60 hosted minutes on every queue build.

Orphans: cancel-in-progress now also covers merge_group. The group is DB Migrations-<github.ref> (github.workflow is the workflow name) and the ref is gh-readonly-queue/main/pr-<N>-<base>; in the same 100 runs, 14 refs were reused (by a re-enqueue of the same PR on the same base) and every reuse had a new head SHA, so the cancelled orphan's check-runs land on a commit the queue no longer evaluates. Orphans of a different ref are cancelled by hand (landing-a-pr.md §3).

Proof-input allow-list​

The db rule replaced the #2465/#2544 deny-list. The deny-list's argument was the degradation direction: on a REQUIRED gate a forgotten glob was a silent green. That argument binds less now, for three reasons. First, the rule no longer decides any PR verdict. Second, a miss in the queue is caught by the unconditional nightly within a day. Third, scripts/check-db-proof-relevance.py runs on every changes job: it derives the proof inputs from the producer and verdict jobs, plus the scripts they execute and those scripts' imports, and reds on any input outside the list. check-required-check-gating.py rule 6b admits this one allow-list only while all four of those conditions hold. Entries, each the narrowest one covering a derived input:

EntryWhy it is an input
.github/**db.yml itself; verify-repo-source-g2a.sh runs the workflow scalar, size and gating checkers over every workflow and action file
Makefilemake migrate-up / make migrate-down
go.mod, go.sumevery go command
cmd/**, internal/**, pkg/**, test/**the go test/go build/go vet packages and their closure, including SQL migrations under internal/context/store/migrations, go:embed targets and testdata
proto/**services/agent-worker/scripts/generate_protos.sh compiles proto/
services/**the agent-worker tree the producers test and generate into (services/agent-worker/**), plus the code-exec boundary the orchestrator suite reaches
deployments/**the G2 Kustomize renders and selector baselines
deploy/**the process proof mounts deploy/seeds
dev/**dev/pgbouncer/pgbouncer.ini, dev/postgres/*.sql
hack/**hack/rls-check.sh, hack/verify-migrate-role.sh
docker-compose*.ymlthe render and process proofs read the dev, registry and tenant compose files
scripts/**the proof harness: more than 45 scripts in the executed closure, many invoked through argv lists built at runtime, plus db_proof.py, db-proof-contract.json and prepare-merge-group-diff.py
tests/ci/**, tests/scripts/**test_merge_group_paths_action.py and the unittest discover -s tests/scripts proof self-tests
docs/runbooks/repository-source-memory/**measured JSON/gzip inputs of the process proof (#4185)

Not inputs, so they no longer select the proofs in the queue: Markdown and assets outside those trees, the rest of docs/, docs-site/, tasks/, ui/, frontend/, src/, infra/, tools/, .claude/, .codex/, the root Dockerfile and root config files. If one of these becomes an input, the guard says which one and which script named it.

G2 proof as three sibling producers (#4245)​

Item A stage 1 of #4504. Measured in comment 6908332385 on #4245 (10 merge_group runs, 2026-11-14 to 11-15, timings from each run's own G2 artifact): the one G2 step took a median 64.8 min (p90 69.5). Of that, the G2a producer took 49.7 (its mutant battery 38.5), acquisition-memory 12.6 (two real 302 s cache-expiry idles), and everything else about 2.5. Only the final checker reads more than one producer's output. The design is comment 6908523093, option (a). Vaisakh approved it on #4245 (comment 6908828532, 2026-11-16) after the 2026-11-14 email ruling. Stage 2 (family sharding of the battery) is not part of this change.

joborchestrator partproducers (unchanged argv, same order)needsjob / step cap (min)
source-g2a-proofg2ag2a-producerchanges83 / 81
source-g2b-proofg2bg2b-unit-producer, g2b-unit-checker, g2b-mutant-producer, deployment-checker-selftests, render-producer, isolated-fakes-producerchanges10 / 8
source-g2-memory-proofacquisition-memoryacquisition-memory-producerchanges, source-g2b-proof22 / 20

No proof content changes. repo-source-g2-proof.py NEW_OUTPUT PART runs only that part's commands, with the argv and in the order the full run uses, and writes a part ledger (part) and part-g2-receipt.json. A part never runs the final checker. With no PART the local full run behaves exactly as before (ledger part: all). Every arm, mutant, idle and checker still runs. The 302 s idles are not shortened. check_idle_pins in the final checker makes Vaisakh's "do not shorten the 302 s idle" mechanical. It requires sourceCacheIdle to stay 5 * time.Minute and the one real wait in repo-source-process-proof.py to stay ≥ 300 s. A 200 s mutant of either is red (IdlePinTest). The evidence check >= 300 on each recorded idle is unchanged.

The final G2 checker moves to the verdict. check-db-proof-verdict.py already ran it independently. It now passes the three part roots as repeated --execution-root. check_execution_ledgers accepts one all ledger, or exactly one ledger per part, each holding exactly its part's IDs, and their union must be exactly LEDGER_IDS. The envelope runs once in --union mode: each part receipt must be PASS at the checkout HEAD, and every part must be present exactly once. The raw-validator count is unchanged by this split: 128 (118 + 10 G3c after #4474); #4568 later adds one raw guard (proof-146), making 129. Each sibling's module receipt is checked against the tested checkout. Each process mode's image inspections are checked against its own sibling's acquisition: g2b covers isolated-fakes, acquisition-memory covers itself, and g2a gets a shape check only.

Same attempt. Each sibling is a contracted producer in db-proof-contract.json (producers, required_needs, cancellers, with per-producer needs and timeout-minutes). Those are also pinned as independent literals in db_proof.py (G2_PARTS, PRODUCER_NEEDS, PRODUCER_TIMEOUTS). So the verdict refuses a missing, skipped, failed or cancelled sibling, and any receipt from another run, attempt or tested SHA, exactly as it does for db-proof and source-proof. Each sibling has its own cancel-on-<producer>-failure canceller (#4483).

Slots. Before this change one queue build held 3 Hetzner slots (db-proof, source-proof, G2). The memory sibling waits for source-g2b-proof, so the peak is 4 slots. It costs no wall time: g2a (about 51 min) is the critical path either way, and the measured projection is the same −9.6 min chained or parallel. The fifth slot would buy nothing and take PR-lane capacity. The residual cost is one re-queue: the memory job (about 4 + 14 min) has about 33 min of slack before it could become the critical path. Stage 2 (family sharding of the battery) is what shortens the critical path. Slot-minutes per relevant build rise by about 3.0 (median, 66.5 → 69.5), because each job pays its own setup and upload. Projected from the same 10 runs, the G2 wall falls from a median 66.5 to 51.4 min. The queue build's producer closure falls by a median 9.6 min (p90 10.5), because db-proof (median about 58 min) becomes the critical path. All of these are projections; the first merge_group run after landing is the measurement.

Caps are max(p90 × 1.5, p90 + 5 min), rounded up, so a 1-core slot under load keeps headroom. Step p90s: g2a 53.4 → 81, memory 12.8 → 20, g2b 2.9 → 8. Job p90s (step + setup 0.75 + teardown 0.88): 55.0 → 83, 14.4 → 22, 4.5 → 10. The older #4300 sample (run 40181693665, 86 min before acquisition) would exceed the g2a cap. A producer cap hit is a red verdict and a re-enqueue, not a lost queue window. The queue window is checkResponseTimeout 14400 s; re-read it live. This replaces the old 120-minute step cap and its #4300/#4220 composition note.

Isolation. Each sibling runs on its own slot, and a slot's dockerd and /tmp are wiped per job (ci-runner-box.md, slot anatomy). Siblings therefore cannot share a container, database, network or published port. Container names inside a job are unchanged, which keeps the proof content unchanged. Names shared across the run are unique per job: the export artifact db-proof-<job>-<run_id>-<attempt>-<sha> and the raw upload repository-source-g2-<part>-<run_id>-<attempt>-<sha>.

Equivalence acceptance. On the first relevant merge_group run after landing:

  • the three part ledgers' union equals LEDGER_IDS;
  • g2a-regression/mutants/receipts.json holds the same 60 receipts;
  • each process report.json matches the prior single-job artifact on its content fields;
  • the verdict records 128 raw validators (118 + 10 G3c);
  • per-stage timings are posted on #4245.

Parallel repository-source proof ownership (#4220 / #4225)​

The required check name and migrations job ID remain unchanged. Its first Gate integrity body remains byte-identical to the other required gates. The heavy producers are cancellable; only the finite five-minute verdict uses always(). All three producers remain directly required dependencies, alongside changes. (#4431 later changed the triggers, concurrency and relevance filter; see the section above.)

JobActual owned workRelevant-event evidence
db-proofAll original DB integration, rollback and regression steps; direct G4 metadata/wiring; bounded G3a transactions proofExisting raw logs/readers, direct G4 artifact, and mode-bound G3a transaction evidence for 31 extraction + 17 Remember children and ten regression parents
source-proofComplete existing G4 mutation invocation and preservation, followed by PCTX complete/mutation proof and sanitized preservation, then the full G3a all lifecycle/cumulative proofG4 evidence; PCTX four parents/29 children, twelve exact RED/restored mutation arms, three lifecycle failures and owned cleanup records; plus distinct full G3a affected, cumulative, lifecycle, rollback and exact-owned-cleanup evidence
source-g2a-proof, source-g2b-proof, source-g2-memory-proof (#4245; formerly one source-g2-proof)One part each of the original complete G2 step131, plus preservation132; each sibling has the same self-contained Go/migrate/render setup and explicit image acquisitionOne G2 part artifact each, including every binary and nested lifecycle cleanup; each sibling's sanitized setup image IDs/RepoDigests matched to the fixture image inspections of the process mode it ran
migrationsRequired verdict on ubuntu-latest, no services, five-minute capSuccessful current upstream conclusions, post-upload engine step snapshots, same run/attempt/tested checkout, complete file hashes, actual independent raw validators

scripts/db-proof-contract.json records the exact step IDs/names, owner, mode, body digest, existing cap, input paths and original raw reader commands. The earlier approved #4300 composition changed only the relocated complete-G2 proof-131 step cap from 90 to 120 minutes; its original run body and proof-132 preservation remain identical. G3a D5 now adds proof-138/proof-139 to db-proof and proof-140/proof-141 to source-proof, with separate mode, artifact and input-path identities. The step contract and independent full-step pins record those additions. Each original proof/action body is preserved. check-required-check-gating.py compares the actual graph and execution dataflow against that literal contract, independently of the measured 118-case behavioral floor. The raw-validator population is128 (91 guards,30 commands,2 inline readers,3 G2/G4 readers and2 PCTX readers); these are independent counts. Edge deletion, same-count substitution, extra edges and snapshot/output removal must fail. Existing named DB consumers follow db-proof; the rationale scanner covers all four named proof/verdict jobs.

The new G2 sibling has explicit empty services/environment and zero runner prelude records. Its receipt and trusted export must both contain runner_prelude: null; a missing field, extra GUID, service initialization or cross-owner record fails. The two original service-bearing producers retain exactly one successful initialize-containers GUID record at position zero. The no-op path acquires no images/modules and runs no Go/migrate/render setup. Relevant setup explicitly pulls and inspects the existing pgvector reference and pinned Redis digest in the ephemeral workflow runner, recording immutable IDs/RepoDigests. The verdict compares these to both original process-mode raw image inspections. This is charged additional setup, not a new dependency or permission for local host/image mutation. Original DB/source setup stays intact. The DB display label now describes integration/direct proof; no proof step is renamed.

Relevant G2 setup also runs GOTOOLCHAIN=local go mod download followed by GOTOOLCHAIN=local go mod verify, immediately after the unchanged setup-go action. Both root module files are hashed before/after and must remain unchanged. The sanitized source-g2-modules receipt records only those exact ordered commands, local toolchain selection, integer zero exits and go.mod/go.sum hashes. The consumer compares both hashes to its tested checkout. Existing verified shared cache entries may be reused; the commands still execute every relevant time. There is no cache deletion/relocation, new dependency/version, local download, wrapper GOPROXY change or toolchain auto-download. The offline Go stub proves control flow only; actual hosted acquisition and complete proof remain required.

Each producer writes a receipt before upload and exports a new runner-provided toJSON(steps) snapshot after upload. The required verdict demands actual job success and both outcome/conclusion for each exact step; an artifact PASS field cannot substitute. Downloads use the validated artifact IDs from this run only. Partial reruns with an old-attempt producer output are refused. Existing retry limits remain in force; full-workflow retry escalation is an operational cost to record, not automatic authority.

The verdict replays every existing read-only log guard against its captured files, plus the exact source/map readers. It invokes the unchanged complete G2 checker and envelope from only the three G2 sibling artifacts (#4245); all legacy raw guards/commands/inline readers remain at db-proof. It retains independent Git/Kustomize baseline checks, both process modes and the nested template lifecycle validator. The G4 reader consumes raw Go events and named CI assertions/restores, verifies source hashes, and requires exact owned database removal before disposal plus raw container/volume no-such probes. Container absence alone cannot repair failed clone cleanup. No Docker, Go, DB producer or uploaded command is executed by the verdict.

PCTX executes in source-proof immediately after G4 preservation and before the common receipt, in the fixed order pctx-producer, pctx-checker, pctx-mutants, pctx-preserve. The first three IDs run the complete producer, complete reader, and the twelve-arm producer plus final reader; the fourth is the existing raw preservation action. Both standalone and aggregate uploads exclude only the matrix task root's disposable tree/ and byte backups/. The independent inventory consumer rejects either path if reintroduced. The final verdict invokes fixed checked-out complete and mutants readers against relocated raw roots, bound to the tested SHA and full original, baseline, exact RED, restored and lifecycle input inventories. It never runs an uploaded executable or artifact-selected argv. This adds no job, runner class, required context, service, producer cap or verdict cap. Actual combined hosted closure and merge-group cost remain evidence to collect; local arithmetic is not acceptance.

A successful literal-false PR or merge-group gate produces actual no-op receipts with no raw proof inventory. Merge groups use #4324's verified immutable comparison and the relevance filter, not a source PR diff or forced true value (only the nightly schedule forces true, #4431). The same event/base/head/run/attempt bindings, successful mandatory producer steps and executed required verdict apply to both events. A missing/failed or malformed gate, skipped producer or mismatched receipt cannot become a no-op. Docs-only runs still consume producer/service slots and hosted verdict minutes; measure that cost. Global host swap remains a strict G2 gate. Record it alongside verified co-scheduling intervals, with physical host explicitly unknown unless proved. Parallel swap failure returns to design, without retries or host changes.

Producer caps stay 110 minutes and the verdict cap stays five. (Superseded for G2 by #4245: the three G2 siblings carry measured caps, see the section above.) The inherited 120-minute complete-G2 step is limited by the remaining enclosing 110-minute job budget after setup; it is not a guaranteed 120-minute running allowance. The scoped composition addendum preserves all existing evidence and escalation requirements. Actual current PR run-creation-to-required-verdict closure must meet the narrow 108-minute target; preserve queue-entry-to-verdict as a separate clock, including startup, capacity, upload/download and verification. Queue expiry before the verdict reports is failure/ejection and returns to design. No timing, cancellation-canary or current-head acceptance is inferred from these settings. The broader actual merge-group 72-minute target (including every producer) and the PCTX/G3a combined cost remain open. G3a transactions retains its 20-minute step cap. Full all has a finite 45-minute canary ceiling in source-proof, not a permanent shipping allowance: acceptance still requires complete execution in at most 33m45s plus whole-producer and required-verdict headroom. Timeout or partial evidence returns to diagnosis without an automatic cap increase.

Repository source G3a extraction and Remember transaction proof (#4219)​

db-proof owns the explicit transactions mode under the retained 20-minute cap. It runs both real G3a parents, all 31 extraction and 17 Remember children, the ten regression parents, mode/cleanup identity and the independent checkers. It does not claim the cumulative all proof.

Preserve repository source G3a transaction proof receipts​

This db-proof step preserves the distinct transactions artifact even on a failed relevant run. The producer receipt also inventories the same exact mode-bound root; missing files or failed owned cleanup cannot become PASS.

Repository source G3a complete lifecycle and cumulative proof (#4219)​

source-proof owns unchanged default all after G4 mutants. Its 45-minute canary runs every transaction witness again plus affected packages, cumulative G1/G2a, nested lifecycle, audit/census, workflow guards, scoped vet, DOWN0 and exact owned-resource cleanup. The post-wrapper lifecycle and mode checkers run again before the step can succeed.

Preserve repository source G3a complete proof receipts​

This source-proof step preserves the full-mode artifact under a name and path that cannot be confused with transactions. The trusted producer receipt copies the same root before upload and binds it to the run, attempt and tested SHA.

Repository source G3c full production path proof (#4402)​

Each slow G3c parent runs as its own go test invocation so that every run keeps at least 2x headroom on its own unchanged -timeout=300s (#4474). Three merge_group reds since 2026-11-10 were the 300 s test alarm firing under box load, two in runtime/server and one in knowledgemcp, with no hang. Budgets were not raised. Measured basis: per-subtest Elapsed from the 28 passing inheritance.json and 30 passing mcp.json artifacts of merge_group runs on 2026-11-08 to 2026-11-16. Each p90 below is the p90 over runs of (selected tests + package overhead).

Result fileSelectionp90Headroom
mcp-release.jsonTestRepoMapSourceMCPRelease52.7 s5.7x
mcp-truth.jsonTestRepoMapSourceMCPResultTruth127.1 s2.4x
provenance.jsonTestRepoMapSourceContextProvenance26.5 s11.3x
inheritance-a.jsonSessionInheritance: child_before_context, child_return_before_rendezvous, inherited_gate_busy_or_error, lineage_missing_or_foreign107.9 s2.8x
inheritance-b.jsonSessionInheritance: the other five children119.9 s2.5x

The two inheritance halves are checked by ONE check-repo-source-test-proof.py call with two --json arguments. Each file must be a complete package run in which the parent RUN/PASSes. The children must be disjoint across the files, every file must contribute at least one child, and their union must equal the unchanged reviewed roster. A missing, empty, duplicated or foreign-package file is refused. test_repo_source_g3c_proof also asserts statically that the two -run alternations partition the roster. The receipt inventories every file in the directory and binds it to run, attempt and tested SHA as before. The verdict replays each checker line, so a missing half fails there too.

Historical filter and gate rationale​

Path-filter strategy (issue #720 regression + #654 original problem): Branch protection requires "Migrate Up + Down (PostgreSQL 16 + pgvector)" and "Schema drift check" on every PR. We previously used a paths: filter

  • companion db-skip.yml with paths-ignore: to cover both cases. That design fails on zero-file-diff PRs (e.g. #720 after its fix independently landed on main): neither paths: nor paths-ignore: matches when the diff is empty, so neither workflow fires and the required check stays "expected" forever.

Fix: mirror the security-scan.yml pattern. Trigger on every PR with no paths: filter. An internal changes job uses dorny/paths-filter to detect whether DB work is needed; heavy steps gate on the output.

ALLOW-LIST → DENY-LIST for the db filter (issue #2465): Until #2465 the db filter was a hand-maintained ALLOW-list of ~20 globs. A path-filtered step SKIPs rather than fails, and this job is a REQUIRED status check, so every path outside that list produced a load-bearing green from a job that stood up no database and ran no integration suite.

The list's own inline comments memorialised THREE separate escapes, each appended retroactively after someone noticed: internal/workflow/** (WF-28/#1906), cmd/agent-orchestrator/** + internal/temporalwf/** (#1881), and the four-package memory-recall set (#2296, whose defect "survived three PRs and a full dark deploy precisely because nothing executed it"). Three recorded escapes from one filter is not a maintenance lapse; enumeration is the wrong instrument.

It was also wrong on its own terms, and by a wide margin. This job runs ten go test invocations (see the steps below). Their first-party dependency closure — go list -tags integration -deps -test over all ten package globs — is 159 of the module's 289 packages, spanning 38 internal|cmd|pkg| test trees. The allow-list named 15. Uncovered by it and covered now: internal/gateway/** — incl. auth/bypass.go, the app.org_id GUC replant every RLS assertion in this lane depends on internal/rbac/, internal/auth/, internal/governance/, internal/task/, internal/agent/, internal/dashboard/, internal/metrics/, internal/knowledge/, internal/mcp/, internal/bus/, internal/testsupport/, pkg/*pb/, and 20 more — and internal/context/store/** ITSELF: only its migrations/ subdirectory was listed, never the Go SQL it migrates for. Also absent: Makefile (which defines the migrate-up/migrate-down targets the job invokes) and hack/verify-app-rw.sh.

So the filter is now a DENY-list: '**' plus explicit negations, evaluated with predicate-quantifier: 'every'. New packages, new SQL, new migrations and new integration suites are covered the day they land, instead of being skip-green until somebody remembers. Each exclusion carries its reason. Same idiom as wave2-smoke.yml (#2449) so the two required checks share one auditable shape.

MEASURED COST — this widening is NOT free, unlike #2449's (2026-08-03, 150 merged PRs replayed through dorny v3's exact matcher; 120 sampled job runs for durations): trigger rate 68.7% → 93.3% of PRs (37 PRs / 24.7% newly gated) job duration 550s median when it runs, 23s when it skips runner-minutes 642 → 858 per 100 PR runs (+216, +34%) required-check critical path, repo-wide median: UNCHANGED at 550s — this job already dominated on the >50% of PRs where it ran. required-check critical path on the 37 newly-gated PRs: 262s → 550s median (+288s). Zero of the 37 had another required check at or above 550s, so every one of them gets longer. That is the price of them being gated at all; do not buy it back by narrowing.

Widening this filter also strengthens #2449/PR #2464's cost claim rather than weakening it: that PR's "critical path unchanged because Migrate Up + Down already dominates" now holds on 93% of PRs instead of 69%.

The drift filter below is deliberately left as an allow-list: Schema drift check is not a required status check, and its input set really is small and derivable (the tool walks migration text plus the Go registry, with no database). Two justified shapes beat one forced one.

GATE-JOB FAILURE MUST NOT SKIP-GREEN THIS CHECK (issue #2473): #2465 (above) made the db FILTER honest. It did nothing about the changes JOB, which was still a single point of failure: needs: changes alone means that when changes FAILS — rather than reporting "nothing DB-relevant" — GitHub never starts migrations, so it reports skipped, and a skipped required check SATISFIES branch protection. Every step-level if: and every anti-skip NEEDLE guard in this file is downstream of that and cannot see it: the failure is one level up, at the job, so none of those steps exist to run.

Observed on 2026-07-31 (#2389, org Actions quota exhausted): every gate job died at start, all six required checks reported skipped, and PRs read mergeable with zero CI executed. The deny-list conversion did not help, because the filter never got to be evaluated.

Fix on migrations below, a pair that must be read together: 1. if: ${{ always() }} at job level so it STARTS whatever changes concluded; the job can then never report skipped. 2. A Gate integrity FIRST step failing closed unless every upstream job reached success AND changes.db is a literal 'true'/'false'. Without (2), (1) is worse than the original bug: a failed gate leaves needs.changes.outputs.db EMPTY, all ~30 gated steps below evaluate false, and this check reports green having stood up no database — the precise outcome #2465 was filed to end.

always() not !cancelled(): the latter SKIPS on cancelled runs, and skipped satisfies branch protection — the same defect, narrower.

This composes with, and does not replace, the Guard — the db proof-input allow-list covers every proof input step in the changes job (#4431; it replaced the deny-list guard). That guard pins WHAT the filter decides; the pair above pins that a decision was made AT ALL. Note the ordering dependency the guard alone has: it lives in changes, which is not a required context, so if someone removed if: always() here the guard could go red without blocking anything. That is why the invariant is ALSO asserted statically by scripts/check-required-check-gating.py.

schema-drift is deliberately NOT converted: Schema drift check is not a required status check, so its skipping is a cost matter, not a branch protection bypass. If it is ever promoted, apply the pair first — exactly as the note on the drift allow-list above already says for the filter shape.

THE SECOND ALLOW-LIST IS ALSO GONE — -run (issues #2848, #2904): The db path filter above was one enumeration. Run integration tests carried another: a hand-maintained go test -run alternation, 31 entries, over test/integration/context. It failed the same way — a name absent from it did not run, and the REQUIRED check reported success anyway, with no skip, no warning and no count.

What it concealed, all found by inspection rather than by any lane: * 13 tests that had never executed in CI, 8 of them broken (#2849); * TestActivityFeedV1_ClearanceMatrix, whose B_L5_noLeakFromA case describes the exact cross-tenant read activity_feed_v1 shipped for 144 migrations (#2846); * a whole family (#2840's) registered so late that nothing in it had ever run on a board that was green for it; * TestSummaryLoader_KeepsNewestN_Chronological, which did not merely fail but PANICKED, truncating the run — repaired by #2903 (T1). It was also the ONE line in this file that git merge conflicts on, so each union-resolution was an opportunity to delete another PR's coverage silently.

And it bought nothing. Measured on the CI recipe (fresh pgvector:pg16, chain 222, post-T1): filtered 338 === RUN / 69.5s, unfiltered 345 / 68.8s. The "unfiltered is slower" belief came from a run a panic had truncated.

Replacement, same instrument as the deny-list conversion — derive, do not enumerate: test/lint/db_lane_coverage_test.go asserts that every func Test* in that package, under BOTH build-tag states, executes in at least one workflow invocation. It parses this file for the invocations and AST-walks the package for the population, so it cannot agree with CI by construction. Re-adding a -run here is not banned; it turns that check RED, by name, for every test the filter would newly exclude.

STILL OPEN and deliberately NOT closed here: 27 tests in that package sit behind //go:build integration and are invocable in NO lane (#2827). They pass when run alone; they cannot yet be composed into this lane because migration 126's down is non-total once mcp_servers holds a soft-deleted row whose only binding is also soft-deleted (#2952). Quarantined BY NAME in that check, which fails if the set grows or shrinks.

Refs: issue #654 (original path-filter problem), issue #720 (zero-file diff regression), issue #2465 (allow-list skip-as-pass, this fix), issue #2449 / PR #2464 (same defect class on Compose Smoke Test), issue #2473 (gate-job failure skip-green — the always() + Gate integrity pair), #2389 (the Actions quota incident that made it observed), #2848 / #2904 (the -run allow-list deletion + derived lane-coverage check), #2827 / #2849 / #2872 (the classes it closes or hands on).

Appendix B — per-step rationale from the migrations job (#3667)​

Moved here from .github/workflows/db.yml on 2026-10-02, verbatim and in file order. The workflow file had reached 508,479 bytes against GitHub's 512,000-byte dispatch ceiling — 3,521 bytes of headroom — and 54% of it was comment lines. Past that ceiling GitHub dispatches zero jobs from the file on every event, so Migrate Up + Down (PostgreSQL 16 + pgvector), a required context, is absent from the head's check-runs rather than red, and branch protection waits forever with nothing to look at. That is measured, not predicted: it happened at head 0e1dfbc5e on PR #3658 — 513,179 bytes, 33 check-runs, the lane never dispatched, no annotation anywhere.

Nothing executable moved, and that claim is pinned three ways rather than asserted:

  • yaml.safe_load deep-equality against the pre-move blob — not one step name:, if:, env: or run: byte differs;
  • go test ./test/lint/, whose db.yml readers are already comment-stripped, so its floors (>= 36 Guard — steps, >= 360 needle sites) and its exact needle-capture invariant are an independent witness that no assertion left the file;
  • scripts/check-db-rationale-index.py, which asserts a bijection: every step carrying the RATIONALE: marker in db.yml has a section here, and every section here names a step that still exists. A section whose step was renamed or deleted is a red — so this appendix cannot rot into a description of a workflow that no longer exists, which is the usual fate of relocated prose and the strongest argument against relocating it at all.

Comments inside run: bodies were not moved: they are part of the executed script, and a script's comments belong next to the line they qualify.

Each heading is the step's exact name:. That is the key the checker resolves and the string a reader greps for; do not reword one without the other.

Gate integrity — upstream gate must have delivered a verdict​

─── #2473 GATE-INTEGRITY GUARD — read the file header before editing ─── No if: on this step, deliberately: it must run on every start of this job, including the starts that happen only because of if: always(). CONSUMED_OUTPUTS names every gate output this job's own step-level if: conditions read. The run: script is byte-identical across all six required jobs; scripts/check-required-check-gating.py asserts that.

Skip — no changed file is on the db proof-input allow-list​

Reachable only on merge_group (producers never run on pull_request, and the nightly forces db true) when NO file in the diff matches the proof-input allow-list in the changes job (#4431). Do not narrow the list to make this branch more common: scripts/check-db-proof-relevance.py must stay green, and every entry's reason is in "Proof-input allow-list" above.

Set up Go​

#3497: the box already keeps a persistent per-slot GOCACHE and a shared GOMODCACHE, so the archive is a copy of files that are already on the slot. Measured on this lane 2026-09-20 (8 runs): Set up Go reached 779s and Post Set up Go 244-497s on a job whose own work is the migrate + integration steps. Keep the runner-local caches; skip transport.

Start throwaway PgBouncer (core#2512 real-topology lane)​

core#2512 shipped for months because no test ever put PgBouncer in the loop: a LISTEN issued through pool_mode = transaction + server_reset_query = DISCARD ALL SUCCEEDS and then silently delivers nothing, and every hub test either injected a fixture fetcher (no DB) or ran against this lane's DIRECT postgres service. The bug lived exactly in the gap between those two, so the regression pin needs a real PgBouncer.

This is a DISPOSABLE container on port 16432, generated by scripts/start-test-pgbouncer.sh with the same ADR-0001 §2.4 settings the dev stack uses. It does not touch dev/pgbouncer/pgbouncer.ini and it is not the deployed pooler — §2.4 stays untouched. --network host is what lets it reach the postgres SERVICE container via the runner's localhost:5432.

Run integration tests​

THERE IS NO -run FILTER HERE, DELIBERATELY, AND ADDING ONE IS A REGRESSION (#2848 · MG slice-3 T2 #2904).

Until 2026-09 this step carried a hand-maintained -run alternation of 31 entries, and a name absent from it did not run while the lane still reported SUCCESS. That concealed, measurably: 13 tests that had never executed in CI (#2849), 8 of them broken; TestActivityFeedV1_*, whose B_L5_noLeakFromA case describes the exact cross-tenant read that activity_feed_v1 shipped for 144 migrations (#2846); and, in #2840's review, a whole family registered so late that nothing in it had ever run on a green board. Registration was also the ONE line in this file that git merge conflicts on, so every union-resolution was a chance to delete another PR's coverage silently.

The unfiltered run is not more expensive. Measured on the CI recipe (fresh pgvector:pg16, chain 222, T1 @2f00fb48): filtered 338 === RUN in 69.5s, unfiltered 345 in 68.8s — the delta is inside the noise. The "unfiltered costs 10.3s more" figure that once justified the filter was an artefact of a panic truncating the run before it finished (#2853).

THE POST-T2 RULE, which replaces registration: a test in this package runs because it EXISTS, not because it was listed. test/lint/ db_lane_coverage_test.go derives coverage from this file — every func Test* in the package, under both build-tag states, cross-checked against every workflow invocation that names the package — and fails if any test is invocable in no lane. Re-introducing a -run here does not break that check by construction; it makes the check RED, by name, for every test the filter would newly exclude. That is the whole design.

TestProviderKeysRLS_* (#2645) is the enforcement proof for the provider_keys credential-vault RLS policy (migration 208). It is untagged precisely so this step picks it up — this is the only step that runs untagged tests in this package.

THE PANIC BRANCH LIVES HERE, NOT IN A LATER GUARD STEP. It used to sit in the "#2853 repaired fixtures" guard below, where it could never fire: a panic always yields a non-zero exit, this step ends exit "${PIPESTATUS[0]}", and the guard had no if: always(), so the job was already red and the guard never ran. Moving it into the producing step is what makes it reachable — and the producing step is also the only place that cannot be reached with the log missing, which an always()-gated guard would have had to handle fail-open.

Its value is diagnostic, not gating: it converts a bare "tests failed" into the binary PANICKED, this log is TRUNCATED, do not read the absence of --- FAIL: lines as success — precisely the misreading that produced #2853's stale record.

|| RC=$? IS LOAD-BEARING, do not simplify it back to a bare pipeline followed by exit "${PIPESTATUS[0]}". Under set -e a failing pipeline aborts the script AT THE PIPELINE, so everything below it — including the panic branch — never executes. The first draft of this fix had exactly that shape and reproduced the inert branch it was written to repair; the mutation below caught it, review would not have.

Guard — #3051 the spend-cap token-class proofs must RUN, not skip​

DEVOPS EYES REQUESTED — this is the only .github/ change in #3051. It follows the #3080 guard's shape verbatim (skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check #3106 asks for); nothing about the lane, its Postgres or its timeout changes. Five tests, ~0.8s against the then-300s lane budget (since raised — see the #2712 budget block, #3404 — dated measurement).

WHY THIS ONE NEEDS A FLOOR, SPECIFICALLY

#3051 is a P1 that was found by MEASUREMENT on beta-dev, not by reading code: a ledger row of 0 input / 0 output / 500k cache_creation / 500k cache_read is 1,900,000 real tokens against a 1,000,000 cap, and gate 7d ADMITTED the next call. The unit lane cannot see that. It reads GrainBudgetsSQL as TEXT and can prove the statement NAMES four token classes; only PostgreSQL can say whether it ADDS them.

So these five are the ONLY place in the repo where the fix is observable, and a lane that lost DATABASE_URL would report "0 SKIP + 0 FAIL" — indistinguishable from a green run (WF-28/#1906) — while the spend cap went back to being unenforceable by any factor for a cache-heavy tenant. That is the exact prod-enablement condition #3062 gates the :8091 flip on, so a silent skip here is a silently re-opened flip gate.

NAME-SET DISCIPLINE (#3106): the roster below is the SET, not a sample, and it is ASSERTED — the closing check derives the printed set from THIS STEP'S OWN ECHO and the pinned set from THIS STEP'S OWN LOOP VARIABLE, so there is no second copy of the names to keep in step. Verified at authoring time: 5 = 5, both differences empty. No # needle-exclude: lines — every TestModelGatewayBudget3051_* is rostered.

Guard — #3122/#2955 the one-window spend-cap proofs must RUN, not skip​

DEVOPS EYES REQUESTED — this is the only .github/ change in #3122. It follows the #3051 guard's shape verbatim (skip-sweep, NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check #3106 asks for); nothing about the lane, its Postgres or its timeout changes. Six tests, ~0.2s against the then-300s lane budget (since raised — see the #2712 budget block, #3404 — dated measurement).

WHY THIS ONE NEEDS A FLOOR, SPECIFICALLY

#2955 is a P1 found by MEASUREMENT (PR #2950 review R1), and the always-on half of the #3122 fix — test/lint's window-derivation guard — reads SQL as TEXT. It can prove policy.LoadOrgBudgetSQL SPLICES billing.PeriodBoundsJoinSQL; only PostgreSQL can say which rows the resulting statement then sums. A mis-aliased LATERAL join, a predicate on the wrong side of a COALESCE, or a LEFT JOIN quietly promoted to an inner one all pass the text guard and return a different number.

So these seven are the ONLY place the fix is observable, and a lane that lost DATABASE_URL would report "0 SKIP + 0 FAIL" — indistinguishable from a green run (WF-28/#1906) — while the orchestrator's default-on spend cap went back to measuring a months-long window. #2955 carries prod-enablement (first external-tenant onboarding), so a silent skip here is a silently re-opened gate.

NAME-SET DISCIPLINE (#3106): the needle alternates the two prefixes this file uses, and the closing check derives the printed set from THIS STEP'S OWN ECHO and the pinned set from THIS STEP'S OWN LOOP VARIABLE, so there is no second copy of the names. Verified at authoring time: 8 = 8, both differences empty. No # needle-exclude: lines.

#3423 ADDED THE THIRD PREFIX, BudgetWindow3423. Its one test needs no database — it sweeps the FIXTURE'S ANCHOR over a full leap year — and that is exactly why it belongs here rather than outside: the defect it pins made TestBudgetWindow3122_ThreeEnforcersOneWindow fail on ~12 dates a year and pass on the other 353, which is how main went red on this required lane with nothing in the diff. Unrostered, deleting it would be silently green and the calendar bomb would simply be re-armed.

Guard — #3080 the Phase-1 M6/M7 closing battery must RUN, not skip​

DEVOPS EYES REQUESTED — this is the only .github/ change in #3080. It follows the #3075 guard's shape verbatim (skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check #3106 asks for); nothing about the lane, its Postgres or its timeout changes. The battery adds ~6s to a step that currently runs in ~126s against a then-300s lane budget (since raised — see the #2712 budget block, #3404 — dated measurement).

WHY THIS ONE IS DIFFERENT FROM THE FIFTY-ODD GUARDS BELOW IT

Every other guard in this file protects one task's slice. This battery IS the Phase-1 acceptance instrument for M6 (team scope) and M7 (clearance invariance) — the two containment metrics whose regression PRD #2995 classes as P0 rather than as a quality dip. It is also the only test in the repo that drives ALL EIGHT Phase-1 read surfaces from one fixture: search_knowledge, get_context, get_document, GetDocument, list_repos, get_repo_map, the answer-time conflict banner and GetConflict. A surface leaking to another team fails here and nowhere else, because nowhere else asks the question of all of them at once.

upToHead SKIPs when DATABASE_URL is unset, and at the job level "0 SKIP + 0 FAIL" and "23 SKIP + 0 FAIL" are indistinguishable (WF-28/#1906) — so a lane that lost its scratch Postgres would report M6 = 0 having measured nothing.

NAME-SET DISCIPLINE (#3106): the roster below is the SET, not a sample, and that is ASSERTED rather than promised — the closing check derives the printed set from THIS STEP'S OWN ECHO and the pinned set from THIS STEP'S OWN LOOP VARIABLE, so there is no second copy of the names anywhere to keep in step. Verified at authoring time: 23 = 23, both differences empty. #3089 added two rows (the parent-private containment arm and its RLS-bypassed twin) and re-verified: 25 = 25. No # needle-exclude: lines — every TestPhase1Battery3080_* is rostered.

Guard — #3089 the parent-private per-axis regression must RUN, not skip​

DEVOPS EYES REQUESTED — one of three .github/ changes in #3089 (the other two are roster entries in the steps above and below). It follows the #3080 guard's shape verbatim: skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check. Nothing about the lane, its Postgres or its timeout changes; the suite adds ~1s to a step measured at ~126s (dated measurement — see the #2712 budget block, #3404).

WHAT IT PROTECTS. #3089 was a cross-TEAM access-control defect: orgunit.Resolver.resolveActiveTeam anchored EVERY axis at ancestors(activeTeam) union {activeTeam}, and the three axes that carry a visibility column read an anchor as a DIRECT binding — the one pass that deliberately applies no visibility filter. So a visibility='private' binding on a parent or pillar resolved for every descendant, which is the exact inverse of what the value means. It gated flipping orgv24.multiparent_resolver ON, and one branch (InheritanceSourcesForUnit, behind ResolveEffectiveConfig) reached it with the switch OFF.

The failure mode this bounds is a SILENT WIDENING: nothing errors, no row is missing, and the only observable is that a caller resolves more than it should. That is invisible to every other test in the lane unless this one runs, and upToHead SKIPs rather than fails when DATABASE_URL is unset (WF-28/#1906) — so a lane that lost its scratch Postgres would report the containment green having measured nothing.

Named individually rather than counted, because a floor is met while precisely the load-bearing member stops running:

APrivateBindingOnAParentDoesNotReachADescendant — the table: three axes (knowledge, tool, MCP) x four (entry point x switch state) resolutions x ten binding positions. The PARENT test is pinned, not a subtest floor, so a row that stops running reddens. TheGuardrailAxisStillInheritsDownTheWholeChain — the other direction. Guardrails are a MANDATORY PUSH with no visibility column, so an over-narrow fix turns a pillar-level deny policy off for every team beneath it. A security fix that becomes a governance regression is the failure this arm alone can see. TheFourResolutionsAgree — the differential. The four doors into the resolver must give one answer; a difference is an entitlement that depends on which door the caller came through, which is the class of defect #3089 is.

Like every lane above it, this must stay ABOVE Run migrate down; the suite drops every org it seeds on cleanup.

Guard — #3082 F9 conflicts-queue tenant-isolation tests must RUN, not skip​

DEVOPS EYES REQUESTED — this is the only .github/ change in this PR. It follows the #3078 guard's shape verbatim (skip-sweep, then a NAMED roster, then echo what ran); nothing about the lane, its Postgres or its timeout changes.

WHY THESE NEED A FLOOR. The lane runs test/integration/context UNFILTERED, so selection is not the risk — silent non-execution is. upToHead SKIPs when DATABASE_URL is unset, and at the job level "0 SKIP + 0 FAIL" and "12 SKIP + 0 FAIL" are indistinguishable (WF-28/#1906). These tests are the ONLY oracle for several F9 properties that no unit test can reach:

TwoReportsDedupeIntoOneConflictWithTwoSightings — TK-9.4. A mock cannot enforce a unique index, so only Postgres can say a second report became a SIGHTING rather than a duplicate row. AReportCannotCiteADocumentTheCallerCannotSee — the write-side ACL. Without it report_knowledge_issue is an existence oracle over other teams' corpora, and it takes a LIST of ids. ADismissedFindingSurvivesAReSyncAndReopensWhenAPassageChanges — TK-9.11, BOTH arms. A re-sync is a new knowledge_doc_versions row with current_version moved: a fact about two tables. AnUndecidableStickinessHoldsTheDismissalAndSaysSo — the third outcome the PRD does not name, which exists because text_sha256 is nullable. NoFindingReachesConfirmedOrDismissedWithoutAHumanVerdict — TK-9.12 asserted by SQLSTATE. verdict_by references members; only a real foreign key can refuse an agent id. TeamScopedQueueReads / AdjudicationIsTeamScopedToo — the team predicate, which NO RLS policy covers. Both fixtures live in ONE org, so RLS admits both rows and team_unit_id is the only separator. The second is the write half plus the re-read that is its PRIMARY oracle. SurfacingIsTeamScopedAndSurvivesAReIngest — TK-9.3/9.18 on the hot path. The re-ingest arm is the one that catches a version-keyed lookup, which makes every open finding vanish from the answer path on the next routine sync, silently. ACitationTheCallerCannotReadIsMarkedNotDropped — the label-leak boundary between a TEAM-scoped finding and a SOURCE-scoped document. NG10_ReportingAndAdjudicatingLeaveTheCorpusByteUnchanged — NG-10, photographed as (id, xmin) so an UPDATE that rewrites identical values is still caught. PermalinksAreStableAndNeverRecycle — the whole justification for the fourth table. It DELETES the highest-numbered finding and asserts the next allocation does not reuse its number. ConstraintsEnforceTheAcceptanceCriteria — ten schema refusals, each asserted by SQLSTATE and constraint name, because "the INSERT errored" is not the same claim as "the constraint I meant rejected it". StickinessIsAnchoredToTheVERDICTNotToCreation — QA-1. The anchor is the moment a human said "I have looked at this text", not the moment the finding was raised. Under the defect, once a document had moved at ANY time after creation, no dismissal could ever stick and every later report re-opened it forever. AT4AdoptionMovesTheEvidenceInsteadOfDeletingIt — QA-2. Drives the REAL #3105 adoption primitive against a live conflict: the evidence moves, the dedupe key follows the identity, and the finding keeps surfacing. A mock cannot run someone else's four-statement transaction. ADocumentDeleteCANNOTSilentlyTakeTheEvidence — QA-3, in BOTH delete orderings plus the production DeleteSource control. Only a real database has referential actions. ModelAuthoredTextIsBoundedByTheDatabaseToo — QA-5. The size caps lived only in Go; a 1 MiB summary written directly to the column succeeded. Asserted by SQLSTATE + constraint name, with an at-the-cap control so the bound is not <= 0.

NAME-SET DISCIPLINE (#3106): ECHO − MUST and MUST − ECHO are both empty, VERIFIED AT AUTHORING TIME (12 = 12) and independently by both reviewers — NOT "by construction", which is what this comment used to claim and which is false (M3 on PR #3108). The echo needle matches every TestConflicts3082_* and TestQueueAggregates3326_*; the MUST list is hand-maintained. The aggregate tests pin the org/team predicates and the open-only badge; devops eyes requested for this roster extension. A thirteenth test would be echoed and unpinned and nothing here would redden. #3106 is the issue that makes it a construction; until it lands, test/lint/db_lane_coverage_test.go's TestGuard3082EchoSetEqualsItsRoster asserts the equality for THIS guard, which is the part I can close from inside this PR.

Guard — #3081 F8 repo-registry tenant-isolation tests must RUN, not skip​

DEVOPS EYES REQUESTED — this is the only .github/ change in #3090. It follows the #3077 guard's shape verbatim (skip-sweep, then a NAMED roster, then echo what ran); nothing about the lane, its Postgres or its timeout changes. Raised by QA review 5125552270 (F6): db.yml has 53 of these guards and none named the F8 tests, so the roster is extended rather than a new mechanism introduced.

WHY THESE NEED A FLOOR. The lane runs test/integration/context UNFILTERED, so selection is not the risk — silent non-execution is. upToHead SKIPs when DATABASE_URL is unset, and at the job level "0 SKIP + 0 FAIL" and "8 SKIP + 0 FAIL" are indistinguishable (WF-28/#1906). These particular tests are the ONLY oracle for F8's tenant isolation: the pgxmock tests prove the predicates are IN the SQL, and only these prove Postgres enforces them.

Named individually rather than counted, for the reason the #2729 and #3077 guards give: a floor is met while precisely the load-bearing one stops running.

TeamScopedRegistryReads — the read negative. Both repositories are in one org, so RLS admits both to both callers and team_unit_id is the only separator. MutationVerified — the flip control for the above. Without it, "team A sees 1 repository" is consistent with a reader that can only ever see one row. WritesAreTeamScopedToo — the four write RPCs, plus the re-read that is the PRIMARY oracle for three of them (QA F5: under a leaked updateRepoQuery all four subtests PASS and only the re-read reddens). R1_ARefLessObservationCannotBeAttributedToTheMapsRef — the marker cannot attribute an observation of one ref to another. Its failure mode is a well-formed, confident falsehood inside the artefact M12 exists to make trustworthy. M12ThroughTheToolWithMapCommitBehindHead — M12 = 0 exercised with map@commit != HEAD through the real backend and scope resolver. LockBehaviourInBothDirections / AcknowledgingOneSectionDoesNotClearAnother — TK-8.4 in both directions, and the section-scoping of the acknowledgement. A lock that silences is the failure they bound.

ConstraintsEnforceTheAcceptanceCriteria is deliberately NOT listed: it is a pure schema-constraint battery whose every assertion is also a static assertion in 232_repo_registry_test.go, so pinning it here would gate the lane on a duplicate rather than on the only oracle.

Guard — #3154 capability-binding tenant-isolation tests must RUN, not skip​

DEVOPS EYES REQUESTED — this is the only .github/ change in #3188. It follows the #3081 guard's shape verbatim (skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check #3106 asks for); nothing about the lane, its Postgres or its timeout changes. The five tests add ~4s to a step that runs in ~126s against the then-300s lane budget (since raised — see the #2712 budget block, #3404 — dated measurement).

WHY THESE NEED A FLOOR, AND WHY THIS ONE IS NOT HYPOTHETICAL.

Raised on review of #3188: the reviewer FORCED the failure rather than reasoning about it. openNonBypassPool calls t.Skipf when it cannot provision the NOBYPASSRLS login role — a legitimate design, because the role needs a superuser DSN — and under that forced failure TestCapabilityBinding239_CrossOrgReadIsRefused printed --- SKIP and the package printed ok, exit 0.

THE PLATFORM'S FIRST TENET WAS THEN SCORED AS A PASS BY ITS ABSENCE.

The two other skip paths reach the same place: upToHead SKIPs when DATABASE_URL is unset, and testsupport.RequireScratchDB FATALs on a non-throwaway name but SKIPs on an unset one. At the job level "0 SKIP + 0 FAIL" and "5 SKIP + 0 FAIL" are indistinguishable (WF-28/#1906).

Named individually rather than counted, for the reason the #2729, #3077 and #3081 guards give: a floor is met while precisely the load-bearing one stops running.

CrossOrgReadIsRefused — THE tenant-isolation oracle for llm_capability_bindings, and the one whose skip was demonstrated. It is the only test that runs as a NOBYPASSRLS role (verifying rolbypassrls/rolsuper are false before trusting a single assertion), so it is the only one that can say the POLICY refuses rather than the WHERE clause. It carries its own positive control — org A sees 1 — because "org B sees 0" is otherwise equally consistent with a seed that never landed. ConstraintsRefuse — the write-side refusals by SQLSTATE and constraint NAME: an unmapped capability, a team-grain unit on INSERT and on UPDATE, a blank model, a duplicate key, and org A binding org B's endpoint (23503, the migration-222 defect). A mock cannot enforce a CHECK or a composite FK. AppliedSchemaMatchesTheDesign — reads the CATALOGUE. It is the ONLY oracle for WITH CHECK on the RLS policy, measured: dropping WITH CHECK from a FOR ALL policy is behaviourally EQUIVALENT (Postgres applies USING to new rows), so no behavioural test in the repo can see that loss. StoreReadsWhatTheMigrationWrote — the production store, through the scope transaction, against the applied schema. It is what makes DeregisterLLMEndpoint's refusal a fact about Postgres rather than about a fake. DownIsACleanRoundTrip — the down migration, plus the assertion that it does NOT drop members_id_org_key / llm_endpoints_id_org_key, which 239 creates IF NOT EXISTS and 232/222 own.

Guard — #3141 capability-clearance tests must RUN, not skip​

DEVOPS EYES REQUESTED — the only .github/ change in #3141, and it is the #3154 guard's shape verbatim: skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check (#3106). Nothing about the lane, its Postgres or its timeout changes. Five tests, ~6s of which 5.7s is the shared migrate-up, against a 300s budget.

WHY THIS FAMILY NEEDS A FLOOR, SPECIFICALLY

These are the ONLY proofs anywhere that gate 7a's capability arm DENIES. The unit lane can read AND b.enabled as text and assert the statement contains it; only PostgreSQL can say the predicate excludes the row, and only a real UPDATE can say the next call sees it. If this lane lost DATABASE_URL it would report "0 SKIP + 0 FAIL" — WF-28's skip-green trap, indistinguishable from a clean run — while a DISABLED capability binding might be resolving to its endpoint's floor, i.e. the L5 capability kill-switch silently not working.

NAME-SET DISCIPLINE (#3106): the roster below is the SET, not a sample. The closing check derives the printed set from THIS STEP'S OWN ECHO and the pinned set from THIS STEP'S OWN LOOP VARIABLE, so there is no second copy of the names to keep in step. Verified at authoring time against a throwaway pgvector:pg16: 5 = 5, both differences empty. No # needle-exclude: lines — every TestCapabilityClearance3141_* is rostered.

Guard — #3140 capability owner-source tests must RUN, not skip​

DEVOPS EYES REQUESTED — the only .github/ change in #3140, and it is the #3154 / #3156 guard's shape verbatim: skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check (#3106). Nothing about the lane, its Postgres or its timeout changes. Three tests, ~0.3s against a 300s budget.

go test ./test/integration/context/... above is UNFILTERED, so these execute today — selection is not the gap. The gap is that they are the ONLY layer in the repo that executes capability.ownerStatement against a real schema, and a skip takes that layer out silently.

WHY THAT MATTERS MORE THAN USUAL HERE. The #3249 review found authoritativeRows[corpus].unitColumn = "unit_id" — a column migration 108 DROPPED. Four layers agreed with each other (the declaration, its doc comment, a STRING assertion over the derived statement, and the fake OwnerSource every behavioural test drives) because all four descended from ONE reading of ONE migration. Nothing but an EXECUTION can see that, and SQLSTATE 42703 is not pgx.ErrNoRows, so the failure mode was 100% of corpus mints refusing with owner_read_failed — a build fault wearing a database fault's reason, on the row kind 5E1 exists to use.

EveryDeclaredKindReadsAgainstARealDatabase — the totality arm, over capability.RowKinds(). A third kind cannot be added without one. ASoftDeletedRowIsNotFound — LLD #3138 §1.2's "a missing or soft-deleted row fails the mint", executed rather than asserted over a string. This is the arm the liveness predicate exists for and the clause a hand-copied statement drops. ForeignTenancyOnBothConnectionClasses — drives BOTH the NOBYPASSRLS (app_rw / on-prem) and BYPASSRLS (dev, beta-dev today) classes and records which one Postgres refuses on. Its absence would let the softened claim in owner_pg.go drift back to "enforced by Postgres".

Guard — #3169 capability POOL-binding tests must RUN, not skip​

DEVOPS EYES REQUESTED — the only .github/ change in #3169, and it is the #3140 guard's shape verbatim one step up: skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check (#3106). Nothing about the lane, its Postgres or its timeout changes. Three tests, ~0.2s, reusing the #3140 fixture and seeding no row of their own.

WHY A SECOND STEP RATHER THAN THREE MORE NAMES IN THE ONE ABOVE. That step's needle is TestPGOwnerSource* and its subject is the DERIVED OWNER STATEMENT. These tests have a different subject: WHERE THE TRANSACTION THE STATEMENT RUNS ON COMES FROM. 5E2 cut over two callers — the memory-extraction consumer and the moderation scanner — that hold NO transaction on any channel, so capcutover.TxBinding grows a POOL arm that opens its own short-lived RLS-scoped read tx. The unit lane can only prove that arm is TAKEN (by the shape of its failure against an unreachable pool); these are the ONLY layer that proves it WORKS, against real GUCs, a real policy and a real agent_sessions row.

A skip here is the #3531-R1 failure mode with the evidence removed: every gateway-routed extraction and moderation mint refusing owner_read_failed for the life of a deployment, with a green lane.

MintsForACallerThatHoldsNoTransaction — the positive arm, run for BOTH capabilities that use the POOL arm, so one working and the other not cannot hide behind a shared green. NoPoolAndNoTxStillRefuses — ABSENCE MUST FAIL. Without it the positive arm would pass on an implementation that simply read the row outside any transaction. AForeignScopeNeverMintsForTheForeignOrg — #3140's acceptance carried onto the new arm: a caller scoped to org B, minting against org A's session row, mints for A or fails. It never mints for B.

Guard — #3755 control S-PERSIST's carrier sweep must RUN, not skip​

DEVOPS EYES REQUESTED — the only .github/ change in #3755, and it is the #3169/#3170 steps' shape verbatim: skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check (#3106). Nothing about the lane, its Postgres or its timeout changes. Three tests, ~1.1 s on the shared schema, seeding two throwaway orgs and rolling every write back.

WHY A STEP AT ALL, AND WHY HERE. Control S-PERSIST (LLD #3698 Appendix A §A.1) is the rule that the subscriber's identity credential exists for a request's lifetime and NOWHERE DURABLE: the row keeps its SHA-256 and the first 8 characters of its suffix, and nothing else. Its only possible oracle is a SELECT over every column of every table the write path touched, which means a real schema — so a skip here is not a weaker signal, it is NO signal. Measured on #3713: a RotateCredential writing the live credential in PLAINTEXT into credential_hint — a column rendered to the team Manager's Model Subscribers table and to the subscriber's own page — survived the unit package (75 tests), this whole integration package (~500 at the time) and the entire ./internal/modelgateway/... tree.

WHY THREE NAMES AND NOT ONE. They bound three different failures, and the second and third are the ones a reviewer would not think to ask for:

NoProductionWriteStatementPersistsTheCarrierCredential — the control itself, driving the SHIPPED subscriber.PGStore through consent/ mint, bind, mismatch and rotate, sweeping after EACH statement (rotate OVERWRITES credential_hint, so a sweep after the last write is a sweep of the last write). TheDerivedCorpusCoversAColumnThePathGainsLater — the corpus is DERIVED from pg_stat_xact_user_tables inside the writing transaction, not written down, and this plants one member per dimension it is keyed on (column, relation, non-public schema) to prove a sink nobody names is still swept. APrefixExtensionLeakOutsideTheHintIsFound — the suffix[:HintLen+1] needle, which is what distinguishes the legitimate 8-character mask from hint + n characters of the secret. Without it consent_version = <version> + suffix[:HintLen+4] passes, and it did: that mutant survived #3757's sweep.

NOTE ON READING A RED FROM THIS STEP. These tests report three DIFFERENT outcomes — S-PERSIST CLEAN, CONTROL S-PERSIST VIOLATED and S-PERSIST VACUITY ABORT — so the log says which of "I found the bearer" (a defect in production) and "I could not do my job" (a defect in the harness) happened. Before #3755 both printed the same colour. The mechanical half of this lane is the SQL_ROSTER entry evaluated by the "SQL mutation lane" step below, which re-applies the RotateCredential c.Hint→c.Plaintext mutant on every run.

Guard — #3170 A2A egress cutover tests must RUN, not skip​

DEVOPS EYES REQUESTED — the only .github/ change in #3170, and it is the #3169 step's shape verbatim: skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check (#3106). Nothing about the lane, its Postgres or its timeout changes. Two tests, ~0.3 s, reusing the #3140 fixture and seeding no row of their own.

WHY A THIRD STEP RATHER THAN TWO MORE NAMES IN THE ONE ABOVE. That step's needle is TestTxBindingPoolArm* and its subject is the POOL ARM OF capcutover.TxBinding in isolation. These have a different subject: 5E5's THIRD capability.RowKind (task → tasks) driven through the WHOLE production A2A egress router — capcutover.Decide, the binding, scope.ScopedReadTx, capability.PGOwnerSource and the statement derived from authoritativeRows — for TWO orgs at once.

A skip here has two distinct costs, and neither is visible anywhere else. SQLSTATE 42703 is not pgx.ErrNoRows, so a tasks column that the schema does not have makes EVERY gateway-routed A2A hop refuse owner_read_failed for the life of a deployment. And the unbound-org assertion is MG-CTX.27's deliverable — the property that no org moves working → degraded as a side effect of the cutover.

PoolArmMintsAgainstTheTasksRow — the two-org serving negative: the bound org through the gateway on a Bearer capability token whose org came off the tasks row, the UNBOUND org still egressing on the incumbent, on a BARE context (Adapter.Dispatch's shape). AnAbsentTaskRowRefusesTheHop — ABSENCE MUST FAIL. LLD §1.2's "a missing or soft-deleted row fails the mint", plus the assertion that a bound org's broken mint fails LOUDLY rather than falling back to the platform key and hiding a broken cutover until #3171.

Guard — #3156 embedding-stamp tests must RUN, not skip​

DEVOPS EYES REQUESTED — the only .github/ change in #3156, and it is the #3154 guard's shape verbatim: skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check (#3106). Nothing about the lane, its Postgres or its timeout changes. Seven tests, ~0.6s against the then-300s lane budget (since raised — see the #2712 budget block, #3404 — dated measurement).

go test ./test/integration/context/... above is UNFILTERED, so these execute today — selection is not the gap. The gap is that nothing PINS them: a rename, a t.Skip or a DATABASE_URL drift takes them out and the lane stays green while the embedding stamp is unmeasured. Three of them are additionally SQL_ROSTER witnesses, so their silent loss would also disarm a mutation guard.

WHAT GOES UNMEASURED IF THEY STOP RUNNING, named individually because a floor is met while precisely the load-bearing one stops:

AnUnscopedCallErrorsRatherThanAdmitting — the FAIL-CLOSED oracle, and the only test where the one-character current_setting(..., true) regression is visible. Every other test sets the GUC, so all six stay green under a control that admits every write on an unscoped connection. TheMeasurementIsOrgScopedBothWays — tenant isolation on the new read path under a NOBYPASSRLS role, in BOTH directions. The dangerous direction is the one a refusal-only test cannot see: org B's corpus admitting a write into org A. RecallIsUnchangedAcrossTheIntroduction — #3053's own AC and LLD #3138's property AC for 5B3, COUNTED. It carries its own destructive control (a write under the new model, then the count collapsing 4 -> 1), without which "unchanged" is satisfied by a no-op. AMixedCorpusCountsChunksNotRows — the corpus size MG-CTX.26 requires the re-embedding decision to be made against. Rows over-report a half-migrated corpus; only this fixture separates 2 chunks from 3 rows. APendingRowDoesNotAdmitAModel — embedding IS NOT NULL. A stamped, vectorless row is not a corpus, and admitting on one lets a new vector space in through a row recall can never return. TheIncumbentIsAdoptedAndTheAlternativeIsRefused — MG-CTX.26's adoption and MG-CTX.22's set-once, on error IDENTITY. AnEmptyCorpusAdmitsAnyModel — the branch that keeps a brand-new tenant working. Its loss is the one that presents as a support ticket rather than as silence.

Guard — #3167 cutover-readiness tests must RUN, not skip​

DEVOPS EYES REQUESTED — the only .github/ change in #3167, and it is the #3154 / #3156 guard's shape verbatim: skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check (#3106). Nothing about the lane, its Postgres or its timeout changes. Eleven tests, ~1.1s against the then-300s lane budget (since raised — see the #2712 budget block, #3404 — dated measurement).

go test ./test/integration/context/... above is UNFILTERED, so these execute today — selection is not the gap. The gap is that nothing PINS them: a rename, a t.Skip or a DATABASE_URL drift takes them out and the lane stays green while MG-CTX.28's instrument is unmeasured. Three of them are additionally SQL_ROSTER witnesses, so their silent loss would also disarm a mutation guard.

AND THE STAKES ARE THE WHOLE CONTEXT FLEET. This suite is the only executing proof that mg-readiness gate refuses, and 5E1/5E6 delete four platform LLM API keys on that refusal not firing. A green lane with these tests absent is a green lane that has certified nothing.

WHAT GOES UNMEASURED IF THEY STOP RUNNING, named individually because a floor is met while precisely the load-bearing one stops:

TheFleetSweepRefusesAgainstARealUnpreparedFleet — THE PROPERTY AC, executed against real data: an all-green report on an unprepared fleet must FAIL. It carries its own negative control (a proven non-zero org count), without which "it refused" is satisfied by a gate that refused because it was blind. AnUnconfiguredOrgReportsEveryCapabilityDegraded — the LEFT JOIN direction, i.e. whether "which of the five do NOT have a binding" is answerable at all. Its loss makes every unconfigured org report zero capabilities and read as ready. TheWaiverIsOrgScopedBothWaysUnderNOBYPASSRLS — tenant isolation on the new read path, BOTH directions, under a NOBYPASSRLS role. The dangerous direction is the one a refusal-only test cannot see: org B's waiver excusing org A, i.e. a tenant degraded on somebody else's signature. TheAcceptorIsResolvedAgainstRealMembers — MG-CTX.28's "names who accepted the degradation" as a fact rather than a claim: active, human, L5, IN THIS ORG. This test found a real defect during authoring (the org check was left to RLS on a connection that bypasses it), which is the best evidence there is that it works. TheAcceptanceIsAuditedBeforeThePermissionAndNamesWhoAndWhy — that the acceptance is CHAINED (chain_scope set, row_hash non-empty) and not the insertOrgBatchLegacy shape (#2696), which satisfies "the waiver is audited" without being tamper-evident. AReadyCapabilityCannotBeWaived — the anti-fossilisation refusal, with its negative control. Its loss lets the waiver table fill with signatures dated before the losses they excuse. WideningTheDegradationRequiresASecondAcceptance — the per-capability grain, end to end. The property a per-org waiver cannot have. ABoundEnabledCapabilityIsReadyAndADisabledOneIsNot — the report must not be GREENER THAN GATE 7A, which refuses a disabled binding identically to a missing one. AnUnboundMeasurementRefusesRatherThanReportingReady — that the verdict statement can observe its own org binding, which is what Guard 2 compares against. AnAcceptanceThatDidNotLandRefusesTheWaiver — the count-back on the audit write, and the ONLY test that can reach it: every other sink in the suite really writes. Added on QA review 5135516009, which measured that deleting the guard was silently green. Its loss returns the code to a state where a sink that succeeds and drops leaves a live waiver with nobody's name on it. TheAcceptorFKRefusesACrossOrgMemberAtTheDatabase — the composite FK at the DATABASE, by SQLSTATE 23503 and constraint name. It is the layer that was doing the work while the Go org check was absent, which is the best argument there is for witnessing it separately.

Guard — #3155 capability-binding SERVICE tests must RUN, not skip​

DEVOPS EYES REQUESTED — the only .github/ change in #3155, and it is the #3154 / #3156 / #3167 / #3257 guard's shape verbatim: skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check (#3106). Nothing about the lane, its Postgres or its timeout changes. Eleven tests, ~1.3s measured 2026-09-23 against the lane budget (see the #2712 budget block, #3404 — dated measurement).

go test ./test/integration/context/... above is UNFILTERED, so these execute today — selection is not the gap. The gap is that nothing PINS them, and here the skip path is REAL rather than theoretical: two of them need a NOBYPASSRLS login role, and the lane's own history (#3188's isolation proof scoring exit 0 while proving nothing) is what this step exists for.

AND THE STAKES ARE WHICH ORGS ROUTE THROUGH THE GATEWAY AT ALL. This is the only WRITE surface for llm_capability_bindings, and every cutover in slice 5 (5E1, 5E2, 5E5, 4D) routes an org only when its binding reads bound AND enabled. A green lane with these absent is a green lane over the surface that decides that.

WHAT GOES UNMEASURED IF THEY STOP RUNNING, named individually because a floor of eleven is met while precisely the load-bearing one stops:

EveryReadIsOrgScopedWithoutRLS — the #3228/#3229 property, and the only test that drives this store on a BYPASSRLS connection. RLS is skipped entirely there, so the explicit org_id = $1 predicate is the sole defence — and that is the connection class operator CLIs, backfill tools and migrations run on. TheWriteSurfaceIsRLSBoundToo — the same isolation on a NOBYPASSRLS connection, INCLUDING the WITH CHECK half proved by a RAW INSERT and asserted by SQLSTATE 42501. The raw arm is load-bearing: the store now refuses a cross-org write EARLIER (its endpoint read is itself RLS-bound), so a store-only arm would report "WITH CHECK held" whenever something else refused first. DeleteCannotReachAnotherOrgsRow — #3256's class on the one statement that DESTROYS a row, on BOTH connection classes, with a positive control so a Delete that deletes nothing cannot pass. CannotBindToAnotherOrgsEndpoint — #2828's structural coherence on both write paths. PostgreSQL evaluates single-column FKs with row security OFF, so nothing else catches it. AnUnapprovedEndpointIsRefusedOnBothWritePaths — a binding onto a pending or disabled endpoint is stored, reads as configured, and denies every call. Both statuses, both write paths, each with the positive control that keeps the check a gate and not a wall. AModelTheEndpointDoesNotServeIsRefused — THE #3146 CONDITION: an org whose configuration screen was complete and whose every call was denied no_matching_endpoint, 214 times. Its four arms include the empty-model_ids case (nil is never a wildcard) and the prefix match that must still be ADMITTED. ReadinessFlipsThroughTheRealReader — create/disable/delete measured through readiness.Store, the reader every cutover gates on, rather than by asserting a row exists. The reader has its own SQL, org binding and sentinel pin; any of them can disagree with this store. TheWriteSurfaceRoundTripsThroughTheSchema — every write against the real DDL, seeded over EVERY declared capability, including the SAVEPOINT property found by measurement (a duplicate create otherwise aborts the request transaction, SQLSTATE 25P02). UpdateMovesOnlyWhatChangedAndSaysSo — the changed-field list IS the audit record's content, and updated_at moving on a converged update makes "when was this last repointed" unanswerable. SetEnabledDistinguishesTheNoOpAtTheDatabase — AND enabled <> $4, i.e. the kill-switch's no-op and its transition told apart by Postgres rather than by a read the next caller can interleave with. EveryMethodRefusesWithoutAScopeTransaction — derived over the store's exported methods, so a method added later cannot ship able to run unbound. An unbound read returns zero rows under FORCE RLS, and zero rows here renders as "unconfigured".

Guard — #3257 orgunit cross-org proofs must RUN, not skip​

DEVOPS EYES REQUESTED — the only .github/ change in #3257, and it is the #3154 / #3156 / #3167 guard's shape verbatim: skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check (#3106). Nothing about the lane, its Postgres or its timeout changes. Ten tests, ~2.1s against the then-300s lane budget (since raised — see the #2712 budget block, #3404 — dated measurement).

go test ./test/integration/context/... above is UNFILTERED, so these execute today — selection is not the gap. The gap is that nothing PINS them, and here the skip path is REAL rather than theoretical: these tests need a NOBYPASSRLS login role, and openNonBypassPool t.Skipf's when it cannot provision one. That is precisely how #3188's tenant-isolation proof scored exit 0 while proving nothing.

WHAT GOES UNMEASURED IF THEY STOP RUNNING. All eight bind one claim — that a tenant boundary holds on the connection class that SHIPS. As of 2026-09-08 every backend connection on dev/beta-dev is rolsuper = t, rolbypassrls = t, so row-level security confines nothing and these predicates are the entire isolation. Named individually, because a floor of eight is met while precisely the load-bearing one stops:

ARemoveMembershipOf... / ARenameOf... / ASoftDeleteOf... — the three silent cross-org WRITES the #3230 census measured. Each asserts the victim's ROW after a COMMIT, not merely that an error came back: a function that errors AFTER mutating satisfies the weaker check (#3226), and RenameUnit returns no count at all, so for that one the row is the ONLY place a leak is visible. AnAncestorChainIsNeverAnotherOrgsChain — the severe read. This chain becomes rbac/capability_resolver.applicableUnits, so its loss means permission decisions resolved against another tenant's tree go unmeasured. ADirectChildCountNeverCountsAnotherOrgsChildren — keyed on parent_id, so no row is read first and there is nothing to compare in Go; it is also DeleteUnit's has-children precondition. GetUnitRefusesAForeignId... — the root resolution every id-taking handler flows through, and the reason MergeUnits' Go-level compare was comparing the wrong pair. AMoveCannotSpliceTheCallersSubtreeUnderAForeignParent — the direction a "scope the id" fix leaves open: the write lands on a row the caller OWNS and the trigger splices a foreign id into its ancestor_path. AMembershipCannotBeCreatedAgainstAForeignUnit — the INSERT, whose leaked row is well-formed and RLS-legal (the caller's own org_id) while pointing into another tenant's tree. Its absence was found by the mutation harness, not by review. TheUpsertsUPDATEArmCannotTouchAForeignRow — the half a CTE does not gate. ON CONFLICT … DO UPDATE arbitrates on the unique index, not on the scoped CTE, so a pre-existing row on the same (member_id, unit_id) carrying a foreign org_id was UPDATEd and RETURNED — a read leak riding on a write. Raised in review of #3281; its fixture MANUFACTURES the pre-fix residue rather than asserting on a clean corpus. AForeignMemberCannotBeBoundIntoTheCallersUnit — the MEMBER end. member_id is a plain FK to members(id) with no org component, so the leaked row satisfies RLS (its org_id IS the caller's). THIS ONE IS NOT MITIGATED BY #1908: it was measured admitting on BOTH connection classes, so it is the one entry here whose loss is not covered by the eventual NOBYPASSRLS cutover.

Guard — #3075 GetDocument tests must RUN, not skip​

go test ./test/integration/context/... above is UNFILTERED, so these execute today — selection is not the gap. The gap is that of the guard steps in this file, none named GetDocument, document_read or #3075: they execute and are UNGUARDED, so a rename, a t.Skip, a package filter or a DATABASE_URL drift takes them out and the lane stays green. upToHead only skips under -short, so this is defence in depth.

THE ROSTER IS THE SET, NOT A SAMPLE — and that is asserted, not promised. The first version of this step pinned 10 of the 26 names its own closing echo prints, so a reader counted 26 witnesses in a green log and 10 were protected; devops measured the residue and it was exactly the row that matters — an unrostered test's SKIP is caught by the broad needle and its FAILURE reddens the lane, but its DELETION is silently green. TestKnowledgeDoc3075_CrossOrgIsNotVisible, whose own doc comment reads "is the tenant-isolation case", was among the sixteen, in a guard whose ::error:: names "a cross-team document served" as a failure mode it exists to prevent.

Discharge chosen: roster all 26 (devops option 1, the shape #3098 shipped), PLUS the echo-breadth == MUST-breadth check #3106 asks for — because rostering 26 is complete TODAY and stale the day a 27th test is written, which is the same sample-not-a-set defect one PR later. The check derives the printed set from the ECHO'S OWN OUTPUT and the pinned set from the LOOP'S OWN VARIABLE, so there is no second copy of the names to keep in step — a second speller here would be the very thing this step exists to catch.

No # needle-exclude: lines: with all 26 rostered there is nothing to exclude. If a future test genuinely should not be pinned (a latency measurement, per the #3086 ruling), it gets that annotation with its reason and the check below must learn to honour it — the rule is no silent divergence, not roster everything.

Why these tests are worth a guard at all, named individually because a floor is met while precisely the load-bearing one stops running: …ARefusedReadIsAuditedUnderProductionsCommitPolicy drives the REAL Connect handler and then applies production's own rule (internal/gateway/scope.go: status >= 400 => rollback) before counting audit rows — the only test in the repo that can see a refusal's audit row being discarded, and its in-process sibling CANNOT, because that harness commits the transaction itself. …TheReplicatedCommitRuleStillMatchesTheGateway is the pin on that pin. …EveryDesignedCodeSurvivesTheWire keeps the error taxonomy from silently becoming prose again (connect-go flattens an untranslated grpc status to CodeUnknown/HTTP 500). …AnOversizeArtefactIsNamedNotCalledCorruption keeps an in-policy document above the verification ceiling from being reported as DataLoss. …M3RedDirection, …CrossOrgIsNotVisible, …MutationVerified and …TheMCPToolRefusesAForeignRegisteredDocumentToo are the byte-fidelity and access-control core; the last exists BECAUSE the tool arm was under-pinned relative to the RPC arm, so leaving it unpinned would have been the same omission it was written to close.

Guard — #2942 member_api_keys org_id CHECK tests must RUN, not skip​

DEVOPS EYES REQUESTED — this is the only .github/ change in this PR. It follows the #3075/#3082 guard shape verbatim (skip-sweep, then a NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check #3106 asks for); nothing about the lane, its Postgres or its timeout changes. Five tests, ~5.5s against the then-300s lane budget (since raised — see the #2712 budget block, #3404 — dated measurement), measured locally.

WHY THESE NEED A FLOOR, SPECIFICALLY

#2942 is prod-enablement: it gates the deploy of MG slice-3 T3 (#2905 / PR #2927), which turns any surviving org-less member_api_keys key from "served" into a 401. Migration 237 is what makes such a row unrepresentable, and the ONLY thing that can witness a CHECK constraint FIRING is PostgreSQL. The static guards in internal/context/store/migrations/237_*_test.go read the SQL FILES and pass unchanged on a database where 237 was never applied — which is the skipped-ordinal case (#2485/#2487, the #2695 near-miss), and CI can never see it because CI databases are always fresh.

So these five are the only place in the repo where the fix is observable, and a lane that lost DATABASE_URL would report "0 SKIP + 0 FAIL" — indistinguishable from a green run (WF-28/#1906) — while an org-less credential stayed storable, selectable by any session whose app.org_id is '', and keyed on by internal/compliance/classregistry/scopes.go for retention and erasure. A silent skip here is a silently re-opened prod gate.

Named individually rather than counted, for the reason the #2729 and #3077 guards give: a floor is met while precisely the load-bearing one stops running.

AnOrgLessKeyIsRefusedByTheDatabase — the AC itself, on INSERT and on UPDATE, asserted by SQLSTATE AND constraint name. The UPDATE arm is the realistic production route to an org-less row and nothing else in the repo covers it. TheRefusalIsAttributableToTHISConstraintAndNothingElse — the mutation control. Drops the constraint inside a rolled-back transaction and requires the same INSERT to SUCCEED, so "refused" cannot be satisfied by a table that refuses everything. DownRestoresTheTableCatalogueByteForByte — the rollback, on every axis a DROP-and-recreate down loses silently: relation OID, relacl, relforcerowsecurity, scope_isolation, both 024 indexes. Also pins the 237 delta at exactly two catalogue lines, which is what catches scope creep in the UP. TheMigrationRefusesLoudlyWhenAnOrgLessRowExists — #2942's "quarantine before you constrain". Constructs the ONE state a fresh CI database never has (a table already holding org-less rows) and requires the abort to name the count, the ACTIVE count and the issue rather than emitting a bare 23514 that reads like a flaky deploy. It also walks the documented recovery to a clean apply, so the refusal is proved to have a route out. TheNaivePreflightWouldHaveBeenBlindedByRLS — the measurement behind the migration's statement ORDER. member_api_keys is FORCE RLS, so a count-first preflight reports "clean" for ANY population under a NOBYPASSRLS role. Without this the design note is folklore and gets "simplified" away.

NAME-SET DISCIPLINE (#3106): the roster below is the SET, not a sample, and the closing check ASSERTS it — the printed set is derived from THIS STEP'S OWN ECHO and the pinned set from THIS STEP'S OWN LOOP, so there is no second copy of the names to keep in step.

Guard — #2906 server-side clearance tests must RUN, not skip​

LLD #2901 §3.2's ruling is that gate 7a resolves clearance from the agent's row PER CALL, so an L5 kill-switch takes effect on the next call (MG-1.11). The only oracle for that is a real UPDATE followed by a real read, which is why it lives in this lane rather than in a pgxmock unit test — and it is therefore exactly the suite whose silent non-execution would leave the governance claim unproved while the lane stays green.

The isolation half matters for the same reason it does everywhere else: it runs under the NOBYPASSRLS role, and a cross-tenant SELECT as the docker superuser returns 0 rows for a table with NO POLICY AT ALL. A skipped run and a passing run are indistinguishable from the colour.

Guard — #2919 agent-scoped-key inventory tests must RUN, not skip​

MG-3.2's INVENTORY (T17 #2919) is the input HLD §11 makes a precondition for answering OQ-8 — the uq_key_* deprecation window's length. Somebody chooses that window from this report's numbers.

THE SUITE IS UNIQUELY VULNERABLE TO THE SKIP-GREEN TRAP because of what a failure LOOKS LIKE. Every way this can go wrong produces the same artefact: a report of ZERO agent-scoped keys.

  • the lane never ran -> nothing said
  • the predicate is wrong -> zero rows
  • the read hit RLS and was filtered -> zero rows, no error
  • the estate genuinely is clean -> zero rows

Only the last is good news, and from outside they are one output. So each name is listed INDIVIDUALLY rather than as a count:

CountedPerOrgIncludingTheZeroCase — the AC, and the only oracle for the FILTER-vs-WHERE mutation. Under a WHERE the clean org loses its line and every other assertion in the file still passes. RLSBlindnessFailsLoudly... — the proof the report cannot lie. Without it, an inventory run under the application role reports a clean estate and somebody picks a zero-length window from it. NoKeyHashIsSelected — the report is meant to be pasted into an issue. TwoOrgIsolationOnMemberApiKeys — LLD §4.5 on the new read path.

Guard — #2928 grain-budget write-surface tests must RUN, not skip​

#2928 ships the FIRST tenant-facing writer for team_budgets and llm_agent_budgets. Until it, gate 7d composed min-of over three grains of which two could not be set by any tenant action, so budget_exceeded_team was reachable only from a fixture INSERT.

EVERY TEST BELOW IS AN ORACLE THE UNIT LANE CANNOT BE. All of them are properties of what PostgreSQL does with the shipped statements, and the failure of each is SILENT in the fail-open direction:

...RefusesWith402BudgetExceededTeam The demo. A cap set through the real RPC, driven past by real ledger rows, refused at the team grain with the reason the real refusal contract serves at 402 and the ledger records. If this does not run, the surface is unproved end to end. ...ATeamWithNoRowStaysUncappedAndAdmitted THE INVERSION GUARD. Compose skips an unconfigured grain; reading it as a cap of zero would deny every call for every tenant that has not configured all three grains — which is every tenant today. A change that makes a cap enforceable is exactly the change that introduces this. ...ACapEditMovesNoWindowAndResetsNoMeasuredUsage The architect's counting AC. A cap edit that silently re-bounds the usage sum grants an unmetered remainder of the month while the API reports a sensible new limit. Only ever found by counting. ...ANullWindowedRowIsStillComposed Migration 235's relaxation as behaviour. A SURVIVING reader of the stored window drops every row the new surface writes, silently uncapping the tenant an operator just capped. ...ATeamCapWithNoDerivableWindowIsUnavailableNotUnconfigured One shared window means a NULL disables THREE caps. Unknown must be 503, never "unlimited" (#2861). ...ACapForAnotherOrgsAgentIsUnconstructable The #2828 structural guard at the grain with NO Manager gate in front of it. Its TEAM sibling stays green under the same mutation (measured) — that one is defence in depth, this one is the proof. ...ACapForAnotherOrgsTeamIsUnconstructable / ...RlsRefusesAForeignOrgInsert Tenant isolation on a table that became WRITABLE in this change. ...AnAgentCapIsSettableAndComposed The second half of the gap: llm_agent_budgets (migration 212), NOT agent_budgets (migration 057) which agent.v1.SetBudgetCap writes.

Guard — #2907 caller-provenance + external-registry tests must RUN, not skip​

MG-3.3 (#2907) puts the caller-provenance pair on the ledger and exercises the external_agent_clients constraints it REUSES. Four of the six proofs below cannot exist anywhere but here:

  • the COLUMN MAPPING — usage.Event's two provenance fields reach llm_usage_events through a positional bind list, so a transposition is invisible to every Go test (both values are strings and every unit fixture that sets one sets the other);
  • the NULL arm of credential_runtime_requires_token_class — whether Postgres treats a NULL CHECK predicate as SATISFIED is a fact about Postgres, and it is the arm an = spelling silently permits;
  • external_agent_clients_org_isolation — the POLICY, as opposed to the Go org_id predicate over it. The pre-existing suite in internal/agent/ SKIPS unless the role BYPASSes RLS, so the policy itself has never been exercised by anything;
  • uniq_external_agent_clients_active_agent and, critically, its WHERE revoked_at IS NULL half — a refusal-only test discriminates on "is this column indexed" and leaves the half every rotation depends on unguarded (#2856's class).

The isolation halves run under the NOBYPASSRLS role, and a cross-tenant SELECT as the docker superuser returns 0 rows for a table with NO POLICY AT ALL — so a skipped run and a passing run are indistinguishable from the colour.

POST-T2 (#2904 / #2953): this guard does NOT register anything, and it is not the thing that makes these tests run — the step above is unfiltered and test/lint/db_lane_coverage_test.go is what proves every test in the package is invocable. What remains here is the half that check cannot make: invocable is not executed, and executed is not passed. A DATABASE_URL-less runner SKIPs every test in this file, in green, and the coverage check would still be satisfied.

Guard — #2853 repaired fixtures must RUN, not skip​

These three were repaired by #2903 (slice-3 T1). T1 also registered them in the -run allow-list; T2 (#2904) deleted that allow-list, so this guard no longer asserts REGISTRATION — it asserts INTENT. It states, in one place, that these three specific names are expected to execute and pass, so a future rename, deletion or t.Skip() is a red lane rather than a quiet shrinkage of the population.

TestSummaryLoader_KeepsNewestN_Chronological is the load-bearing name. It did not merely fail — its cleanup dereferenced a released *pgxpool.Conn and PANICKED, which kills the test binary, so every test the package had not yet reached silently never ran. On main @75fda491 the unfiltered package emitted 326 === RUN lines and 181 --- PASS before the process died.

THE ^panic: ASSERTION IS NO LONGER HERE. It moved into the producing step above, because here it could never fire: a panic yields a non-zero exit, the test step ends exit "${PIPESTATUS[0]}", and this step has no if: always(), so the job was already red and this step never ran. Do not re-add it here — read the note on the test step for why the producing step is the only place it is both reachable and safe.

Anti-skip uses ^ *--- SKIP: (leading spaces) because Go indents subtest result lines by four spaces and an indented SKIP slips past a top-level anchor entirely.

Guard — #2727 migration-210 re-dimension + FR-7 tests must RUN, not skip​

Migration 210 is the ONLY migration in this chain whose correct behaviour is, three times out of four, TO DO NOTHING (LLD #2714 §D1). That makes it uniquely vulnerable to the skip-green trap: a lane that never ran these tests is indistinguishable, from the outside, from a lane in which every no-op rung worked. And the two directions of failure are not symmetric — a rung that wrongly refuses is a red lane, while a rung that wrongly PROCEEDS clears both embedding corpora on every install that applies the chain.

The atomicity proof is the one that cannot be recovered any other way: it INJECTS a failure into the second table's arm and asserts the first rolled back. Nothing else in this repo would notice if the two tables stopped moving in one transaction.

Assert PASS by name, and fail on SKIP.

Guard — #2677 migration-203 metering invariants must RUN, not skip​

Migration 203 makes the Model Gateway's contradictory cost states UNSTORABLE rather than merely untested: cost_null_iff_reason and gate_iff_not_allow are load-bearing (LLD #2673 §10.3), and the honesty carriers (metering_confidence, cost_unknown_events) are nullable-with-no- default precisely so a historical row cannot claim to be confident.

None of that is checkable statically — a CHECK constraint that is present and vacuous passes every string assertion — so the proofs live in this DB-backed suite. If the suite silently stops running (a rename, a regex edit above, DATABASE_URL wiring drift), the lane goes green having proven nothing, and the failure mode it was protecting against is a fabricated $0.00 in a billing ledger. Assert PASS by name, and fail on SKIP.

Guard — #2821 per-call tier-boundary proofs must RUN, not skip​

Migration 238 lets a rate-card entry declare the prompt length THROUGH which its rates are the list price, and Price refuses above it (unknown_reason tiered_above_boundary) instead of billing the base tier. The failure these bound is the one the whole metering programme exists to remove, in its most flattering form: a number known to be wrong, understating spend by up to 2x, on exactly the largest calls to the platform's most-metered model.

Why they cannot be unit tests. Pricing in production runs against the card LOADED FROM POSTGRES, not against the embedded JSON — a boundary dropped by the INSERT or the SELECT passes every unit test in internal/modelgateway/pricing and refuses nothing in production. And migration 238's backfill (§3) matches ZERO ROWS on a fresh CI database by design, which is indistinguishable from a broken statement unless a test builds the pre-238 state first, which the third test below does. Assert PASS by name, and fail on SKIP.

Guard — #3152 per-request pricing-class proofs must RUN, not skip​

DEVOPS EYES REQUESTED — this is the only .github/ change in #3152. It follows the #3051 guard's shape verbatim (skip-sweep, NAMED roster, then the ECHO-BREADTH == MUST-BREADTH check #3106 asks for); nothing about the lane, its Postgres or its timeout changes. Four tests, ~4.8s against the then-300s lane budget (since raised — see the #2712 budget block, #3404 — dated measurement).

WHY THIS ONE NEEDS A FLOOR, SPECIFICALLY

Migration 246 lets a rate-card entry be priced PER REQUEST, for a surface that reports no token usage at all (/v1/moderations, MG-CTX.23). That arm is the ONE place in pricing.Price that returns a NUMBER for a call whose metering is BLIND. It is therefore either the correct answer for a usage-block-less surface or it is the fabricated $0.00 walking back in through a door we built for it — and which one it is cannot be decided anywhere but here:

  • Production prices against the card LOADED FROM POSTGRES, never the embedded JSON. An amount that survives the file and dies in the INSERT or the SELECT passes every unit test in internal/modelgateway/pricing and prices nothing in production.
  • The exclusivity rule (a per-request entry carries no class rate and no boundary) is what makes the arm SOUND. In Go it is a validation; in the database it is a CHECK, and the difference between the two is the row somebody writes with psql.
  • The live-recorder test is the only assertion that the class fires END TO END, and its mirror inside the same test — a blind call to a TOKEN-priced model must STILL record metering_blind — is what separates "the new arm works" from "the new arm ate the honesty rule for every model", which is the ~10x defect returning.

A lane that lost DATABASE_URL reports "0 SKIP + 0 FAIL", which is indistinguishable from a green run (WF-28/#1906).

NAME-SET DISCIPLINE (#3106): the roster below is the SET, not a sample, and it is ASSERTED — the closing check derives the printed set from THIS STEP'S OWN ECHO and the pinned set from THIS STEP'S OWN LOOP VARIABLE, so there is no second copy of the names to keep in step. Verified at authoring time: 4 = 4, both differences empty. No # needle-exclude: lines — every TestModelGatewayPerRequest3152_* is rostered.

Guard — #2807 binding-service proofs must RUN, not skip​

T2 (#2807) is the gate for the whole of MG slice 2, and every property that makes it correct is a property of SQL that no unit test can reach:

  • INERT UNTIL APPROVED is a JOIN PREDICATE, not a branch. The proof that a pending binding does not resolve is a proof about what Postgres returns.
  • The #2828 org-coherence guard is an INSERT ... SELECT. There is nothing in Go to test — the incoherent row is unconstructable, and the negative control (the same insert as VALUES still succeeds) is what makes that a measurement rather than a claim.
  • RLS. A cross-tenant SELECT as the docker superuser proves LESS than nothing; these run under the NOBYPASSRLS role, in pairs.

If this suite silently stops running — a rename, a t.Skip(), DATABASE_URL drift — the lane goes green having proven none of it, and what ships is a gateway that either admits unapproved bindings or hides pending ones from the Manager who must approve them. Assert PASS BY NAME, and fail on SKIP.

Guard — #2866/#2914 denial-burst measurement must RUN, not skip​

T12 (#2914) closes #2866 by DELIVERING a refusal — Content-Length plus an explicit Flush — before h.record runs, so a single-org denial burst queues on the chain's advisory lock at the cost of a goroutine rather than of client-visible latency.

THREE THINGS HERE EXIST NOWHERE ELSE IN THE TREE, and each of them is invisible to every unit test in internal/modelgateway:

  • THE MEASUREMENT ITSELF. #2866's criterion is "measured, not modelled": p95 and p99 of client-visible latency, both arms, over a real HTTP server against a real PostgreSQL, through BuildHandler's production assembly. A mock cannot hold pg_advisory_xact_lock, so no unit test can produce this number.
  • THE NO-LOSS PROOF, counted per org and per grain INCLUDING THE ZERO CASE. It is the criterion that rules out the two bounds #2866 offered and #2859 rejected — shedding above a per-org threshold and audit.Writer coalescing — both of which pass a latency measurement and fail this.
  • THE #2949 REGRESSION PROOF. This burst is what FOUND the org-scope chain forking under concurrent appends (40 rows, 11 distinct prev_hash, VerifyOrgScope refuses). It pinned the DEFECT until #2949 landed; it is now INVERTED — asserting no fork and a verifier that accepts all 40 rows — which is what its own banner instructed, and it was renamed rather than deleted for the same reason. It is the ONLY proof that the fix holds through the real HTTP server and BuildHandler's assembly rather than against the sink directly. If it silently stops running, the finding stops being tracked by anything executable.

If this suite silently stops running — a rename, a regex edit above, DATABASE_URL drift — the lane goes green having proven none of it, and what ships is a prod-enablement gate on the :8091 switch closed on a measurement nobody took. Assert PASS BY NAME, and fail on SKIP.

The #3430 parent measures batching through the real assembly: trusted-window chain-lock waiters and distinct inserting transactions (xmin). A trustworthy waiter count above one fails even if fewer than two rows survive the held lock. Low surviving populations make only the row-based assertions unavailable, not the independent waiter evidence. Poll completion must still be inside the trusted window; failed polls are reported, never counted as zero-waiter samples. The three DB-free regression parents pin these verdict and sampling rules. The guard echoes both MEASURED and NOT ASSERTED diagnostics so degraded observations cannot disappear behind a green parent. Unheld-lock no-loss tests remain mandatory and independent of this held-lock shape experiment.

Guard — #3061 cross-tenant pool exhaustion must RUN, not skip​

#3061 is the P1 that refuted #2866's blast-radius bound: the shared resource is not the per-org advisory lock, it is the CONNECTION the lock-waiter holds. One tenant's 429 storm took the whole pool and every OTHER tenant's traffic with it.

THIS IS THE ONLY PLACE THE CLAIM IS EXECUTABLE, and the reason is structural rather than incidental:

  • IT NEEDS DISTINCT TENANT CHAINS ON ONE POOL. The six storm tenants keep the unbounded control meaningful after #3430 coalesces same-chain appends; one victim tenant measures the blast radius. Every unit test in internal/modelgateway holds the bound directly and can prove the caps arithmetic; none of them can show a tenant that did nothing losing its traffic, because that fact lives in pgxpool's Acquire queue and in PostgreSQL's lock manager.
  • ITS CONTROL ARM IS THE PRODUCTION ASSEMBLY WITH ONE CONJUNCT REMOVED (Deps.DenialRecordBound = admitEveryRecord{}). It is what stops the bounded arm from passing on a day the storm saturated nothing — the "absence scored as a pass" family. The test FAILS if the unbounded arm does not reach full pool occupancy, on purpose.
  • IT IS THE SHED'S ACCOUNTING. The bound buys availability by not writing most of a storm's records, and the second test reconciles records-not-written against model_gateway_denial_record_shed_total EXACTLY. A shed that stopped being counted is #2696 in a smaller shape and would pass every other test in the tree.

The admission ceiling applies to denial records, not every pool lease. Count waiters on the exact storm-chain advisory keys separately from total acquired connections; ordinary request work can legitimately use the remaining pool. The unrelated-lease regression pins that distinction while preserving the unbounded exhaustion and bounded victim-availability requirements (#4177).

A silent skip here leaves the :8091 routing gate closed on a cross-tenant claim nobody measured. Assert PASS BY NAME, fail on SKIP.

Guard — #2949 chain-fork regression proofs must RUN, not skip​

#2949 is the P1 that gates the :8091 production routing switch: the audit hash chain FORKED under concurrent appends, at BOTH grains, because created_at is stamped by the caller BEFORE it contends for the append lock. Migration 224 orders the chain on chain_seq instead.

NOTHING ELSE IN THE TREE CAN CATCH A REGRESSION HERE, and the reason is the defect's own history: nine tests were green over it because every fixture appended SERIALLY with hand-stamped monotonic timestamps. Only a CONCURRENT fixture against a real PostgreSQL, with real advisory locks, can produce the contention the walk order has to survive — a mock cannot hold pg_advisory_xact_lock, and a serial fixture satisfies the assumption production violates.

Three of these exist nowhere else:

  • the two BURST proofs, one per grain, counting distinct prev_hash and forked_excess rather than asking whether the chain "verifies";
  • the BACKFILL round trip, which migrates down and up with rows in place and BYTE-COMPARES every row_hash. It is the enforcement of the decision that chain_seq is not hash content — if that ever changes, every chain written before migration 224 stops verifying and this is the only thing that would say so;
  • the REORDER refusal, which is why the hash does not need the sequence in it.

If this suite silently stops running, the lane goes green having proven none of it, and what ships is a prod-enablement gate closed on a measurement nobody took. Assert PASS BY NAME, and fail on SKIP.

Guard — #2918 T16 usage read-surface proofs must RUN, not skip​

MG-3.8 (#2918) is the spend surface upsquad-client MG-FE.4 renders, and four of its properties are properties of SQL that no unit test reaches:

  • THE GRAIN IS A GROUP BY. That every event lands in exactly one bucket — including the ones with no team and no agent — is a claim about what Postgres returns for a COALESCEd key expression. EveryGrainPartitionsTheWindow is the counted proof (ADR-0034 condition 2), and it is the assertion that CAUGHT the unattributed bucket being dropped from page 1 while the totals still counted it.
  • A TOKEN SUM IS A LOWER BOUND UNLESS metering_confidence = 'complete' — migration 203's COMMENT ON COLUMN says any consumer that sums tokens MUST carry a companion count of non-complete rows. UnmeteredEventsQualifyTheTokenSums measures the production predicate against the two wrong spellings on a corpus seeded with all four confidence states; on production's actual corpus (all unassessed) the three are indistinguishable.
  • UNKNOWN IS NULL AND SUM SKIPS IT (OQ-3). The mutation that breaks it — a COALESCE — is INVISIBLE on every corpus except the all-unpriced one, because zero is the additive identity. That is MEASURED against a live database in UnknownCostIsNeverSummedIntoTheTotal, both where the mutation shows and where it hides.
  • THE WINDOW IS HALF-OPEN. Only two events, seeded at the exact bounds, can tell [since,until) from [since,until].
  • RLS. A cross-tenant SELECT as the docker superuser proves LESS than nothing; these run under the NOBYPASSRLS role, in pairs.

If this suite silently stops running, the lane goes green having proven none of it, and what ships is a spend dashboard that can under-report by an unknown amount with a confident-looking number. Assert PASS BY NAME, and fail on SKIP.

Guard — #3025 MG-3.7 endpoint/day grain proofs must RUN, not skip​

MG-3.7 T1 (#3025) adds USAGE_GRAIN_ENDPOINT and USAGE_GRAIN_DAY. The unit lane proves each has a grainSpec; it never runs the SQL, and every property that separates a correct key expression from a plausible one lives in Postgres:

  • THE ENDPOINT GRAIN'S EMPTY BUCKET IS THE NON-GATEWAY LEDGER. Migration 203's COMMENT ON COLUMN makes endpoint_id the discriminator for "the Model Gateway produced this event", so the worker-side producers write NULL — 193 of 193 rows on the corpus measured at #2918 review time. Dropping them renders as a SMALLER BILL, not as an error. EndpointEmptyBucketIsCountedNotDropped is a COUNT ACROSS BUCKETS against the totals, which is what catches a silent drop; a presence assertion does not.
  • THE DAY GRAIN'S BOUNDARY IS ONE GUC AWAY FROM MOVING. date_trunc('day', timestamptz) truncates in the session's TimeZone and a date renders through DateStyle. CI's Postgres runs UTC/ISO, so BOTH mutants are GREEN on any suite that does not shift them — DayGrainIgnoresSessionTimeZoneAndDateStyle re-reads under +05:30, -07:00 and 'SQL, MDY', and asserts each shift APPLIED before scoring the invariance.
  • THE KEYSET CURSOR IS A TEXT COMPARISON. At endpoint grain the FIRST bucket is the empty string — the afterKey *string nil-versus-"" trap, on the grain where the dropped population is largest. At day grain, chronological page order is a property of the YYYY-MM-DD format and nothing else in the tree asserts it.

EveryDeclaredGrainHasACountedPartitionProof needs NO database on purpose and is asserted here anyway: it is the guard that makes the NEXT grain (T4's SESSION) arrive with a live proof or not at all, and a guard against "a proof stopped running" must not be one of the things that can stop running unnoticed.

Assert PASS BY NAME, and fail on SKIP.

Guard — #3027 MG-3.7 session grain + AgentEconomics proofs must RUN, not skip​

MG-3.7 T4 (#3027) adds USAGE_GRAIN_SESSION and the wall-clock / termination fields AgentEconomicsTable reads. The unit lane proves the grain has a grainSpec, that every UsageAggregate field has a column, and that the latency predicate is spelled > 0. It never runs the SQL, and three of the four properties that matter are properties of Postgres:

  • THE SESSION GRAIN'S EMPTY BUCKET IS THE MAJORITY POPULATION. A session id is written only by a producer that HAS one, so every one-shot gateway call, CI caller and human caller records NULL. The realistic defect is not a NULL key — that fails loudly with cannot scan NULL into *string — it is AND bucket_key <> '' on the page's outer WHERE, i.e. "hide the ugly empty bucket". That mutant SURVIVES THE ENTIRE UNIT SUITE (measured 0 fail / 29 pass) and its first symptom is the count across buckets against the totals, which is what SessionEmptyBucketIsCountedNotDropped is.
  • IS NOT NULL AND > 0 AGREE ON EVERY ORDINARY CORPUS. Migration 227's COMMENT ON COLUMN records that 0 is the WRITER'S OWN sentinel for "not measured", and there is no total_ms >= 0 CHECK, so a negative is storable too. LatencyExcludesBothSpellingsOfUnknown is the only proof over a corpus that CONTAINS a 0 and a -5, where the two predicates disagree on the count (2 vs 4) and on the sum (350 vs 345).
  • ABSENT-VERSUS-ZERO HAS TO SURVIVE THE GROUP BY AND THE ROLL-UP. AnUnmeasuredBucketReportsNoDurationNotZero is the per-bucket half: a session with no observed duration must report total_ms_sum ABSENT, not 0. Measured: a COALESCE on the bucket sum reddens this test and NOTHING ELSE, in either lane.
  • A REASON WITH ZERO EVENTS MUST STILL BE ENUMERABLE. The corpus deliberately contains no upstream_stalled row, which is the only way to measure that the counter arrives as 0 rather than absent.

SessionGrainIsRegisteredForCoverage needs NO database on purpose and is asserted here anyway: it is what stops #3025's coverage guard going blind if a merge drops this suite's entry from the registry — the clean-merge-but-wrong shape, which this repo produced twice today.

Assert PASS BY NAME, and fail on SKIP.

Guard — #3044 buildWhere row-selection proofs must RUN, not skip​

#3044 is the EXECUTING oracle over usagereport.buildWhere's row-selection predicate, on all four statements that embed it. Its entries are not a re-proof of #2918's: every mutant named below was MEASURED SURVIVING the whole 28-test usage+latency integration surface at 2c041feb, each asserted to match store.go exactly once before scoring. Re-measured independently on this PR, same result.

drop v.org_id = current_setting('app.org_id') 0 FAIL / 28 PASS Page calls buildWhere with the filter STRIPPED 0 / 28 LatencyPage ditto 0 / 28 LatencyWindowStats ditto 0 / 28 AND bucket_key <> '' on LatencyPage's WHERE 0 / 28

THE FIRST IS THE TENANT PREDICATE AND IT IS WHY THIS GUARD EXISTS. buildWhere carries the org fact TWICE — once from the scope transaction's GUC, once from the bound $1. Dropping the BOUND half reddens #2918's TwoOrgIsolationUnderNOBYPASSRLS. Dropping the SESSION half reddens NOTHING, and the asymmetry is backwards from where the risk is: with the GUC predicate gone, the org a statement reads is decided by a FUNCTION PARAMETER. Under the NOBYPASSRLS role every other test in this lane runs as, migration 018's policy still refuses the read and the suite stays green — but store.go's own header records that "on dev and beta-dev the application connects as a BYPASSRLS superuser (#1396)", and under THAT role the explicit predicate is the only control. BothOrgPredicatesAreIndependentlyLoadBearing is the first test in the tree to read this surface as a BYPASSRLS role ON PURPOSE, and it ASSERTS the role really does bypass RLS before concluding anything — a "0 rows" produced by the policy would certify the wrong mechanism.

THE THREE STRIPPED MUTANTS ARE A SECOND CLAIM, NOT A SECOND COPY. #2918 exercises the team/agent/model predicates through Totals ALONE. "buildWhere is shared" is not the same claim as "every caller passes it the caller's own filter", and the second had no witness: a filtered QueryUsage would return an UNFILTERED page under a correctly-filtered total, and both halves look internally consistent to a client.

TheFilterCorpusDiscriminates needs NO database and is asserted here anyway: it is the control on the controls. Every arm detects a dropped predicate by observing an answer DIFFERENT from the unfiltered one, so an arm whose expected answer equals the unfiltered answer detects nothing — a green test with no subject, this repo's dominant defect family. If it stops running, the rest can weaken silently.

Σ-over-buckets == totals is NOT the oracle here and must not be mistaken for one: Page and Totals share the buckets CTE, so any buildWhere defect moves both sides together and the identity CANCELS (#3042). Every arm is pinned to an ABSOLUTE corpus constant.

Assert PASS BY NAME, and fail on SKIP.

Guard — #2913 migration-222 org-coherence proofs must RUN, not skip​

Migration 222 makes a cross-org binding and an incoherent agent_configurations row UNCONSTRUCTABLE (#2847 + #2895, LLD #2901 §5.1). Four of these proofs exist ONLY here and NOTHING ELSE IN THE TREE CAN HOLD THEM:

  • AN FK WRITTEN AGAINST THE WRONG COLUMNS APPLIES CLEANLY AND ENFORCES NOTHING. Both sides of every pair are UUID, so a transposed reference is accepted by Postgres and renders almost identically in \d. Only the APPLIED CATALOGUE distinguishes them, and only a real database has one.
  • convalidated. ADD CONSTRAINT ... NOT VALID puts a contype='f' row in pg_constraint that NEVER CHECKED THE EXISTING ROWS — a constraint that reads as present and skipped exactly the population #2847's backfill audit was about (#2873's class).
  • THE DIRTY-DATABASE REFUSAL ARM IS UNREACHABLE IN CI BY CONSTRUCTION. Every CI database is built from scratch and can never carry a pre-existing incoherent row, so the preflight's IF total > 0 branch would ship completely unexecuted. The fixture manufactures the state; this guard is what keeps the fixture running.
  • THE #2895 ORACLE RUNS WITH RLS OFF. Under the app role the predicate's presence and its absence score identically (#2828's lesson), so the one test that can see the predicate at all is the BYPASSRLS one.

If this suite silently stops running — a rename, a t.Skip(), DATABASE_URL drift — the lane goes green having proven none of it, and what ships is a schema that admits a cross-tenant binding at the moment the gateway starts taking external traffic. Assert PASS BY NAME, and fail on SKIP.

Guard — #2861 migration-223 billing-period proofs must RUN, not skip​

Migration 223 makes the org-grain enforcement window a DERIVED value — billing_period_bounds(billing_anchor_at, now()) — instead of the stored current_period_start/_end that nothing in this repository advances.

Two of these proofs exist ONLY here, and both failures are FAIL-OPEN:

  • THE MANDATORY NEGATIVE CONTROL (#2916 AC 4). A stale period_end must not silently empty the window and disable the cap. That is the exact outcome #2861 says the tempting fix — bounding the sum alone — produces, and it is invisible from every unit test: the composition returns a healthy 100% of headroom and nothing is red.
  • THE ROLLER'S TENANT SCOPE UNDER A NOBYPASSRLS ROLE (#1396, LLD section 4.5). As the docker superuser the write-isolation assertion passes against a table with no policy at all.

THE LIST IS DERIVED FROM THE TEST FILE, not typed here. A hand-written roster is the #2895 defect one layer up: a test renamed or added is a test this guard stops covering, silently, and the lane stays green having proven less than it did yesterday. The floor catches the case where the derivation itself breaks and yields an empty list — which would make the loop below pass vacuously.

Guard — #2811 gate-7b enablement proofs must RUN, not skip​

Migration 218 adds agent_configurations.llm_enablement — the NARROW-ONLY selection gate 7b enforces (MG-2.6, LLD #2801 section 3).

Three of these proofs exist ONLY here, and the direction of every one of their failures is FAIL-OPEN:

  • the #969 both-referents lookup. member_api_keys.scoped_agent_id is TEXT with no FK and an ambiguous referent (agents.id vs agent_configurations.id). Matching only one and missing reads as "this agent narrowed nothing", so the agent routes with the team's FULL approved set and nothing reports it.
  • the ambiguity refusal, which needs two rows one id resolves — a state constructible in a database and nowhere else.
  • tenant isolation UNDER A NOBYPASSRLS ROLE. As the docker superuser these assertions pass against a table with no policy at all (#1975).

Assert PASS by name, and fail on SKIP.

Guard — #3034 PGStore grain re-check proofs must RUN, not skip​

These are the ONLY exercise of usagereport.PGStore's own grain containment. #3033's review measured that deleting all four inner refusals left the entire suite green — a shadowed guard, code indistinguishable by test from its own absence — because the service's validateFilter refuses a superset and every RPC call arrives already-mapped. PGStore is exported and NewPGStore() takes no arguments, so the branch is UNVERIFIED, not unreachable.

They cannot run in the unit lane: the refusal is only meaningful when a REAL scope transaction is present, since tx(ctx) runs first and ErrNoScopeTx would otherwise stand in for the refusal — the wrong refusal passing for the right one.

The SUBTESTS are named individually, not just the parent. Page, Totals, LatencyPage and LatencyWindowStats each carry their own copy of the check; an oracle written for one is silently blind to the other three, which is the asymmetry the #3033 review called out.

Guard — #2813 termination_reason proofs must RUN, not skip​

Migration 219 adds llm_usage_events.termination_reason — the carrier for WHY an ALLOWED call ended early (task T7, LLD #2801 section 8.2). Both facts under test are CHECK constraints, and a CHECK's correctness cannot be inferred from a green run because green is its expected output:

  • termination_reason_domain closes the vocabulary at three codes. If it stops firing, a fourth situation enters the ledger as free text and every reader downstream has to guess.
  • termination_only_on_allow is phrased NULL-SAFELY (governance_outcome IS NOT DISTINCT FROM 'allow') for the same reason migration 207 exists: the equality form is SATISFIED by every unassessed row, whatever the reason contains, so the arm that most needs closing is the one that passes vacuously. That arm has its own case, and no static assertion on the file can see it.

And the Go layer SHADOWS the schema on every path that goes through usage.Event.validate(), so these tests deliberately enter below it with raw SQL. A mutation run confirmed the shadowing is real: deleting the Go rule left every recorder-driven test green.

If this suite silently stops running — a rename, a t.Skip(), DATABASE_URL drift — the lane goes green having proven none of it, and what ships is a billing ledger in which a call we cut is indistinguishable from a call governance refused. Assert PASS BY NAME, and fail on SKIP.

Guard — #2678 migration-204 effective-cost view tests must RUN, not skip​

Migration 204 is the view that closes the SILENT-DROP window migration 203 opened: since 203, llm_usage_events.cost_usd is NULLABLE and SQL SUM skips NULLs silently, so every cost reader returns a plausible smaller number with no signal. The three properties that make the view correct — presence-of-the-row decides (never COALESCE), the unknown count is exposed, and security_invoker keeps it off the cross-tenant path — are ALL invisible to a static assertion on the file and are proven only by this DB-backed suite.

If it silently stops running (a rename, a t.Skip(), DATABASE_URL wiring drift) the lane goes green having proven nothing, and what ships is an under-reported billing ledger. Assert PASS by name, and fail on SKIP.

Guard — #2800 migration-215 single-declaration oracles must RUN, not skip​

Migration 215 computes the effective-cost CASE ONCE in a CROSS JOIN LATERAL so cost_usd and cost_unknown cannot disagree (#2800, #2817).

THIS GUARD EXISTS BECAUSE THIS PR SHIPPED THE DEFECT IT DESCRIBES. The five oracles below were added, verified against a live PostgreSQL, and then reviewed on a PR whose 39 check-runs were ALL GREEN — green because TestModelGatewayView215_.* was absent from the -run allow-list this step then carried, and none of them had ever executed in CI. Found in review of #2840, not by any lane.

That allow-list is GONE as of #2904 — a test in this package now runs because it exists — so this block no longer compensates for registration. It states intent: these five names, specifically, are expected to execute and pass, and a rename or a t.Skip() reds the lane instead of shrinking the population quietly.

WHY A COUNT OR A GENERIC "SOMETHING RAN" CHECK IS NOT ENOUGH HERE. The whole finding of #2800 is that reintroducing the duplication changes STRUCTURE, NOT BEHAVIOUR: mutation M1 leaves all six migration -204 behavioural tests PASSing, and the corpus SUM is bit-identical because the fabricated value is 0.00 and zero is the additive identity. So exactly one test in this repository can observe the defect —

TestModelGatewayView215_TheCaseIsComputedExactlyOnceInTheAppliedView

— which reads pg_get_viewdef on the APPLIED view. It is also the ONLY detector of a migration silently skipped below a long-lived database's ceiling (#2485/#2487/#2695): with 204's shape installed and schema_migrations stamped to 215, all four static file guards in internal/context/store/migrations/ PASS and only this one reddens.

A floor of "N tests passed" is therefore satisfied while precisely that oracle is the one that stopped running. Assert PASS by name, and fail on SKIP.

Guard — #2846 view security_invoker oracles must RUN, not skip​

activity_feed_v1 shipped in migration 073 with no security_invoker, making it a cross-tenant read path over three FORCE-RLS tables. It survived 144 migrations. The reason it survived is THIS FILE: the test that would have caught it, TestActivityFeedV1_ClearanceMatrix, has a case literally named B_L5_noLeakFromA and was never in the -run allow-list this step then carried, so CI never executed it. That allow-list is gone as of #2904 — this case is the reason it went.

So the guard for #2846 is not optional garnish; the absence of one is the whole bug. Two things are asserted, both by name:

TestViewSecurityInvoker_EveryViewOverRLSBasesIsInvoker the CATALOGUE-DERIVED sweep. It asks pg_class which views exist and requires security_invoker on any view whose transitive base relations include an RLS-enabled table. It is the only check here that covers a view added tomorrow, and the only one that can see a CREATE OR REPLACE VIEW that dropped the option by omitting the WITH clause — PostgreSQL clears reloptions SILENTLY in that case, with no error and no notice.

TestActivityFeedV1_ClearanceMatrix the behavioural two-org oracle, which reddens on the specific leak.

A count would be satisfied while precisely the catalogue sweep is the one that stopped running. Assert PASS by name, and fail on SKIP.

Guard — #3026 migration-227 appended-column oracles must RUN, not skip​

Migration 227 appends total_ms, ttft_ms, termination_reason, governance_outcome and deciding_gate to llm_usage_effective_cost, each carrying a COMMENT naming the consumer it was admitted on (#3026, MG-3.7 T3, parent #3023).

WHY A GUARD AT ALL, GIVEN THE -run ALLOW-LIST IS GONE (#2904). It states intent: these five names, specifically, are expected to execute and pass, so a rename or a t.Skip() reds the lane instead of shrinking the population quietly. #2846's whole finding was that the ABSENCE of such a guard is what let a cross-tenant view survive 144 migrations.

WHY A COUNT OR A GENERIC "SOMETHING RAN" CHECK IS NOT ENOUGH HERE. Exactly one test in this repository can see a SILENTLY SKIPPED migration 227 —

TestModelGatewayView227_EveryAppendedColumnCarriesItsConsumerCommentOnTheAppliedView

— because column comments live in pg_description, keyed on the applied relation's OID. golang-migrate applies only versions strictly greater than the stored one, so on any database already past 227 the migration is skipped rc=0, silently, forever; 215's 21-column view stays installed; and EVERY static guard in internal/context/store/migrations/ still passes because they are assertions about files. CI can never catch it either — CI databases are always fresh — and beta-dev deploys from main.

A floor of "N tests passed" is therefore satisfied while precisely that oracle is the one that stopped running. Assert PASS by name, and fail on SKIP.

Guard — #3028 ReliabilityPanel latency oracles must RUN, not skip​

MG-3.7 T5 (#3028, parent #3023) adds QueryLatency: percentile_cont over total_ms / ttft_ms, published WITH the denominator it was computed over.

WHY THESE NAMES AND NOT A COUNT. The unit suite proves what the handler does with the numbers the store hands it. It cannot prove the numbers, because the entire measured/unmeasured decision is a FILTER clause in SQL — and the defect it excludes is invisible without a database:

`percentile_cont` ALREADY IGNORES NULLs. So a predicate that excluded
only NULL behaves identically to having no predicate at all, and
admits migration 227's OTHER spelling of "not measured" — the
writer's integer 0 sentinel — as a measured 0 ms.

That fabrication moves the percentile toward zero AND inflates sample_count, so the published denominator lies in the REASSURING direction, on a panel whose whole job is to say when things are slow. Exactly one test in this repository can see it:

TestModelGatewayLatency3028_TheZeroSentinelIsExcludedFromThePercentileAndCountedAsUnmeasured

A floor of "N latency tests passed" is met while precisely that one is the one that stopped running. Assert PASS by name, and fail on SKIP — every test in this file SKIPs without DATABASE_URL, which is the WF-28/#1906 skip-green trap in its purest form.

Guard — #3047 GovernancePanel oracles must RUN, not skip​

MG-FE.4b (#3047, parent #3023) adds the governance_outcome and deciding_gate counters to UsageAggregate.

WHY THESE NAMES AND NOT A COUNT — AND WHY THE UNIT LANE IS NOT ENOUGH. The usagereport unit suite runs against a FAKE Store, so it cannot see a query predicate at all (#3044). Both unit guards this task adds are therefore STATIC: one compares two Go declarations, the other matches the statement TEXT. Neither executes SQL, and the defect they exist to exclude IS SQL:

`COALESCE(v.governance_outcome, 'allow') = 'allow'` reads as
tidying up a NULL and reports a governance pass that NEVER
HAPPENED — for every pre-203 row and both worker-side producers,
which is the MAJORITY of today's ledger.

Migration 227's COMMENT ON COLUMN is normative that NULL means UNASSESSED, not allow. The honest predicate and the defective one AGREE ON EVERY ASSESSED ROW, so they differ only on a corpus that contains an unassessed one — which no fixture has unless it was written to. Exactly one test in this repository has that corpus:

TestModelGatewayGovernance3047_AnUnassessedRowIsCountedAsUnassessedNotAllowed

Measured 2026-09-06 against a throwaway PG 16: under that mutation it reports allow=4 (want 1) and the four counters sum to 9 over 6 calls. A floor of "N governance tests passed" is met while precisely that one is the one that stopped running. Assert PASS by name, and fail on SKIP — every test in this file SKIPs without DATABASE_URL, which is the WF-28/#1906 skip-green trap in its purest form.

Guard — #3073 document-registry proofs must RUN, not skip​

F2 T1 (#3073, LLD #3072 §3.1) creates knowledge_docs + knowledge_doc_versions. Every property that separates a correct registry from a plausible one is a property of two keys interacting, or of what Postgres refuses — neither reachable from a unit test:

  • IDENTITY SURVIVES A CONTENT CHANGE. UNIQUE (source_id, external_id) and UNIQUE (org_id, source_doc_id) are individually unremarkable; the design is that the second moves with the bytes and the first does not. With a fake store both keys are whatever the fake says.
  • THE COMPLETENESS CHECK. artefact_state='present' => raw_sha256, content_type and size_bytes are all present is what makes the discriminator load-bearing and T4's legacy row representable without the sentinel the #3076 ruling rejected.
  • THE COMPOSITE FKs. A transposed composite FK applies cleanly and enforces the WRONG property; only the resolved column names out of pg_constraint tell them apart.

THIS SUITE HAS A SECOND SKIP CHANNEL THE OTHER GUARDS IN THIS FILE DO NOT, and it is the reason this step asserts a specific ARM by name. CrossTenantIsolation/TheStoreRefusesEvenWithRLSBypassed skips ITSELF when the connecting role is not BYPASSRLS — deliberately, because on a role RLS still binds it would be measuring RLS again rather than the store's own org predicate. That arm is the ONLY test in the tree that kills the "delete every AND org_id = <GUC> from docs_store.go" mutation. If this lane ever moves to a non-superuser DSN — a direction Migrate as a non-superuser owner shows this repo already travels — that killer stops running, everything stays green, and the #1913 predicate becomes an unenforced claim again. Assert BOTH channels.

Guard — #3074 artefact-persistence proofs must RUN, not skip​

F2 T2 (#3074, LLD #3072 SS3.3) persists raw + extracted bytes and wires the delete. Four claims here exist nowhere else in the tree:

  • THE gdrive REPAIR, DEMONSTRATED BOTH WAYS. GdriveVersionAddressRepair first shows the collision FIRING - a second version at a content-blind address raises 23505 on knowledge_doc_versions_org_source_doc_key - and then shows two content-derived addresses landing under one document. Without the firing half, the green half is satisfied by a schema with no unique key at all.

  • THE THIRD artefact_state. raw_unavailable WITH raw_sha256, content_type and size_bytes all known is the state the #3076 ruling preserved by making the completeness CHECK an implication rather than a biconditional. This is the writer that produces it.

  • THE POST-COMMIT ORDERING. A DeleteSource whose transaction ROLLS BACK must leave every byte in place, because the surviving registry rows still describe them. That is an ordering across a commit, and no unit test has a commit.

  • raw != text. Every OTHER artefact fixture is md/plain, where extractText is the identity function, so three mutants are invisible BY CONSTRUCTION: text_sha256 taken over the raw bytes, size_bytes measuring the extraction, and gdrive persisting a RENDERING as the raw artefact (A5). All three survived the whole repository - not merely CI - until these two arrived, and for html/pdf/docx/pptx all three are wrong in production. The gdrive one is the higher-value half: it is the only place the tree can answer "is the persisted raw artefact the SOURCE?" (QA F2 / architect R3.)

  • CHUNK PLANE == REGISTRY PLANE. GdriveMirror asserts rag_chunks and knowledge_doc_versions carry the SAME address for the same bytes. A fake chunk store lets the two agree by never being consulted.

TheNewStoreStatementsRefuseEvenWithRLSBypassed SELF-SKIPS on a role that does not bypass RLS - deliberately, because there it would be measuring RLS rather than the statements own org predicate. It is the ONLY test that kills "delete every AND org_id = " from the three new statements, so its skip is caught by the SKIP sweep below and is meant to redden the lane rather than pass quietly (same treatment as the #3073 guard gives its bypassed arm).

Guard — #3076 backfill/M4 proofs must RUN, not skip​

F2 T4 (#3076, LLD #3072 SS3.5) is the M4 INSTRUMENT: it is the only place "every existing chunk resolves to exactly one registry row" is measured. Four claims here exist nowhere else in the tree:

  • THE RED DIRECTION IS THE POINT. #3076's acceptance says a chunk whose source_doc_id has no row must FAIL the report, not be absent from it, and asks for the case to be FORCED. A measurement that can only come out green is not a measurement, so AChunkThatCannotBeRegisteredFailsTheReport running is what makes the PASS in every other case mean anything.
  • THE BUCKETS MUST SUM. The #3076 amendment replaced two buckets with four that account for the whole legacy population. The classifier is exercised over its cross product by the package unit tests; THIS lane proves the four buckets are reachable from real registry states, which a table of structs cannot.
  • ORDER INDEPENDENCE, BOTH WAYS. The amendment forbids a sequencing constraint between the backfill and the first post-repair gdrive sync. BothOrdersConvergeOnOneDocument is the evidence for that claim, and a claim about ordering needs both orderings run.
  • THE ADOPTION'S GUARDS ARE SQL. knowledge_doc_versions CASCADEs from knowledge_docs, so a DELETE of a legacy document that still holds a version destroys it silently. The refusal is a NOT EXISTS in the statement, and only a database can refuse it.
  • ONE SOURCE, MANY DOCUMENTS - the shape every other fixture in this file misses. A Drive folder is ONE knowledge_source, and ResyncedAfter correlates on the source, so one file's sync used to relabel every remaining legacy row in the folder from "waiting its turn" to "permanently diverged" - the bucket an operator acts on. APartiallySyncedFolderLeavesTheRestPending builds that corpus and shows it CONVERGING; AnUnrelatedSiblingDocumentDoesNotRelabelALegacyRow isolates the predicate with no partial sync at all, and carries the web control that keeps legacy_content_changed from going dead. Both are also the only fixtures that reach the fifth-bucket-state mutant QA found surviving every lane, and the only witness the non-summing refusal has.
  • A SECOND IDENTITY OVER ALREADY-MERGED BYTES. raw_sha256 IS NULL survives an adoption, so without an owner check the merged row stays a merge candidate forever and a second filename over the same bytes fails the ingest - identically, every time. origin/main returns idempotently there, so the mode is introduced by this PR's hook and must not ship without its arm.
  • THE OUTER DENOMINATOR. The pass is careful about its denominator INSIDE an org; the org SET had no check at all, so a --org typo published a committed artefact reading "M4: PASS - every one of the 0 distinct addresses resolves" and exited 0. AnOrgSetThatMeasuresNothingIsRefused pins all three layers (the store refusing, Complete() over an empty slice, and the renderer declining to claim a verdict nobody measured).
  • A CROSS-ORG CHUNK MUST NOT FAIL THE WHOLE ORG. rag_chunks_source_id_fkey is SINGLE-column, so a chunk in org A referencing org B's source inserts cleanly; knowledge_docs DOES carry the composite (source_id, org_id) FK, so registering it would raise 23503 and take the tenant's entire backfill down. ACrossOrgChunkIsNamedAndDoesNotFailTheOrg is the only thing that proves the healthy addresses in that org still get their rows.
  • THE CONTENT KEY RUNS ON THE INGEST PATH, and its control is the case that would make the hook HARMFUL. ContentKeyMergeRunsOnThe IngestPath drives DocArtefacts.Record and never touches AdoptLegacyDocVersion; TwoDocumentsSharingBytesAreNotMerged is two documents colliding on one content address - identical bytes filed twice in one source - where adopting would move a LIVE document's version under another and delete the document. The two differ in exactly one column, raw_sha256.

CrossTenantIsolation runs on the BYPASSRLS superuser pool DELIBERATELY: that is how this CLI runs on dev/beta-dev (#1913), where the explicit app.org_id predicate on every statement is the only thing confining it.

Guard — #3740 Mode E (Model Subscriptions) live proofs must RUN, not skip​

WHY MODE E NEEDED AN ENTRY AT ALL (#3740 item 2, carried from the QA Q1 report on #3713). Every Mode E live test executed before this step existed — measured at 41 PASS / 0 SKIP on a scratch pgvector:pg16 migrated from zero to 278 — but it executed because the PACKAGE runs, and openPool t.Skips on an absent DATABASE_URL. Nothing asserted they PASSED rather than skipped, which is the skip-green trap every other guard in this job exists for. A grep -iE 'subscriber|subscription|369[0-9]|37[0-1][0-9]' db.yml returned ZERO matches when the item was filed.

IT IS LOAD-BEARING FOR MORE THAN HYGIENE, and this is the measurement that decides it. subscriptionhost.Host — S-HOST layer 2's single declaration — is pinned by NOTHING ELSE. Mutating it to another hostname SURVIVES ./internal/modelgateway/... entire, because every unit assertion is DERIVED from the constant; it is killed only by TestLLMEndpointCallerSubscription3702_TheCheckPinsTheHostOnBothConnectionClasses, which plants the Go constant into a real row and lets migration 273's CHECK (which holds the literal independently) reject it. That cross-declaration agreement is the only thing keeping S-HOST layers 1 and 2 from drifting apart, and it lives in the one lane that can skip-green.

SIX FAMILIES, ONE STEP, because they are one feature's live surface and the floor is a single reasoned number over all of them: TestLLMEndpointCallerSubscription3702_* the ONE permitted platform-managed caller_subscription row per org, and the host CHECK above TestSubscriber3703_* the consent + credential-expiry CHECKs that are the DATABASE half of S-REG's layered rejection, and the no-bearer-in-any-column persist scan TestModelGatewayMemberClearance3704_, TestModelGatewayMemberGrain3704_ member caps and clearance across orgs on BOTH connection classes TestSubscriberAdmission3705_* the admission admitting and refusing live TestAccountBind3706_* the account-bind CAS under two real concurrent first requests

THE ROSTER IS DERIVED FROM THE DECLARATIONS (#2861's shape), not typed into the workflow. Two consequences, both deliberate: echo-breadth == must-breadth by CONSTRUCTION, so there is no separate UNPINNED comparison to keep in sync; and a Mode E test added in a NEW FILE joins the roster by existing, because the grep is over the package DIRECTORY rather than a file list — a file list being the thing the next task forgets to extend. Editing the family prefixes to name tests that do not exist still reds: test/lint/db_lane_coverage_test.go resolves the pattern against every func Test* in the repo. The alternation is spelled out rather than held in ${NEEDLE} because that extractor lifts it from the capture group of the grep -rhoE "^func (…)\(" line and cannot resolve a shell variable there.

THE PASS AND SKIP SIDES ARE ANCHORED DIFFERENTLY, and it is a measurement. tests/scripts/test_db_guard_3740.sh case 3 deletes a parent test's own --- PASS: line and leaves one of its SUBTEST lines; under ^ *--- PASS: the guard scored that log GREEN — a subtest's result standing in for its parent's. So PASS is top-level anchored (^--- PASS: ${MUST} \() while SKIP still matches any indentation: a skip at any depth is a lost property (a connection class that silently did not run, which is how openNonBypassPool fails), and a pass at any depth is not proof the test passed.

|| true ON THE DERIVATION IS LOAD-BEARING, third instance of that class in this file: under set -euo pipefail a grep matching nothing aborts the script AT THE ASSIGNMENT, so the floor below — the one branch that explains a broken derivation — would never print. Fails closed is right; fails silent is not.

THE BEHAVIOURAL ORACLE is tests/scripts/test_db_guard_3740.sh, in the unconditional Bash script tests lane, on test_db_guard_3569.sh's five rules: 13 cases covering the green control, a SKIPped test, an absent result line, a SKIPped subtest, an empty log, and a derivation yielding nothing (rc 2, with its diagnostic asserted to SPEAK rather than exit mutely).

Run the #3601 migration-262 + binding narrowing integration suites​

THE TEAM MODEL NARROWING (core#3601, migrations 261 + 262). Two tagged packages, run together because they prove two halves of one control and neither half is meaningful alone:

internal/context/store/migrations migration 262's backfill over ALL FOUR legacy row classes, its audit trail, the SQL matcher's agreement with modelmatch.Serves, the --report pre-flight's P1-P4 and idempotence/down. This is a ONE-SHOT DATA MIGRATION OF LIVE ROWS that changes which (team, model) pairs a governance gate admits, and its widened class is the prod-enablement gate's only evidence.

internal/modelgateway/binding the narrowing's tenant boundary under BOTH connection classes. It CREATEs a NOBYPASSRLS and a BYPASSRLS role in-transaction and runs every assertion twice, so the #2828 arm — dev and beta-dev connect as a superuser for whom FORCE'd policies are bypassed — is measured rather than assumed.

Neither suite is reachable from Run integration tests above: that step runs ./test/integration/context/... only, and supplies no build tag. A //go:build integration file it does not name executes in NO lane — the #2468 build-tag variant of skip-as-pass — so this step is what makes them run at all.

WHY THE MIGRATIONS PACKAGE IS -run FILTERED AND THE BINDING ONE IS NOT​

-run allow-lists are normally the wrong tool — #2904 deleted one from the test/integration/context step precisely so a test runs because it EXISTS. It is used here for a reason that does not apply there: internal/context/store/migrations holds two classes of tagged test with INCOMPATIBLE database preconditions, and one invocation against one database cannot satisfy both.

chain walkers (TestMigration195_AppliesToADatabaseAlreadyAtTheCeiling, TestMigration200_BackfillsOnlyOpenMemoryReviewRows, ...) need a VIRGIN database: they migrate the prior tree up from scratch, so an already-migrated DATABASE_URL fails them on type "agent_session_status" already exists.

TestMigration262_Live_* need the chain ALREADY APPLIED: they seed organizations, members and llm_endpoints and then apply 262 over that corpus.

This lane's DATABASE_URL is the post-make migrate-up upsquad_test, so the walkers cannot pass in it. That is NOT a regression from #3601 and not something this PR broke: both fail identically at this PR's merge base (ac9207e92) the moment DATABASE_URL points at a migrated database. They have never run in CI at all — this package matched NO lane before this step existed, which is the #2468 build-tag hole this step was added to close, and closing it is what surfaced them. Filed as core#3610 rather than adopted here, because a #3601 PR silently taking ownership of a package-wide precondition split is how scope becomes unreviewable.

DELETE THIS FILTER WHEN core#3610 CLOSES. It exists for that bug and no other reason, and a -run left behind after its cause is fixed is how a lane quietly stops running things.

So the filter is scoped to exactly what this PR owns, and the by-name guard below is what keeps the filter honest: a renamed, deleted or skipped 262 proof reds there rather than quietly falling outside -run. internal/modelgateway/binding takes NO filter — it has no such split.

Tee so the anti-skip guard below can inspect the log.

Guard — #3601 the migration-262 proofs must RUN, not skip​

Every one of these SKIPs when DATABASE_URL is unset, and a skip would leave the lane green having proven nothing about a migration that rewrites a governance control on live rows. Assert PASS BY NAME and fail on SKIP — a floor would be met while precisely the headline proof (the four-class backfill, or the BYPASSRLS arm) was the one deleted.

THE ROSTER MUST GROW WITH EVERY NEW 262 PROOF, and that is a rule rather than a preference because the step above is -run 'TestMigration262_Live': a proof outside that prefix never runs in this lane at all, and one inside the prefix but outside this list is free to be deleted or skipped later (architect's round-3 instruction on #3606). …AgreesWithModelmatchBestClaim joined here with the R1–R3 commit for exactly that reason; the R2 and R3 assertions landed INSIDE the three proofs already listed.

Run billing integration tests​

The internal/billing //go:build integration suite (#2678). getUsageByModel reads llm_usage_effective_cost and returns UnknownEvents beside the total; the defect it guards is ARITHMETIC PostgreSQL performs over a corpus, so the mock-pgx.Tx unit tests in service_test.go are structurally blind to it — a fake returns whatever rows the author decided on and agrees with the production statement by construction. Runs against the same migrated DATABASE_URL. Tee so the anti-skip guard below can inspect it.

Guard — the #2678 billing unknown-count controls must RUN, not skip​

Both tests SKIP when DATABASE_URL is unset. A skip would leave the lane green while the only proof that the unknown count survives the trip from SQL to the service layer never executed — and until the proto field lands in slice 3, that WARN is the ONLY surface the count reaches.

Guard — #2679 rate-card + promotion-gate tests must RUN, not skip​

The promotion gate is the one control in slice 1 whose FAILURE MODE IS A PASS. llm_usage_events is FORCE ROW LEVEL SECURITY, so the obvious global form of the totality precondition returns zero rows on a connection that cannot see — and zero rows is the pass condition (LLD #2673 §6.2, R2-5). Nothing static can catch that: the SQL is correct, the Go is correct, and the answer is wrong only in an environment a unit test does not have.

TotalityFailsRatherThanPassesWhenMisbound is therefore the load- bearing name in this list: it binds a real connection to the WRONG tenant and asserts the check REFUSES rather than reporting clean. If that test stops running, the gate silently degrades to a rubber stamp and the fabricated $0.00 returns through promotion.

PromoteIsAtomicWithItsAuditRow and PromoteAuditRowIsPerOrgAndTenant- Readable are the migration-205 proofs: an action_type the enum does not admit fails its cast with 22P02 and the row is silently dropped (#1568 / #1640), so "the audit row exists" is only checkable against a live enum.

Guard — #2680 recorder-v2 + migration-207 tests must RUN, not skip​

T4 is the task that stops the ledger lying. Three of the proofs below have a FAILURE MODE THAT LOOKS LIKE SUCCESS, which is why they are named individually rather than counted:

GateIffNotAllowRejectsEveryContradictoryPair — a CHECK constraint's expected output is GREEN. Migration 203's predicate was satisfied by every row it should have refused (a NULL outcome makes the comparison NULL, and a CHECK passes on NULL), and no green run anywhere could tell. This test writes the six reachable pairs and asserts refusal BY CONSTRAINT NAME.

AFailedCostWriteRollsBackTheEvent — proves the event and its cost row are one transaction. If they stop being atomic, what ships is an event with no cost row, which T5's backfill then reads as "produced by a worker" and buries.

UnobservedIsUnknownWhileADenialIsATrueZero — the two zeros. If unknown and free ever collapse into one representation the whole slice has failed regardless of what else is green.

WorkerProducerKeepsItsCostAndGetsNoCostRow is the R2-2 regression: a cost row written for a worker event MASKS its real self-reported cost, because the compatibility view decides on the row's PRESENCE.

AnEndpointEventWithoutConfidenceIsRefusedNotStored — the failure it prevents does not happen at write time at all. An endpoint-scoped event with no confidence stores cleanly and surfaces only when --promote refuses ORG-WIDE, with no pointer back to the call. The test runs section 6.2's ACTUAL predicate, over a corpus proven non-empty first, because "no violations" and "nothing to look at" are the same query result.

Guard — #2681 backfill/reprice tests must RUN, not skip​

T5 is the job that buries the fabricated $0.00 on every historical row, and ITS FAILURE MODE IS A PASS. llm_usage_events is FORCE ROW LEVEL SECURITY (018:44), so a run that cannot see considers zero events, writes zero rows, and satisfies the four-counter assertion inserted == considered - already_present as 0 == 0 - 0. Every counter is honestly zero; the accounting is perfect; nothing happened.

That is why the three names below are the load-bearing ones and are listed individually rather than counted:

FailsRatherThanPassesOnAnUnboundConnection — the negative control. "No violations found" and "could not evaluate" must be different outcomes IN CODE (LLD #2673 §6.2). If this stops running, a blind backfill reports success and --promote is then gated on nothing.

FailsRatherThanPassesWhenMisbound — the same defect in its dangerous form: every query SUCCEEDS, RLS still filters, and the counts describe another tenant. Nothing errors.

FailsWhenTheLoopSeesLessThanTheProbe — the guard the four counters structurally cannot be. A dropped page yields a smaller set of internally consistent counters, and only a count taken by a DIFFERENT query notices.

WorkerReportedCostSurvivesUntouched is the R2-2 regression: the backfill's discriminator is cost_usd > 0, NOT endpoint_id (which is NULL on every historical row because migration 203 added it), and a NULL cost row written for a worker event MASKS its real self-reported cost, because the compatibility view decides on the row's PRESENCE.

ARowThatSilentlyVanishesFailsTheRun is the ON CONFLICT DO NOTHING trap itself: an INSERT that succeeds and writes nothing.

Guard — #2805 migration-212 binding + budget-grain tests must RUN, not skip​

Migration 212 lands three things whose correctness is invisible to every other check in this repo:

  • RLS on two NEW tables. A file containing ENABLE ROW LEVEL SECURITY proves nothing, and a cross-tenant SELECT as the docker superuser proves LESS than nothing — it reports "0 rows" for a table with no policy at all (the #1975 P1 shape). Only these DB-backed pairs, under the NOBYPASSRLS role, can tell isolation from absence, and MutationControl_DroppingThePolicyRestoresTheLeak is what keeps them from going vacuous.
  • ix_team_budgets_org_lower being USED, not merely existing. That is a planner fact. The index and the join text leu.org_id::text = lower(tb.org_id) are one fact in two files, and when they drift the index silently stops being used and gate 7d — which runs on EVERY call — falls back to a sequential scan with nothing red anywhere.
  • The cast direction. LLD #2801 section 2.2 calls the inversion a guaranteed outage because team_budgets holds the non-UUID 'dev-org' row and a predicate cast is evaluated PER ROW SCANNED. CastDirectionIsNotRhetorical plants that row and measures it.

All of it t.Skips without DATABASE_URL, so a lane that stopped running this suite is indistinguishable from one where every property held. Assert PASS by name, and fail on SKIP. Named individually rather than counted: a count is satisfied while precisely the mutation control or the cast proof is the one that stopped running.

Guard — #2814 Model Gateway denial audit-chain tests must RUN, not skip​

These are the tests that retire #2696, and the suite is uniquely vulnerable to the skip-green trap because OF WHAT IT ASSERTS: a chain walk over ZERO rows reports OK=true. So a lane in which nothing ran, a lane in which the tests ran against an empty table, and a lane in which every denial was correctly chained all render the same from outside unless the ROW COUNTS are asserted and the tests are proven to have executed.

Each name is listed INDIVIDUALLY and never as a count, because the two halves of the criterion are separate tests and losing either one silently reinstates the defect:

DenialsChainAndTheOrgVerifierAcceptsThem — the positive criterion. ChainingOffMakesTheCriterionFail — the proof it is not vacuous. Without it, the positive test could pass on a build where "audited" and "chained" mean the same thing, which is exactly what #2696 is. VerifierReconstructsChainScope — the T1b binding obligation. If this stops running, every org-grain chain can start reporting intact rows as tampered and nothing notices. VerifierDetectsCorruption/* — the negative controls. A verifier that always returns OK passes every other test here. VerifyOrgStillWalksSessionsWhenScopedRowsExist — the regression guard: scoped rows must not silently disable the SESSION walk for the whole org.

Go prints a subtest with its FULL slash-joined path and an indent (" --- PASS: TestParent/Sub"), NOT the bare leaf name, so the two subtests below are matched with a leading ^ *.

Guard — #2818 audit-chain tamper + scope-vs-mode tests must RUN, not skip​

T12's half of the same chain, and it is vulnerable to the skip-green trap for a REASON THE #2814 GUARD ABOVE DOES NOT COVER: these are the only tests in the tree that can tell "chained" from "chained because the scope said so", and the only ones that can tell "tamper-evident" from "tamper-evident for every field except the one the disposition rests on". Both distinctions are INVISIBLE when the tests do not run — the #2814 suite stays entirely green under both defects, measured:

M-H3 (unscoped entries chained too) -> #2814 file GREEN M-H4b (detail dropped from the hash) -> #2814 file GREEN

So this is not redundant with the guard above; it is the guard for the tests that exist because that suite could not see these.

Named INDIVIDUALLY, never counted — a count is satisfied while precisely the discriminating test is the one that stopped running:

ThePipelineStepIsINSIDETheHash — the arithmetic half. RelabellingTheStepMakesTheVerifierREFUSE — the operational half. Its RESTORE leg is what proves the refusal came from the content. CountedByPipelineStepAndTheNullArm — T12's audit query, both arms, counted, partitioning the population. The IS NULL arm is what fixes the predicate; a zero there means the key is written as "" and the IS NOT NULL arm is silently selecting everything. TheSCOPEChainsAndTheUNSCOPEDDoesNotAtOneMode — the conjunct isolation. Without it §5.1's ruling is not measured, only its happy path. TheKillSwitchSendsBOTHToLegacy — the other direction. A break-glass with an exception is not a break-glass. TheScopeConstantMatchesTheAppliedSchema — the cross-oracle against migration 220's column comment. Respelling ChainScopeModelGateway passed the ENTIRE tree before it existed: every test hands the constant to both the writer and the reader, so both move together. TheBudgetStatementRefusesAGUCParamMismatch — T6's defence-in-depth AND leu.org_id = $1::uuid. Deleting it survived every budget test including the NOBYPASSRLS pair, because when the GUC and the parameter agree, RLS alone already excludes the foreign row.

Go indents subtest result lines, so the SKIP trap is anchored ^ * for the same reason the #2645 guard was repointed in PR #2857.

Guard — #2815 rate-card publish tests must RUN, not skip​

These are the tests that retire #2745 — the card-2 deadlock. The suite is vulnerable to the skip-green trap in the ordinary way (no DATABASE_URL => every test skips => the lane is green having proved nothing), and to a second way that is specific to what it asserts: almost every case here is a REFUSAL, and "the publish was refused" is the default behaviour of code that does not run at all.

Each name is listed INDIVIDUALLY and never as a count. A count is satisfied by any N tests, including N copies of the easy one, and it cannot say WHICH half of a pair went missing — which matters more here than usual because three of these are pairs whose halves are useless alone:

CardTwoIsReachableEndToEndByAnOperator — the headline criterion. #2745's "a second card can be issued end to end BY AN OPERATOR, without a test seeding the row". Nothing else in the repo exercises SeedEntries creating a card row. AcknowledgementIsChainedAndTheVerifierAcceptsIt — the "on T8's chain" half. Without it, the criterion is satisfied by the LEGACY unchained path (chain_epoch=0, NULL hashes) that already exists, which is #2696 itself. ClearanceGateFiresAndCanAlsoAdmit — the L5 PAIR, in one test on purpose so the two halves cannot be separated by an edit to this list. A gate that refuses everyone passes every negative case ever written for it. ActorMustResolveToAnActiveHuman — suspended / agent / wrong-org / absent. The wrong-org case is the RLS one: members is FORCE RLS, so an unbound lookup returns zero rows. PromoteRefusesADraftEvenWhenTotalityWouldPass — the ONE test that pins "promote is no longer a publisher" behaviourally. Measured: with this test absent, restoring promote's published_at = COALESCE(...) AND removing its draft check leaves the end-to-end test GREEN, because promote then refuses at the totality gate instead and never reaches the UPDATE — same sentinel, same untouched column, wrong reason. APublishedCardCannotBeRepublished — prices are frozen once. PublishedAtColumnCommentNamesItsOnlyWriter — migration 221's operator-facing statement, checked rather than trusted.

Go prints a subtest with its FULL slash-joined path and an indent (" --- PASS: TestParent/Sub"), NOT the bare leaf name, so the subtests below are matched with a leading ^ *.

Guard — #3228 cross-org publisher proofs must RUN, not skip​

#3228: resolvePublisher left its org check to row-level security, so on a BYPASSRLS connection — which is what usage-reprice --publish runs on, since cmd/usage-reprice hands the raw DATABASE_URL pool to NewStore — another org's L5 was admitted and the publish COMPLETED.

This guard is separate from the #2815 one above for a reason that is the whole point of the issue: the #2815 suite already has a wrong-org case, it runs on the NOBYPASSRLS app role, and it stayed GREEN throughout the defect and stays green under the mutant. A guard listing only that name would have reported the guarantee present. What has to be asserted BY NAME is the arm that names its connection class.

All three subtests are listed individually, because the trio is a pair plus a control and no two of them are interchangeable:

on_a_BYPASSRLS_connection… — THE witness. Red without the fix. on_a_NOBYPASSRLS_connection… — the refusal must not MOVE between classes. Green with or without the fix, and rightly so; it is here to catch a "fix" that traded one class for the other. …still_admits_an_L5_of_the_named_org — the admit half. A predicate that matches nothing satisfies BOTH refusal arms and every negative case in the #2815 file, and would leave the operator flow (#2745) dead. MEASURED: with AND false appended to the resolver's WHERE, the two refusal arms stay green and only this one goes red.

Go prints a subtest with its FULL slash-joined path and an indent, so the subtests are matched with a leading ^ *.

Guard — #3256 guardrail org-scope proofs must RUN, not skip​

#3256 is the #3228 class again, on a key that is NOT UNIQUE. guardrails.public_id is minted from the PER-ORG guardrail_id_seq and rendered GR-01, GR-02, …, so the only unique index is (org_id, public_id) and WHERE public_id = $1 matches one row PER ORG. #3228 needed an attacker to supply a foreign UUID; here the caller supplies their own correct ordinary id and the statement fans out by itself. The #3230 census measured one DeleteGuardrail soft-deleting two rows, one of them another tenant's, returning nil.

EVERY ARM IS LISTED, as a probe list crossed with the class list — seven statements times two connection classes. The two parent names are written out LITERALLY rather than assembled from the loop variable: test/lint's db_lane_coverage resolves each needle against the repo's real func Test* set, and a name built by shell parameter expansion resolves to nothing, which it reports as a guard asserting a property of the EMPTY SET. Measured — the first draft did exactly that and the lane named it. No two arms are interchangeable:

…/on_a_BYPASSRLS_connection… — THE witness, once per statement. Red without the fix. Losing any ONE of the seven leaves that statement's org predicate entirely unmeasured, because RLS answers on every other class. …/on_a_NOBYPASSRLS_connection… — green with or without the fix, and rightly so; it is here to catch a "fix" that traded one class for the other.

The ADMIT half is not a separate arm here, by construction: each probe returns a gr3256Reach{foreign, own} and the harness checks both, so a probe cannot report a refusal without reporting what it admitted. That is why this roster names arms and not admit-arms — see the file header.

The third test pins the unscoped-call backstop (ErrMissingOrgScope), which is what a Go-side omission must produce instead of a statement that runs with no tenant in it.

Every match ends ${name} \( rather than ${name}\b, and that is a MEASURED correction rather than a style preference. Go prints a parent and its children with the SAME prefix, so \b after a parent name is satisfied by the boundary before the / of any child: deleting the parent PASS line from a real log left this guard GREEN. The trailing ( is the duration Go appends only to the line that actually terminated, so it matches the named test and nothing beneath it.

Guard — #2810 T4 narrow-only enablement proofs must RUN, not skip​

T4 (#2810) is the WRITE surface for MG-2.6. Before it, migration 218's column had a reader and a live enforcement gate and NO PRODUCTION WRITER AT ALL — which is precisely the shape that survives a green lane, so this suite is registered with its guard in the same change.

Everything it asserts is a database fact and nothing else in the repo can see any of it:

  • THE CEILING IS A JOIN. binding.GrantedEndpointIDsTx shares its approved-binding predicate with the gateway's enforcement resolver. "A pending / withheld / foreign-team / detached binding is not in the ceiling" are four statements about what Postgres returns, each re-admitted by one dropped SQL clause.
  • THE TWO AXES HAVE OPPOSITE EMPTINESS RULES. team_model_allowlists empty means NO RESTRICTION (migration 072/129); llm_endpoint_units empty means NOTHING GRANTED. Applying one table's rule to the other converts a narrow-only control into a widening one, and both directions are only visible against real rows.
  • THE ROUND TRIP RUNS THROUGH THE PRODUCTION READER. modelgateway.PGEnablementSource.LoadEnablement decodes with DisallowUnknownFields through migration 218's CHECK, which is what makes "the writer and gate 7b agree on the stored shape" a measurement rather than two structs that look alike.

AND THE ANTI-VACUITY HALVES ARE NAMED SEPARATELY, on purpose. Almost every case here is a REFUSAL, and "the write was refused" is also the behaviour of a build that refuses everyone — an authorisation check that denied every caller would satisfy MG-2.6's "the ceiling cannot be exceeded" perfectly. TheSameRequestMinusTheOffendingIdSucceeds and WideningRefusalIsDistinctFromThePolicyDenial are the two tests that make the refusals mean something, so losing either must be loud.

TheAgentLookupRefusesAcrossOrgsWithRLSOFF and ASoftDeletedTeamRefusesTheWrite are here because mutation MEASURED them: with AND a.org_id = ... or AND ou.deleted_at IS NULL deleted from agentUnitID, every OTHER test in the suite stays green. Under the app role, RLS on agents hides the foreign row either way, so the predicate's presence and its absence score identically — the #2828 lesson in a different query. They are each the sole oracle for a clause whose removal is otherwise invisible.

AnAgentPointingAtAnotherOrgsTeamIsRefused is the third of that family and the sharpest: agentUnitID's org predicate on agents is subsumed by the one on org_units for every WELL-FORMED row, so mutation left even the RLS-OFF probe green. It only becomes observable against an agent whose team_id names another org's unit — constructible since migration 070 dropped that FK. A defence-in-depth predicate whose case no test reaches is a predicate the next reader deletes.

Named individually rather than counted: a floor is met while precisely those two are the ones deleted.

Guard — #3569/#3601 UpdateAgent model-axis proofs must RUN, not skip​

THIS ROSTER EXISTS BECAUSE A RENAME IS EXACTLY WHAT HAPPENED (#3606).

test/integration/context/ is run UNFILTERED (the -run allow-list died with #2904), so a test here runs because it EXISTS — and #3601 retired team_model_allowlists, which meant three tests in this package were fixturing the model axis by INSERTing into a table nothing reads any more. They COMPILED and they PASSED, through the no-restriction arm, because the fixture no longer restricted anything. Only the tagged lane saw it, and only because a sibling assertion happened to red.

#2810 has had a by-name roster here since it landed; #3569 — the sibling suite, same package, same axis — had NONE. So the exact failure this kind of guard prevents was invisible for the one suite that lacked it.

The named tests are the ones whose SUBJECT is the model axis, i.e. the ones a retirement of its storage can silently vacate:

TheTeamsEnabledModelsNarrowWhenTheyAreInForce THE ONLY test in the package that closes the NON-EMPTY arm of llm_endpoint_units.enabled_models. Every other test leaves the column NULL and so proves the empty arm. Losing this one leaves "the narrowing is enforced" with no oracle at all — and it is the test whose fixture #3601 had to repair. ABoundTeamCannotBuyTheLegacyArmByNarrowingItAway the fail-open arm's boundary: narrowing to nothing must not re-enter the no-binding legacy arm. APrefixMatchOnTheEndpointIsAdmitted the endpoint axis is PREFIX-aware, and #3606 R1's fix must not turn the team axis into exact-model membership and refuse it. AModelOutsideTheProductIsRefusedWithNoWriteAndNoAudit NullEnablementIsTheTeamsFullApprovedProduct the two emptiness rules, in opposite directions. AnAllowedModelIsWrittenReadBackAndAuditedExactlyOnce THE ANTI-VACUITY PARTNER for every refusal above: a build that refused every model would satisfy all of them.

Named individually rather than counted: a floor is met while precisely the one test that closes the non-empty arm is the one deleted.

── #3595 ─────────────────────────────────────────────────────────── The typed roster was EIGHT names; the file declares TWELVE, and all 12 execute and PASS on main @ 3f666c1e1 (run 36526615030 job 109270999695) — the four unnamed ones were UNGUARDED, not broken. So the roster is now DERIVED from the file with a FLOOR, following Guard — #2861 above: a typed roster is the #2895 defect one layer up, since a test ADDED is a test this guard silently never covers. The prose above is the reviewer's map, not the machine's input. #3601's block stays hand-named (different file ⇒ second SRC and floor).

EVERY CHOICE BELOW HAS A MUTANT PROVING IT, IN tests/scripts/test_db_guard_3569.sh — it EXTRACTS this body and runs it against one fixture per non-execution mode. PUT NEW RATIONALE THERE, not here: db.yml sits ~506 KB under GitHub's 512,000-byte ceiling, past which a run gets ZERO jobs and this required lane silently never starts. That happened on this PR's third push at 513,179 bytes (#3667).

Guard — #3569 tier (c) UpdateAgent runtime-axis proofs must RUN, not skip​

A SECOND STEP RATHER THAN A SECOND FAMILY IN THE MODEL-AXIS STEP, and the reason is the echo-breadth check, not tidiness.

That step's breadth half compares every printed TestUpdateAgentModel3569_* against the names derived from ONE file. Adding a second family to its roster means widening TOP to an alternation — and test/lint's TestDBLaneGuardNeedlesNameRealTests lifts a derived roster's regex out of the MUSTS=$(grep -oE '^func (…)\(' …) capture group, so that line cannot reference ${TOP} and the two copies would have to be kept equal by hand across two families instead of one. The existing harness (tests/scripts/test_db_guard_3569.sh) also asserts that equality for the model family specifically, so widening it there means editing a 486-line reviewed harness to measure a different subject. Two steps, two single-family rosters, zero alternations.

WHAT THIS FAMILY PROVES THAT NOTHING ELSE IN THE REPO DOES:

TheBaseURLArmIsL4OnlyNotManager THE ONLY place in internal/agent where a field is narrower than authorizeAllowlistWrite. Its refusal AND its positive control are the same caller and the same agent — an L3 team Manager refused on llm_base_url and admitted on runtime — because a refusal alone passes identically against a build that accidentally raised the bar on the whole RPC. Losing this test loses the only evidence that a team Manager cannot re-point the tenant's egress. ExternalRuntimeIsImmutableInBothDirections the LEAVING direction needs a stored runtime = 'external', a state NO RPC on this surface can produce; it is seeded directly. A half-converted external agent has an orphaned client credential. MovingOffClaudeSDKNeedsTheOverrideClearedInTheSameRequest the "an update may not bypass a creation gate" proof for this axis. Nothing in the service tests for this case: it falls out of handing validateRuntimeConfig — the create path's own function — the pair the row will HOLD. If that call is ever replaced by a copy, this is the test that reddens. ARoutedAgentMayClearButNotAcquireAnOverride an ASYMMETRIC precondition, so both directions are named. A symmetric implementation would leave a routed agent carrying a stale override with no remediation but un-routing it first. TheWriteReadsItsOwnPreImageUnderALock stages a competing transaction, OBSERVES the block in pg_stat_activity rather than sleeping, then commits a different value underneath — so the audit before is proved to come from the locked row and not from the statement snapshot (#3640/#3651). The racing form of this test passes with and without the lock. TheAuditNeverCopiesTheOverridesUserinfo https://user:token@host is a valid override, and the audit stream has SIEM retention and a second reader. Asserted in BOTH directions: a redactor returning "" would pass a does-not-contain-the-token check while destroying the record. EveryUpdatableFieldRoundTripsThroughTheRPC THE ANTI-VACUITY PARTNER for every refusal above, and #3569's own closing claim — one table over all six request fields, each case asserting the WHOLE row so "this field changed and nothing else did" is the oracle rather than "what I wrote came back". Each case also reads back through GetAgent, because a column UpdateAgent can write and GetAgent does not project is WRITE-ONLY and the editor cannot be built from it (#3786 R1). AuthorityIsEvaluatedBeforeTheRowIsRead the ORDER claim on UpdateAgent's header, which two reviewers' mutants (MX2 / MA) showed was asserted by nothing: moving the authority gates below the locked read left all 14 tests green, while an L3 Manager learned a foreign agent's runtime class from a FailedPrecondition and took a row lock on a row it may not write. Each case is set up so the two possible refusals DISAGREE. TheReadContractRedactsTheOverridesUserinfo the read-side partner of the audit redaction, and a SEPARATE claim: GetAgent returns the configuration to every reader of an agent, a strictly larger audience than the audit stream.

Named individually rather than counted: a floor is met while precisely the L4-only test is the one deleted.

The roster is DERIVED from the file with a FLOOR (following Guard — #2861): a typed roster is the #2895 defect one layer up, since a test ADDED is a test a typed guard silently never covers. The prose above is the reviewer's map, not the machine's input.

THE TWO SUBTEST NAMES ARE HAND-ASSERTED and that is not an inconsistency with the derived roster. The derivation can only see ^func declarations, so a parent that ran ONE of its two connection-class arms PASSes identically to one that ran both — and it is the BYPASSED arm that measures the org predicate at all, because the role behind DATABASE_URL in what ships is rolsuper=t rolbypassrls=t and under the app role the predicate's presence and its absence are indistinguishable (#3230/#3290). A derived roster cannot express "this parent must have run both arms"; a by-name check can, and the cost is two lines that go stale loudly.

NO DEDICATED tests/scripts/test_db_guard_*.sh HARNESS, stated as a deliberate omission rather than left to be noticed. Two of db.yml's ~90 guard steps have one; this body is a transplant of the one that does (test_db_guard_3569.sh's subject), differing only in the family regex, SRC, FLOOR and the two subtest names, and its runtime behaviour was verified by executing it against planted logs — green, SKIP present, missing name, truncated line, unpinned witness, empty log, roster below floor — with the verdicts recorded on the PR. The honest gap is that those runs are not re-run by CI; a future PR that generalises the existing harness over a second step name should take this step as its second subject.

Guard — #2812 T6 budget-grain tests must RUN, not skip​

T6 composes three spend caps and flips ProductionRoutingReleased. Two of its properties are invisible to every other check in this repo, and BOTH of them fail SILENTLY:

  • THE PLANNER, against the statement PRODUCTION RUNS. model_gateway_binding_212_test.go already EXPLAINs a join it calls "the T6 budget join" — but that is a constant declared in the TEST FILE, hand-copied from the LLD. It proves the copy rides ix_team_budgets_org_lower; it cannot prove the gateway does, and the two agree by provenance rather than by verification. The tests below EXPLAIN modelgateway.GrainBudgetsSQL itself. When the two drift, the index stops being used with nothing red anywhere and gate 7d — which runs on EVERY call — goes to a sequential scan.
  • THE CAST DIRECTION, executed over a planted non-UUID team_budgets.org_id (the 'dev-org' row cmd/vault-seed writes). LLD #2801 section 2.2 calls the inversion a guaranteed outage because a predicate cast is evaluated PER ROW SCANNED. That is a claim about PostgreSQL's behaviour on real data.

Plus the two-org isolation pair on the composed read: a statement that leaks another org's cap into the minimum looks identical from every unit test in internal/modelgateway.

All of it t.Skips without DATABASE_URL, so a lane that stopped running this suite is indistinguishable from one where every property held. NAMED INDIVIDUALLY, never counted: a count is satisfied while precisely the plan proof or the cast proof is the one that stopped running.

Guard — #2645 provider_keys RLS tests must RUN, not skip​

The credential vault behind the Model Gateway is the highest-value isolation surface on the platform, and every assertion proving it is DATABASE-BACKED: without DATABASE_URL they all t.Skip and this lane stays green while nothing was checked (the WF-28/#1906 skip-green trap). The mutation control is called out by name because it is the test that keeps the other five honest — if IT stops running, the others can silently become vacuous.

A TOP-LEVEL NAME IS NOT ALWAYS THE UNIT OF EVIDENCE (T12 #2818, finding F4). #2843's proof that KeyExistsAnyGrain sees the team and agent grains AND stays org-bound is a SUBTEST of VaultStoreEnforcesUnderNonBypassRole. Deleting that subtest leaves its parent passing and this lane green, which is the same class of hole the neighbouring #2727 guard already argues against itself:

"Named individually rather than counted: a count is satisfied while precisely the atomicity injection is the one that stopped running."

So subtests that are the SOLE evidence for a safety property are named here alongside their parents. Note the two needles differ: Go indents subtest results, so a subtest line is --- PASS: Parent/Sub and the top-level anchor ^--- PASS: would never match it — a guard that got that wrong would fail permanently rather than silently, which is the right direction, but it is worth not having to discover.

Run agent-service integration tests​

internal/agent //go:build integration suite. Added for #2645, which found that the ADR-0022 W2/B3 agent-offboard credential cascade (deleteAgentScopedCredentials) had never removed a row: it compared provider_keys.org_id (TEXT) to $1::uuid, which PostgreSQL cannot resolve, so every invocation failed at parse time. Its only coverage was a pgxmock expectation that matches SQL TEXT and has no schema.

This package had NO CI lane at all, which is why a schema-level defect in it could ship. The existing external_agent_clients isolation suite (#1956) comes along for free. Postgres-only against the migrated DATABASE_URL.

Guard — #2645/#2816 offboard credential cascade tests must RUN, not skip​

A skipped cascade test restores the exact condition that let the defect live: an offboarded agent's third-party upstream secret staying in the vault forever — and, since #2816, its bearer API key still routing — with nothing red anywhere.

EACH TEST IS NAMED INDIVIDUALLY, not counted. A floor ("at least 3 PASSed") is satisfied by any three, so the one oracle that stopped running is precisely the one a count cannot report. This roster has already caught a guard naming a test that a git checkout -- had deleted (#2811).

Run coordinator integration tests​

Coordinator PgStore //go:build integration suite (#1832). It includes TestStore_Integration_CompleteStep_SimpleProtocolJSONB, the direct guard for the live jsonb 22P02 (#1401 class): it forces QueryExecModeSimpleProtocol internally (mirroring the deployed PgBouncer pools) so a []byte-bound jsonb write is caught in CI — the extended-protocol unit pools tolerate it, which is exactly how the class shipped. Runs against the same migrated DATABASE_URL; postgres-only (no redis/bus deps in this package's integration files).

Run agent-orchestrator cost-chain integration tests​

The cmd/agent-orchestrator //go:build integration suite (#1881): W1 cost-chain (Σ invariant), zero-drift, stepbridge, and the RealProducers_NoSeededRows anti-masking test that drives the REAL ExecuteAgentStep dispatch-anchor + usage producers (no hand-seeded coordinator_task_steps / llm_usage_events). ALSO the #1969 PR-1 transcript capture suite (TestTranscript_Integration_*): the migration-160 session_events write path + its FORCE'd RLS org-isolation. Postgres-only against the migrated DATABASE_URL. Without this lane these guards were dev-box-only and the seeded-row masking (which hid the live cost_usd=0) could return. Tee so the anti-skip guard below can inspect it.

Guard — #1969 transcript capture integration tests must RUN, not skip​

Executable form of the WF-28/#1906 shelfware lesson: a DB-backed integration test that SKIPs (DATABASE_URL unset / package filter drift) would leave this lane green while the load-bearing transcript CAPTURE write path (assistant/tool trail persistence) and its cross-tenant RLS org-isolation never executed. Fail the job if any #1969 transcript integration test SKIPped, or if none of them ran at all.

Run temporalwf activities integration tests​

The internal/temporalwf/activities //go:build integration suite (#1890): the BootRun DB path (loading the trigger context off workflow_runs) the interpreter/replay unit tests cannot cover — they inject a MOCK boot.Context, so BootRun forgetting to load it shipped invisibly and made the WF-26 entry conditional fail-closed on empty CEL args. Postgres-only against the migrated DATABASE_URL (the db filter already triggers on internal/temporalwf/**). The temporal_integration-tagged files (which need a Temporal dev-server) are a different tag and stay excluded here.

Tee so the #2678 anti-skip guard below can inspect it. Until that guard landed this step had NO execution assertion at all: every file in the suite carries a t.Skip when DATABASE_URL is unset, so a wiring drift would have skipped the whole suite and reported success.

Guard — the #2678 cost write-through controls must RUN, not skip​

recomputeRunCost is the reason T2 was scheduled ahead of its slice's critical path. It is a WRITE-THROUGH: it materialises SUM(cost) into workflow_runs.cost_usd, which cascades to tasks.cost_usd and workflows.avg_cost_usd. A read-time view can repair a read; it can NEVER repair a number already persisted into another table. If these tests stop running, what ships is permanent silent under-reporting in the billing chain, with a green lane.

The NOT-NULL half matters just as much: workflow_runs.cost_usd is scanned into a plain float64 by ten read paths, so a NULL there is a 500 on every run get/list/stream — and the under-pressure fix for THAT is a COALESCE(...,0) that reinstates the fabricated zero permanently.

Run org/team invariant integration tests​

Layer C (#1595): //go:build integration guards for the five org/team safety invariants (last-L5, clearance ceiling, cycle detection, cross-tenant RLS, two-phase gated publish). Without this step the new tests never execute in CI and can't guard against regression — which is the whole point of Layer C.

These files carry //go:build integration, so the existing untagged nightly/PR go test ./... skips them; we must pass -tags integration here. They run against the same migrated DATABASE_URL the context run uses.

-p 1 serialises the two PACKAGES. The mechanism this comment used to cite — "the member harness (freshMigrated) does a migrate down+up on the shared DB" — has been wrong since #3382: freshMigrated clones a private template and touches no shared schema. What still walks the shared chain is TestMain's single resetSharedDatabase (one down+up per process, ~7.8s measured at head 251), and that is enough to race internal/orgdraft's seeded rows. So the conclusion stands and only the reason changed (#3406, 2026-09-15).

-parallel 2 BOUNDS TestMemberHarness3382_RealProcessOutcomes, whose five arms each fork a -race child process (#3406). It is passed explicitly rather than left to default, and that is the whole point: the default is GOMAXPROCS, this job is runs-on: [self-hosted, hetzner-ci] since #3244, and the fleet's core count is documented NOWHERE in this repo. An earlier version of the test's comment asserted "GOMAXPROCS — 2 on the CI runner" and rested a memory-ceiling claim on it; it was a guess. Two at a time is a fact. It is also what the arm caps are sized against: ceil(5/2) = 3 waves x 270s = 810s <= 900s. Raising this number without re-deriving that line breaks the budget.

Guard — #4568 member API key revocation proofs must RUN, not skip​

internal/memberkeys/ and internal/scim/httpserver/ ride the org/team invariant step's go test (same Postgres, same log). Before #4568 no lane ran ./internal/memberkeys/ with -tags integration, so the only executed evidence that a membership change revokes a member's Model Gateway API keys was the author's local run. This guard fails on any TestIntegration4568_* SKIP, requires each rostered test's top-level PASS line, and fails when a test runs that the roster does not name (#3106).

Run pglisten (LISTEN/NOTIFY substrate) integration tests​

core#2512. These need no schema — NOTIFY is table-free — but they DO need both DSNs: DATABASE_URL (direct postgres service) and PGBOUNCER_DATABASE_URL (the throwaway pooler started above). The decisive assertion pair lives here: an identical listener on the PgBouncer DSN receives NOTHING while the direct one receives immediately.

Guard — the core#2512 PgBouncer control must RUN, not skip​

TestListener_Integration_PgBouncerListenIsDead SKIPs when PGBOUNCER_DATABASE_URL is unset. A skip here would leave the lane green while the only test that actually reproduces core#2512 never executed — the exact WF-28/#1906 skip-green trap, applied to the one control whose absence caused the bug to ship in the first place.

Run workflow live-DAG integration tests​

The internal/workflow //go:build integration suite (#1962): the replay-on-subscribe read path that makes a COMPLETED run viewable (TestStore_Integration_ListNodeStatusRows_CompletedRun / ...ListRunLogRows_CompletedRun) AND the security-critical cross-tenant org-scoping guard (...ListNodeStatusRows_ForeignRunReadsNothing — proves the org_id = current_setting('app.org_id') predicate is fail-closed under a BYPASSRLS role). Before this lane the file carried //go:build integration but ran in NO workflow: db.yml's filter omitted internal/workflow/**, temporal-tests.yml is a different tag, and golden-flow-e2e.yml runs only ./test/integration/goldenflow/... — so the SQL org boundary shipped with zero CI guard (WF-28/#1906 skip-green trap, the plain-integration sibling of the temporal_integration lane WF-31 fixed). -tags integration compiles the tagged file (and the untagged replay adapter tests run alongside). Runs against the migrated DATABASE_URL; postgres-only (no redis/bus deps in this package's integration files). Tee so the anti-skip guard below can inspect it.

-p 1 serialises the packages under ./internal/workflow/... (#2268): the glob matches multiple integration packages (workflow, sandbox, wfreconcile, workspace) that all reset/TRUNCATE the SAME shared scratch DB. Under the default -p (=GOMAXPROCS) they run concurrently and race those shared tables — wfreconcile/...GraceProtectsFreshTerminal hits a 40P01 deadlock on "reset scratch task tables" and SandboxCostMeter_PerLapNoOvercount reads another lap's collapsed rows. Each passes in isolation; together they flaked this required lane ~1-in-3 and blocked #2251/#2252. -p 1 forces one test binary at a time, exactly as the member/orgdraft step above already does for the same shared-DB reason. Reproduced 7/10 FAIL before, 0/10 after (10 consecutive green).

Guard — workflow read-path integration tests must RUN, not skip​

Executable form of the WF-28/#1906 shelfware lesson: a DB-backed integration test that SKIPs (DATABASE_URL unset / package filter drift) would leave this lane green while the load-bearing read paths never executed:

  • WF-1962 completed-run replay + cross-tenant org-scoping guard;
  • #1969 PR-3 GetNodeTranscript: the multi-attempt read (a redo produces several sessions per node) AND its fail-closed foreign-run org-scoping under a real NOBYPASSRLS role. Fail the job if any of these SKIPped, or if none ran at all, so the "provisions Postgres" wiring above can never silently regress. Extend the NEEDLE when a new DB-backed workflow integration test lands.

Run approval-engine integration tests​

THIS LANE IS NEW (core#2514) AND IT RESCUES EXISTING SHELFWARE.

internal/runtime/approval already carried three //go:build integration files — the #2421 TryVoidPending cancel-void (store_void_pending_), the QWP-1 list projection (store_list_qwp1_), and now the #2514 question-answer pre-flight. NONE of them executed in ANY workflow: db.yml's integration steps enumerate ./internal/workflow/..., ./internal/coordinator/... and friends but never this package, and security-unit-tests.yml runs it WITHOUT -tags integration, which does not even compile the tagged files. So the first-write CAS — the primitive every governance decision in the product commits through — had zero DB-backed CI coverage.

The #2514 suite is the reason that had to change: its whole claim is about the DURABLE row (status still 'pending', resolved_at/resolved_by still NULL, approval_events gained no resolving row), and an in-memory store cannot falsify any of it. A tagged test that only compiles is indistinguishable from one that passes (core#2372 lesson).

Postgres-only: this package's integration files touch no redis/bus. -p 1 for the same shared-scratch-DB reason the workflow lane documents above.

Guard — approval-engine CAS integration tests must RUN, not skip​

The needle enumerates only DB-BACKED test names. The same package holds a large UNIT suite that passes with no database at all, so matching those would let this guard be satisfied by tests that prove nothing about the SQL.

TestQuestionPreflightIntegration_* core#2514 B4 — the four measured modes leave the row PENDING and re-answerable TestVoidPending_* core#2421 — cancel voids a not-yet- overdue pending row TestQWP1_* QWP-1 — the answerable/list split TestEscalationGateRescue_* core#2528 — an on_breach:"escalate" gate OPENS + a human override RESOLVES it (the row's action_type was rejected by the CHECK before migration 198)

Run memory recall-bump integration tests​

The #2296 regression pins. Two packages:

./internal/runtime/session/... warm-start bump against the REAL Initialize path — it is the initializer's own pgx.ReadOnly tx that made the bump structurally impossible (SQLSTATE 25006), so the test has to drive Initialize to reproduce anything. This package also carries the TestMain that installs a real OTel meter provider, without which memory_recall_bump_failed_total records into a noop and the "swallowed BUT counted" assertions are vacuous.

./test/integration/memoryrecall/... the cross-surface conformance table (all four recall surfaces must bump what they returned) plus the cross-org isolation guard on this FORCE'd-RLS write path.

Every one of these files carries //go:build integration, so the ordinary untagged go test ./... does not even COMPILE them — they are invisible without -tags integration here.

Why the session package is -run-scoped and memoryrecall is not. ./internal/runtime/session/... has TWO integration tests that are RED on main today, independently of this lane and of #2296:

  • TestWarmStart_Integration_RankedWithinBudgetAndScoped — this is defect #2297 itself (ranking.OrderScoreSQL clamps importance, so the term cancels out of the ORDER BY and the tiny-budget packer keeps the wrong memories). #2297 is the NEXT PR in this sequence and owns it.
  • TestSnapshot_MCP_ResolverFlagGatesGovernedMCP — the #1981 governed-MCP resolver regression, unrelated to memory. Both reproduce on a clean origin/main checkout. Enumerating the whole package would therefore turn a REQUIRED status check permanently red for every PR that touches these paths, which is a worse outcome than the gap being closed. Scoping to ^TestWarmStart_Integration_Bump enforces this PR's pin now; widen the regex to the whole package the moment those two land green — the anti-skip guard below is what keeps the scoping honest in the meantime, because it fails if the pins stop executing.

-p 1 and separate invocations: both packages drive warm-start Initialize against this one shared scratch DB. Append the second run to the same log so the guard sees both.

Guard — #2296 recall-bump integration tests must RUN, not skip​

Executable form of the WF-28/#1906 shelfware lesson, and the one this PR most needs: #2296 IS a defect that shipped because its failure path was unobserved. A pin that SKIPs (DATABASE_URL unset, package filter drift, a build tag rename) would leave this lane green while the read-only-transaction regression it guards walks straight back in — and the bump is WARN-swallowed by contract, so production would not tell us either. Fail the job if any #2296 pin SKIPped, or if none ran at all.

Run memory-review approval integration tests​

The internal/context/memory/review //go:build integration suite. Three DB-backed files live here and, before this lane, NOT ONE of them ran in any workflow:

summary_backfill_integration_test.go (#2325) — the one-shot metadata["summary"] read-repair, asserted against PERSISTED governance_approvals rows: the jsonb MERGE (an assignment would destroy memory_id), the compare-and-set guard, the "one column only" write across all four statuses, the provenance stamp, and — load-bearing — WithholdsSecretShapedContent, which seeds a real ghp_…-shaped secret and greps the whole persisted metadata object to prove the preview is withheld rather than the raw token being published to an approvals card. repair_integration_test.go (#2323) — the stranded-memory approval repair incl. its FORCE-RLS scope-GUC read path and the over-real-gRPC governance shape. reviewer_integration_test.go — approve/reject/correct/forget state transitions against real agent_memory rows.

db.yml's filter has covered internal/context/memory/** since #2296, but a filter entry only decides whether the JOB runs — no STEP ever invoked this package with -tags integration, so every assertion above was green-by-not-executing. That is the WF-28/#1906 skip-green trap this file memorialises in three other places, and it is at its worst here: a redaction assertion that never runs is indistinguishable from a redaction assertion that passes, and the #2325 write is TERMINAL — a stamped row leaves the tool's predicate, so a bad preview is not recoverable by re-running anything.

Runs against the same migrated DATABASE_URL as the lanes above; postgres-only (no redis/bus/embedder deps — the repair takes DATABASE_URL and nothing else). Tee so the anti-skip guard can inspect it.

Guard — #2325 summary-backfill integration tests must RUN, not skip​

Executable form of the WF-28/#1906 lesson. The suite SKIPs (rather than fails) when DATABASE_URL is unset — testsupport.RequireScratchDB — so a lane that loses its Postgres, or a package-filter/build-tag drift, would leave this job green with the security-critical assertions never executed. Fail the job if any pin SKIPped, or if too few ran.

The NEEDLE deliberately enumerates only the DB-backed test names. The same package also holds pure unit tests with adjacent names (e.g. TestSummaryBackfill_WithholdsWhenTheWriterAlreadyRedacted, the unit sibling of ...WithholdsContentTheWriterAlreadyRedacted); those PASS without any database, so matching them would let the floor be satisfied by tests that prove nothing about the SQL — the guard would then be theatre of exactly the kind it exists to prevent.

Guard — #2399 backlog re-evaluation integration tests must RUN, not skip​

The #2399 sweep rides the SAME -tags integration ./internal/context/memory/review/... step as #2325 above and is therefore exposed to the identical skip-green trap — but it needs its OWN floor, because the guard above enumerates only the #2325 test names and would stay green with every one of these deleted.

Two numbers, not one, for the same reason #2372 used two: a regression in either half must not be maskable by the other.

Why this suite in particular must never be green-by-not-executing: it is the only thing that proves a BULK, UNATTENDED, MACHINE-DRIVEN governance transition over live tenant data does what it claims. Specifically —

  • ...StillPendingRowIsUntouchedInEveryTable — the founder's acceptance wording, asserted across agent_memory, governance_approvals AND approval_events. If this never runs, "the genuinely quarantined rows are untouched" is an unverified claim about a live queue.
  • ...RedactionEscalatedRowStaysQuarantined — proves the #2095 quarantine-on-redaction-hit is REPLAYED, not just the classifier. A sweep that dropped it would silently un-quarantine every row the writer had to scrub.
  • ...NoActivatedMemoryIsLeftWithAPendingApproval — the #2323/#2329 orphan class, counted over the whole swept corpus rather than sampled.
  • ...ReclassifiedAuditActionIsAcceptedByTheEnum — the mig-125 lesson; without it a missing migration 197 makes every audit row vanish on its enum cast while the sweep reports success. A skipped assertion here is indistinguishable from a passing one, and the write is not recoverable by re-running anything.

Guard — #2507 operator-override approval-resolution tests must RUN, not skip​

Third floor on the SAME step, for the same reason the #2399 guard needed its own: the two needles above enumerate only #2325 and #2399 test names and would both stay green with every #2507 test deleted.

What these prove, and why a skip here is not survivable:

  • ...TerminalTransitionResolvesPairedApproval — the fix. An operator override that drives a memory terminal outside governance must not strand the approval opened for it. Unproven, this reopens the #2507 defect once per override, and the discard of a 45-row backlog would mint 45 permanently-pending approvals in a single command.
  • ...NeverOverwritesAGovernanceDecision — the SAFETY CONVERSE, and strictly the more dangerous direction. The resolution rides the same code the in-band governance handler drives, and only the status = 'pending' predicate stops a real human approve/deny being silently rewritten as an out-of-band operator override. Losing that falsifies the audit trail rather than merely littering a queue.
  • ...FailedTransitionResolvesNothing — atomicity. A resolve that escaped the transition's transaction would void the approval while the memory stayed pending: the #2323 stranded class, re-created from the other side.
  • ...ResolutionIsTenantScoped — governance_approvals.org_id is TEXT while agent_memory.org_id is uuid, so the tenancy predicate is hand-written with no foreign key behind it. Nothing but this test stops a cross-tenant governance write.

Run memory near-duplicate collapse + AML integration tests​

./internal/context/memory/ — the PARENT package. Note the absence of /...: this is deliberately NOT a widening of the review lane above.

The step above runs ./internal/context/memory/review/..., which does not match the parent directory, and until #2372 NO lane in ANY workflow ran the parent package with -tags integration. So the package sat in the exact gap the comment above memorialises — one directory up from the three files it was written about, and immediately below it in this file. Go Vet (integration tag) proved these files COMPILED; nothing ever proved they RAN, and a build-tagged test that only compiles is indistinguishable from one that passes.

FIVE integration files land in this lane, and only one of them is new: neardup_integration_test.go (#2372) — the near-duplicate collapse: threshold boundary walk on real pgvector <=>, the active-only and same-type/same-embed-model predicates, the oldest-wins survivor rule, idempotency under redelivery, the FOR SHARE concurrency pin, and — load-bearing — the tenant/agent isolation assertion, which is core tenet 1 and which a source-level pin structurally cannot prove. memory_isolation_integration_test.go — four cross-tenant confinement pins over the direct store, semantic recall, the assembly loader and the embed write path. NEVER RAN before this. memory_poisoning_integration_test.go — contradiction/supersede stability, below-bar recall suppression, result-copy independence, tombstone-then-recreate hash-chain continuity. NEVER RAN before. memory_degraded_integration_test.go — store-down/embedder-down degradation returns errors rather than panicking. NEVER RAN before. aml_testsupport_integration_test.go — shared fixtures.

Sequencing note for whoever edits this next: this step MUST stay ABOVE Run migrate down, and the suite MUST leave no residue. Migration 169's DOWN refuses to roll back over a procedural agent_memory row by design (LLD #2069 §1 — it will not delete durable memory to satisfy a schema rollback), and the poisoning suite seeds one. Measured before the fix: migrate down -all aborted and 127 tables remained, failing Verify clean rollback on a REQUIRED check. The seed helpers now drop their rows via t.Cleanup; see dropSeededMemoryOnCleanup.

Same migrated DATABASE_URL as the lanes above. Postgres-only: the embed worker is driven synchronously through EmbedOne with a nil Redis client and an always-miss vector cache, so no bus or embedder service is needed.

Guard — #2372 near-dup + AML integration tests must RUN, not skip​

Quoted: an unquoted # starts a YAML comment, which is why the sibling guards above all render as a bare "Guard —" in the Actions UI. Executable form of the WF-28/#1906 lesson, and the direct answer to how #2372 shipped 11 green assertions that CI never executed. The suite SKIPs rather than fails when DATABASE_URL is unset (testsupport.RequireScratchDB), so a lane that loses its Postgres — or a package-filter, build-tag or -run regex drift — would leave this job green with the governance and tenant-isolation assertions never run. Fail the job if any pin SKIPped, or if too few ran.

The NEEDLE enumerates only the DB-BACKED test names, and deliberately omits the source-level pins in neardup_test.go (OnlyEmitsActiveToSuperseded, SurvivorRuleIsServerSideDeterministic, ThresholdsAreCalibrated, DisabledNeverTouchesTheDatabase). Those PASS with no database at all, so matching them would let the floor be satisfied by tests that prove nothing about the SQL — the guard would then be theatre of exactly the kind it exists to prevent. Same reasoning as the #2325 guard above; that guard's comment is the precedent.

Guard — #2728 T6 staleness-key tests must RUN, not skip​

LLD #2714 §5 T6 / PRD #996 FR-8. These ride the same ./internal/context/memory/ invocation as the #2372 guard above, but are floored SEPARATELY and by name, for the reason that guard states about its own siblings: one number cannot tell which half regressed.

What is unprovable without them: the memory embed path's staleness key was content-hash-only, so a model switch — which by construction leaves content untouched — reported ZERO stale rows forever. The failure mode is a clean exit. Nothing errors, the tool prints 0 candidates, and an operator reads that as a converged re-embed. A suite that stops executing therefore looks exactly like the bug it was written to catch.

Both named tests are load-bearing and neither subsumes the other: AForeignModelIsStaleAndTheLiveOneIsNot — BOTH directions. A predicate that called everything stale passes the switch case and fails this one, and it converges on every run by re-embedding the whole corpus. PredicateAndUpsertAgreeOnEveryCombination — the candidate predicate and the ON CONFLICT … WHERE are two SQL renderings of one rule and cannot be one string. Candidate-yes + write-no is an unbounded loop that reports N processed forever while the corpus never moves; only a real database can say whether the two agree.

Run #2728 T6 memory-backfill integration tests​

./cmd/tools/memory-backfill/ — a package with no -tags integration lane in any workflow before this step, for the same structural reason ./internal/context/memory/extraction/ had none until #2499: its loop was reachable only by running the binary against a live Redis and a hosted embedder, so nothing ever drove it.

That is not a coverage gap in the abstract. It is why the content-hash-only candidate predicate survived: everything that tested the tool agreed with the tool. The suite now injects the process resources (scratch pool, in-process embedder, nil Redis, always-miss cache) and drives the SHIPPED loop — the same predicate, keyset paging, counters and resumption.

Postgres-only, and a SEPARATE invocation from the memory package above: a maintenance job counts the whole table by definition, so these assertions must not interleave with another suite's seeds inside one go test process. Across processes they are safe by construction — each test records a baseline candidate count first and asserts deltas on top of it, which is what keeps this lane from failing over somebody else's residue. (Writing it turned up two such rows leaked by the memory suite since AML PR-8; fixed at their source in the same PR.)

Like every lane above it, this must stay ABOVE Run migrate down and leave no residue of its own.

Guard — #2728 memory-backfill honest-count tests must RUN, not skip​

The anti-skip guard in the established shape. This suite SKIPs rather than fails when DATABASE_URL is unset (testsupport.RequireScratchDB) or when the role does not bypass RLS, so without this a lane that lost its Postgres would go green having proven nothing about a tool whose defect IS a green report.

Named individually rather than counted: TheReportedCountIsTheCountItProcesses — three numbers must agree, and the third (rows that actually carry the new identity) is the one that matters: Candidates == Processed alone is satisfied by a run that walks N rows, embeds each at full cost, and has every write discarded by the upsert's own staleness guard. AnInterruptedRunResumesWithoutSkippingOrDoubleProcessing — FR-8's resumability, asserted across ALL N by counts and by created_at immutability, never by "row 1 exists". ASecondRunUnderTheSameIdentityIsANoOpAndTheOldOneIsNot — the NFR-5/G7 convergence property plus the rollback direction. DryRunReportsTheSameCountAndWritesNothing — --dry-run is where the "0 candidates" lie was read, so its number must be the real one.

Run #2729 T7 RAG re-embed + staleness + source-status integration tests​

THREE packages, one invocation, all Postgres-only against the migrated DATABASE_URL:

./cmd/tools/rag-reembed/ brand new; no lane could pre-exist ./internal/context/embedding/ had NO -tags integration lane in ANY workflow — the same structural gap as ./cmd/tools/memory-backfill/ before #2728, one directory across ./internal/knowledge/ ten integration files, none of which any workflow has ever executed

That last one is why knowledge/store.go could report 0 pending for an invisible corpus indefinitely: the only tests of the counting query were build-tagged, so they were type-checked by Go Vet (integration tag) and never run. A build-tagged test that only compiles is indistinguishable from one that passes (WF-28/#1906).

-run is anchored to named suites rather than opened to the whole ./internal/knowledge/ package: those ten pre-existing files have never executed in CI and adopting all of them is a separate piece of work with its own failure surface. Named suites here, deliberately, so this step measures exactly what it claims to.

TestOrgV24_Integration_.* joins the alternation for #3077 (TK-5.1, the Org Model v2.4 retrieval resolver). Those tests were added to this package by that PR and hit precisely the gap described above: they compiled under Go Vet (integration tag) and never executed. One of them — MembershipRemovalIsNotMaskedByTheAxisCache — is the entire justification for wiring the knowledge axis with a nil Redis, so a future PR re-adding the Redis-backed axis must redden something. The alternation is extended rather than the package un-anchored, for the reason in the paragraph above.

TestWithhold3078_Integration_.* joins it for #3078 (TK-5.3, the knowledge withhold primitive), for exactly the same reason and with the same shape. The only tests that can reach the CHECK constraints, the real ancestor walk, the accepted-cross-offer door and the retrieval cache key are DB-backed, and DB-backed in this package has meant never-executed. NOTE the _Integration_ infix: the always-on half of that suite is TestWithhold3078_* without it, and it runs in the ordinary Go Test lane — anchoring on the infix keeps this lane measuring only what needs a database.

TestKnowledgeWithhold3222_Integration_.* joins it for #3222 (TK-7.3 / F5c, the withhold WRITE surface), and it is the highest-value member of the alternation. It carries #3222's acceptance criterion: the seven T6 oracle bodies RE-RUN with the writer swapped for the SetSourceWithhold RPC, so "a source withheld through the new write path disappears from the child unit's retrieval" is measured rather than asserted. It also holds the Manager-authority denial battery. Both halves need a real ancestor walk and real org_units rows, so both are DB-only — and DB-only in this package has meant never-executed. Same _Integration_ infix convention: the always-on half is TestKnowledgeWithhold3222_* without it.

Like every lane above it, this must stay ABOVE Run migrate down and leaves no residue of its own: every seeded org is dropped on cleanup and context_embeddings cascades from rag_chunks (migration 004's FK).

Guard — #2729 T7 RAG re-embed tests must RUN, not skip​

Every suite above SKIPs rather than fails when DATABASE_URL is unset (testsupport.RequireScratchDB) or when the connecting role does not bypass RLS. Without this guard a lane that lost its Postgres would go green having proven nothing about a defect WHOSE SIGNATURE IS A GREEN REPORT — pending_chunk_count = 0 for a corpus recall cannot see.

Named individually rather than counted, because a floor is met while precisely the load-bearing one stops running:

TheReportedCountIsTheCountItProcesses — three numbers must agree, and the third (chunks that actually carry the live identity) is the one that matters: Candidates == Processed alone is satisfied by a run that walks N, embeds each at full cost, and has every write discarded by the upsert's own WHERE. AnInterruptedRunResumesWithoutSkippingOrDoubleProcessing — FR-8's resumability, asserted across ALL N by counts, by the embedder's own call counter and by created_at immutability, never by "chunk 1 exists". AChunkWhoseVectorDriftedFromItsContentIsRewritten — the ONLY scenario that reaches the upsert's ON CONFLICT arm through the shipped loop, and therefore the only one that can tell DO UPDATE from DO NOTHING. APoisonChunkIsSkippedOnceAndTheRunTerminates — the ONLY test that covers the keyset cursor. Mutation showed the cursor is redundant on a healthy corpus (resumption is a property of the predicate) and load-bearing on exactly one input: a permanently failing row, which stays a candidate by construction. Without it the tool loops forever on that row, re-billing the embedder, printing the same numbers. If THIS one stops running, the other six still pass. TheUniqueIndexRejectsASecondLiveRow — asserts migration 211 BY INDEX NAME. A duplicate count of zero is also what a table with no constraint and no duplicates looks like, and this chain has four permanent gaps (32, 192, 202, 206) into which a migration can be authored and silently never applied. PredicateAndUpsertAgreeOnEveryCombination — predicate-says-candidate + upsert-writes-nothing is an unbounded loop reporting progress forever. PendingRisesToTheTrueBacklogAfterASwitch — the defect itself, in both directions on one corpus. ChunkCountIsNotInflatedByASecondModelsRows — the regression T7 creates the conditions for: the old LEFT JOIN count multiplies by embedding rows per chunk, which was harmless only while no chunk could have two.

Guard — #3077 org v2.4 retrieval-resolver tests must RUN, not skip​

These four run in the SAME invocation as the #2729 suites above (same log), so this step only has to read it. They are guarded separately because they prove different things and one of them is load-bearing for a wiring decision rather than for a query.

Named individually rather than counted, for the reason the #2729 guard gives: a floor is met while precisely the load-bearing one stops running.

SwitchOffMatchesTheV23WalkForEveryNonMemberShape — the ACCESS-CONTROL one, and the reason the others exist. With the read-switch OFF the adapter must resolve the same set as the v2.3 walk it replaced, for EVERY non-member caller shape on EVERY topology. Without the uniform routing, an ancestor unit's visibility='private' binding reaches the units below it — an entitlement change, on the DEFAULT path. It is a table (3 topologies x 4 shapes) rather than a case list because per-shape analysis got this wrong twice; a floor over subtests would be met while precisely the teams-only or three-level row stopped running, so the PARENT test is what is pinned and it fails if any subtest does. SwitchOnDiffersFromV23OnlyByAcceptedCrossOffers — was SwitchOnStillDiffersFromV23, the pin that asserted #3089's bypass was PRESENT so the fix could not land quietly. It flipped when #3089 landed and is now an exact decomposition: switch-ON == v2.3 walk union accepted-cross. That pins both halves — the home chain must not widen (#3089) and the cross door must not close (#3077 A1's premise) — where a bare equality would have held vacuously on a fixture with no relation edge. AgentResolvesItsOwnScopeNotAMemberAnchor — agents carry member_id NULL in org_unit_memberships, so a member-anchored resolve returns NOTHING for them and the failure is a silent empty set. Now seeded with an ancestor binding of each visibility, because the team-only fixture it had was the single configuration where both walks agree. MembershipRemovalIsNotMaskedByTheAxisCache — the entire justification for wiring the knowledge axis with a NIL Redis. It is two-sided: it demonstrates the 15-minute masking WITH a Redis-backed axis and its absence without one. If this stops running, a PR re-adding that cache reddens nothing and the revocation window silently reopens. TwoHumansOneScopeResolveDifferentSets — A1's premise on real rows. If it ever stopped holding, the retrieval cache-key digest would be defensive rather than load-bearing and the whole of #3077 would be mis-specified. It is the assumption the design rests on, so it is checked rather than assumed.

ResolverCostColdAndWarm is deliberately NOT in this list: it reports latency and asserts only warm <= cold, so pinning it here would make a busy runner fail the lane for a measurement that is advisory by design.

Guard — #3078 knowledge withhold tests must RUN, not skip​

Same skip-green trap as the two guards above, over the suite added by #3078 (TK-5.3). Every case SKIPs rather than fails without a scratch DATABASE_URL, and this feature's failure mode is a CONTAINMENT one: a withhold that silently does not apply looks exactly like a tenant with nothing withheld.

Named individually rather than counted, because a floor is met while precisely the load-bearing case stops running:

SubtreeScopingLeavesSiblingsUntouched — PRD #2995 US-5 in both directions: the withheld subtree loses it, the SIBLING subtree and the PARENT keep it. A one-team fixture satisfies the first half and has no counter-example for the second. WithholdBeatsGrantFromEveryEntryPath — four doors (direct, ancestor inherit_down, sibling shared_siblings, org-wide). The sibling door is the one that can WIDEN: without the binding_kind='grant' predicate a withhold row carrying visibility='shared_siblings' is unioned IN, and a sibling is not on the anchor's chain so nothing subtracts it again. TheResolverCacheFreezesGrantsAndNotWithholds — HLD #3046 A3 measured as an asymmetry, both rows written the same way behind the same warm cache. If it stops running, a change that folds the subtraction into the cached artefact reddens nothing and the restriction becomes frozen for a TTL. TheOrgUnitResolverCacheFreezesGrantsAndNotWithholds — the SAME asymmetry at the second cache. orgunit.Resolver caches an EffectiveConfig in-process keyed on the STRUCTURE version, which a withhold write does not bump, so every subtraction inside the axis sits below it. This is the only test that can fail when the adapter's subtraction above that cache is removed. TheWithholdHoldsWithTheCacheHotAndInvalidated — the arm that survives Phase 2. Its sibling above reds under the adapter-subtraction mutant ONLY because its fixture does not bump org_versions.version_seq, so the day TK-7.3's writer calls InvalidateOrg that sibling's grant control becomes false and gets re-engineered. This one asserts the same property with the cache HOT and INVALIDATED, so it is true under either remedy #3102 takes. If it stops running, the re-engineering lands with nothing left standing. ACrossOfferedWithholdRowMustNotArriveAsAGrant — the WIDENING door, and the only behavioural witness for the grant predicate on the OFFER read. Its sibling below withholds at the ACCEPTING unit; this one puts the withhold on the OFFERING unit, where the resolver's own subtract cannot reach it because that pass is scoped to the acceptor's chain. CrossOfferCannotReAddAWithheldSource — the door the axis subtraction alone does not close. It needs real unit_relations + unit_accepted_offers rows, so it exists nowhere else, and it is dark in production only until the v2.4 read-switch flips (#3089). AWithholdMakesThePriorCacheEntryUnreachable — the LLD §5.3 claim end to end through the real retrieval service, WITH a cache-hit control. It is the only test that can tell "the resolver subtracted" from "the subtraction reached the source-set digest", and the difference between those two is a stale-served withheld document. TheConstraintsRefuseByNameAndSQLSTATE — migration 231's two CHECKs by NAME. A refusal by the wrong rule is a green test over an absent one. AttachOverAWithholdIsRefusedByName — carries the RPC arm: the refusal must reach AttachSourceToUnit as FailedPrecondition, not as the generic Internal, which an operator can only respond to by retrying forever. TheInventoryDoesNotRenderAWithholdAsAnAttachment — the behavioural pin that closes the static guard's own "or explain why this read is exempt" exit. SourceUnitBinding cannot say withhold, so a withhold surfaced through ListSourceUnits reads as an attachment.

Guard — #3222 withhold WRITE-surface tests must RUN, not skip​

The #3078 guard above cannot cover these: it anchors on TestWithhold3078_Integration_, and #3222's tests are named TestKnowledgeWithhold3222_Integration_. A guard that does not name a suite does not guard it.

This is the lane that proves #3222's acceptance criterion, and its failure signature is a GREEN REPORT: if these skip, the withhold write surface ships with the enforcement claim unmeasured — a Manager told the subtree is denied, over a subtree that is not. Named individually rather than counted, for the reason the #3078 guard gives: a floor is met while precisely the load-bearing member stops running.

TheEnforcementOracleHoldsForRPCWrittenBindings — THE acceptance criterion. Seven T6 oracle bodies re-run with the writer swapped for the RPC. Its subtests are asserted individually below, because the parent PASSes only if all seven ran and a trimmed list would still report the parent green. EveryDenialPathIsNamed — Manager-only authority is worth exactly what its refusals are worth. Includes the CONTROL (the Manager succeeds), without which every negative is satisfied by a handler that refuses everyone. The a_non-Manager_AND_a_source_from_another_tenant subtest is named separately because it is the ONLY case that discriminates the gate ORDER (QA finding F2 on #3266): every other row passes under either ordering, so without this one, reversing the gates — and handing a non-Manager an existence oracle over the org's source ids — reddens nothing. TheStoreOrgGuardRefusesForeignIdsOnItsOwn — the store's INSERT...SELECT org predicates, which the service gates MASK: QA removed both and the entire suite stayed green (F1). Its two cases are named individually because each is the SOLE WITNESS for one predicate; a single case supplying two foreign ids is killed by either and pins neither. AuditParityOnSetAndClear — #3222's parity constraint. The CLEAR arm is the half that gets forgotten, and it is the direction that RESTORES access. TheReadPathRendersWithholdStateAndOnlyThat — AC #3, both halves: the new read reports the withhold AND the inventory read still does not. TheWriteSurfaceCannotCreateAnInertWithhold — an operator action that reports success and changes nothing (PRD #2995 R6).

Run #2499 class-tiered mutation integration tests​

./internal/context/memory/extraction/ — a package that had NO -tags integration lane in ANY workflow before this step.

It is not a new gap; it is the #2372 gap one directory across. Every integration file in that package (consumer_integration_test.go, importance_integration_test.go, replay_integration_test.go) has been build-tagged since AML PR-5 and has therefore only ever been TYPE-CHECKED, by Go Vet (integration tag). A build-tagged test that only compiles is indistinguishable from one that passes — the WF-28/#1906 lesson, and the exact shape that let #2372 ship 11 assertions CI never executed.

The lane is added by #2499 because that change makes the package's assertions load-bearing in a new way. Class-tiered mutation (#2155 §5) leaves a quarantined row UN-REDACTED at rest, and the founder approved that trade-off on the premise that such a row can never reach an agent without a human decision. tier_quarantine_integration_test.go is the only thing that proves the premise against a real database — status, the absence of an embed job, and the active-recall predicate all have to agree, and only Postgres can say whether they do. Type-checking that file would have been worth nothing.

Same migrated DATABASE_URL as the lanes above. Postgres-only: the consumer is driven synchronously with a stub extractor, a nil Redis client and a capturing embed enqueuer, so no bus or embedder service is needed.

Guard — #2499 tier + quarantine integration tests must RUN, not skip​

The anti-skip guard, in the established shape (see the #2325 and #2372 guards above). The suite SKIPs rather than fails when DATABASE_URL is unset (testsupport.RequireScratchDB), so without this a lane that lost its Postgres — or a package-filter, build-tag or -run regex drift — would go green with the at-rest premise never checked. That is worse than no lane: a green check is read as evidence.

TIER enumerates only the #2499 pins, and both MUST-PASS entries below are named explicitly rather than left to the floor, because a floor can be met while precisely these are deleted: TestLowTierHit_QuarantinesUnmutatedAndUnreachable — the founder-premise guard. If this is not executing, nothing in CI proves an un-redacted quarantined row is unreachable, which is the entire condition the approval of #2155 §5 was granted on. TestHighTierHit_StillScrubbedAtRest — the half that was NOT relaxed. A regression here means a live credential persisted verbatim.

Run #2501/#2604 embedder-scoped recall integration tests​

Quoted: an unquoted # starts a YAML comment, which would silently truncate this step's name to a bare "Run" in the Actions UI. Three packages that had NO -tags integration lane in ANY workflow before this step: ./internal/context/assembly/, ./internal/context/memory/mcpsrv/ and ./internal/context/retrieval/. Same gap as #2372 and #2499, two directories across — 13 pre-existing DB-backed tests in these packages have only ever been TYPE-CHECKED by Go Vet (integration tag), and a build-tagged test that merely compiles is indistinguishable from one that passes (WF-28/#1906).

The lane is added by #2501/#2604 because those fixes are unobservable without it. The defect they close is SILENT BY CONSTRUCTION: an ANN that ranks across two embedders raises no error, returns normal row counts at normal latency, and produces similarity scores that sit in [0,1] and look entirely plausible. There is no metric that catches it and no log line that fires. The ONLY thing that can tell a correct recall from a mis-ranked one is a two-model fixture asserted against a real pgvector — so if these pins do not EXECUTE, the fixes have no evidence at all.

Postgres-only: every test drives the dev deterministic hash embedder (no network, no Vertex/OpenAI credentials) or a fixed-model fake, so the lane needs nothing beyond the migrated DATABASE_URL above. The retrieval tests additionally CREATE/DROP a NOBYPASSRLS role of their own and clean it up in t.Cleanup, so they leave no residue for Verify clean rollback.

Sequencing note for whoever edits this next — the same one the #2372 lane carries, and it bit this PR on its first CI run. This step MUST stay ABOVE Run migrate down, and the suites MUST leave no residue. Migration 169's DOWN refuses to roll back over a procedural agent_memory row by design (LLD #2069 §1 — it will not delete durable memory to satisfy a schema rollback), and mcpsrv's TestRecallMemoryTypeFilter seeds exactly one. Measured on the first run: ERROR: migration 169 down blocked: 1 procedural agent_memory row(s) exist migrate down -all aborted and the REQUIRED rollback gate failed for a reason unrelated to the change that tripped it. mcpsrv's seed helpers now drop their rows via dropSeededMemoryOnCleanup, and the Remember-driven tests sweep by org+agent via dropRememberedMemoryOnCleanup; verified locally end-to-end (migrate up → this lane → migrate down -all → 0 tables remaining besides schema_migrations).

-p 1: the two retrieval integration tests share one fixed role name (retrieval_rls_tester) which each drops and recreates, so they must not run concurrently with each other.

Guard — #2501/#2604 embedder-scoped recall tests must RUN, not skip​

Executable form of the WF-28/#1906 lesson for this fix. Both suites SKIP rather than fail when DATABASE_URL is unset (testsupport.RequireScratchDB, and the retrieval pool helpers), so a lane that lost its Postgres — or a package-filter, build-tag or -run regex drift — would leave this job green while the mixed-embedder mis-ranking walked straight back in, invisibly and with nothing red anywhere.

Guard — #3077 retrieval scoped-tx tests must RUN, not skip​

The retrieval lane above is UNFILTERED, so these execute — but nothing was watching that they do. A separate step rather than three more names in the roster above, because that step's two floors (6 and 13) are reasoned numbers and folding a third population into either would let a regression in one half be masked by the other.

GUCsDoNotSurviveTheTransaction — the ONLY oracle that can see a GUC escaping its transaction. Its sibling asserts current_setting INSIDE the tx, which cannot distinguish tx-local from session scope: with is_local flipped to false on app.org_id, every other test in the repo stays green while the next request on that pooled connection inherits the previous caller's org. One character, cross-tenant shape, and this is the only thing that reddens. BatchedGUCsSetEverySetting — proves the single-statement form sets all six under BOTH pgx exec modes. Production dials PgBouncer in simple protocol, where the twelve parameters are interpolated client-side rather than bound, so the extended-protocol result does not transfer.

ResolutionCostOnCacheHit is deliberately absent: it reports latency and asserts only that batching is not slower, so pinning it would make a busy runner fail the lane over a measurement that is advisory by design.

SQL mutation lane — every rostered SQL guard must DISCRIMINATE (#3039)​

DEVOPS EYES — this is the only .github/ change in #3039.

WHAT IT CLOSES. Every anti-skip guard above proves a named test EXECUTED and PASSED. That is presence, and presence is not detection: a test can run, be green, and be unable to see the defect it was written for. For SQL that is not a hypothetical. SUM(cost_usd) and SUM(COALESCE(cost_usd,0)) return the SAME NUMBER on every mixed corpus — zero is the additive identity — so a fixture with one priced call cannot tell the honest statement from the fabricating one. #3038's review recorded the consequence in terms: all four of that change's SQL mutants, including the cost one, were "proven once, by the author, locally, and never re-run".

WHY IT IS HERE AND NOT IN Go Unit Tests. The unit lane has no DATABASE_URL, so every rostered witness would t.Skip() — and a skip is scored as a violation by the harness. The mutants can only be evaluated where a real PostgreSQL at the head of the migration chain exists, which is this job. --roster sql REFUSES (exit 2) when DATABASE_URL is unset rather than skipping, because a lane that skips silently recreates the exact defect #3039 exists to close.

NO NEW MECHANISM. This is scripts/check-guard-mutants.py, already run by Go Unit Tests for the unit roster, invoked with a different roster. A second harness would be a second place for the oracle to be weakened. It applies each mutant through go test -overlay, so the WORKING TREE IS NEVER MODIFIED and a cancelled run cannot strand a mutant.

COST, measured on the devbox against pgvector/pgvector:pg16 at the head of the chain: one baseline run plus four mutant runs, ~35s total with a warm build cache, inside a job that has already compiled the package. Each go test is bounded at 900s so a wedged statement reports as this step failing rather than as the job timing out unattributably.

It runs AFTER the integration suites so a mutant run cannot be mistaken for the lane's own result, and BEFORE migrate-down so the schema it needs is still applied.

Stop throwaway PgBouncer​

Runs BEFORE migrate-down so no pooled server connection is still holding a session open against tables the rollback is about to drop. Harmless on a hosted runner (the VM is discarded) but load-bearing anywhere the runner is reused.

Run migrate down​

Only attempt rollback when migrate-up actually ran. if: always() in the path-filtered case would try to roll back a never-upped DB.