32 checks share one running app. So the number that go red tells you where it broke.
Every result marked "Ran it" comes from real runs on this repo on 2 Nov 2026, against local Postgres. Failures were forced with temporary settings and a temporary controller, which are not in the code.
Shared setup breaks: many go red.They all repeat one message. Read any one of them.
One endpoint breaks: one check goes red.Only the check that owns that problem reports it.
Nothing stops at the first problem.Each check lists everything it found, in one message.
Any red stops the deploy.The site on 8099 keeps its old version. The test database is still dropped.
Pick a failure and see how far it spreads
The number on each button is how many of the 32 checks failed.
One broken endpoint gets reported once
A temporary controller with eight faults was added and the checks were run. These four are GET endpoints. They all go through one shared run of every business GET, and each check reads what it cares about.
Temporary endpoint
Smoke (no server errors)
Budget (max 5 DB calls)
Loop (same SQL max 3x)
Leak (no tenant B data)
throws throws an exception
✕ 500
left out
left out
left out
hangs sleeps 20 s
✕ timed out
left out
left out
left out
chatty runs a query in a loop
✓
✕ 8 calls
✕ 8x
✓
leak uses IgnoreQueryFilters
✓
✓
✓
✕ id=1000000000
Why "left out". The budget checks only count calls that finished with a status under 500. The leak checks only read 2xx responses. So a crashing endpoint gives you one finding, not four.
The other four faults were wiring problems, and each one tripped its own check: an open endpoint (AnonymousEndpoints_MatchTheReviewedList), a made-up policy (EveryPolicyNameInUse_Resolves), two actions on one route (NoTwoEndpoints_ShareAMethodAndRoute), and a controller asking for an unregistered service (EveryController_CanBeCreated).
What the Stop hook does with a failure
After a Claude turn that changed code, scripts/infra-gate.ps1 walks these steps in order and stops at the first one that applies.
INFRA_GATE=off in the shell that started Claude. For the user only.nothing runs
No change in src, Database, Migrations, Middleware, Tests, seed-data, Program.cs, *.csproj or appsettings*.json.nothing runs
These exact changes already passed. It compares a hash kept in .git/infra-gate/.nothing runs
These exact changes were already blocked once. This is the loop guard, so a session can't get stuck.tells the user
The build fails. Claude gets the errors. A locked output file adds a hint to use kill-build-lock.blocks Claude
Model checks and infra checks run together, and all pass. The hash is saved.passes
The output contains "could not be reached. Start the postgresql service". Claude must say the checks did not run.blocks Claude
Anything else failed. Claude gets each failed test and its message, with no stack traces, up to 80 lines.blocks Claude
First stop, 85 s. Ran it, trimmed.
{ "decision": "block", "reason":
Infra gate: checks failed for the current changes.
Failed ...RoundTripBudgetTests.EveryBusinessGet_Stays... [2 ms]
1 GET endpoints make more than 5 database calls.
Combine the queries (Include, Contains, one projection)
instead of raising the budget:
8 calls GET /api/v1/business/zz-failure-demo/chatty -> 200
Fix the code. Do not edit the check, add to a reviewed
list, or use noinfra. See CLAUDE.md, Infrastructure Rules. }
Second stop, same changes, 1 s. Ran it.
{ "systemMessage":
Infra checks still fail for the current changes. See the
earlier block, or run: RUN_INFRA_TESTS=1 dotnet test
Tests/Tests.csproj --filter "Category=Infra" }
Where a failure reaches you
You run
Infra checks?
What a failure does
build.bat
No
Compile only. No tests run.
build.bat local or run
Yes, after unit tests
Prints INFRA CHECK FAILED - not deploying and exits 1. This happens before app_offline, so the deployed site is untouched.
build.bat local noinfra
Skipped
Unit tests and model checks still run. Only for a machine where Postgres isn't running.
A Claude turn that changed code
Yes, by the Stop hook
Claude is sent back to fix it, once per set of changes. Nothing is deployed either way.
dotnet test Tests/Tests.csproj
Shows as skipped
Without RUN_INFRA_TESTS=1 they skip, and no database or app is started. That is expected.
Azure pipelines
No
They are not part of the pipelines. A failure here only shows on a developer's machine.
Model checks are different.ModelMatchesMigrationsTests and the two filter coverage checks need no database and run with the unit tests. In build.bat a failure there stops the build before the infra step starts.
Run the checks yourself. This doesn't redeploy 8099.
RUN_INFRA_TESTS=1 dotnet test Tests/Tests.csproj --filter "Category=Infra"
Three traps
These are the cases where the failure tells you something misleading.
Ran itRead from code
"Still fail" can be out of date
What you see
"Infra checks still fail for the current changes", after 1 s.
Why
The loop guard only compares the hash of your changes. It does not run anything.
What it means
If the cause was outside the code, such as Postgres being off, the message stays until the code changes.
The fix
Trust the command above, not this message. It isn't dangerous, because it doesn't block anyone.
Read from code
Postgres being down hides model check failures
What you see
Only "the local postgresql service is not reachable".
Why
The hook runs model checks and infra checks in one command. It looks for the Postgres message first and never builds the failure list.
What it means
A missing migration can stay hidden until Postgres is back. Claude is told not to call the task verified, so the risk is small.
The fix
Start Postgres and run the checks again before calling it done.
Ran it
The 15 s limit reports a slow call but doesn't cut it off
What you see
hangs -> timed out after 20s, from an endpoint that slept 20 s. The test time went from 19 s to 57 s.
Why
The call was marked as timed out, but it only returned when the endpoint finished. Each GET is called twice, so one slow endpoint cost about 40 s.
What it means
You still get the right finding. An endpoint that never returns might hold the whole run, though that was not tested. The Stop hook gives up after 600 s.
The fix
None needed until it happens. If a run seems stuck, suspect a hanging endpoint.
The database always goes
Normal end: dropped by DisposeAsync.
App failed to start: dropped straight away, then the error is rethrown. xUnit may not clean up by itself here.
Run killed with Ctrl+C: left behind, then dropped by the first run that starts over an hour later.
Another run still going: its database is left alone. Only test databases over an hour old are cleared.
Only localhost, 127.0.0.1 and ::1 are allowed. Only names matching ^wmcrm_infratest_[a-z0-9_]+$ are ever created or dropped. The database in your config is never opened.
What a green run doesn't prove
POST, PUT and DELETE work. The signed-in checks only call GETs.
Production-only code works. The checks run as Development.
Seeders are safe to run twice. Each runs once, on an empty database.
Platform and SuperAdmin routes are fine. They aren't called signed in.
Tenant B can't read tenant A. Only A reading B is checked.
Full list: Documents-Technical/Testing/infra-boot-checks.md