Repository navigation
Read UK staging contract v3: a real blocked run status, block details and failure classes - #212
Conversation
…classes Microcosm's UK staging documents move to schema_version 3 (PolicyEngine/microcosm#1147): a real `blocked` run status with a `block` (gate phase, blocking failure count, blocking gate ids), and `failure_class` as a fifth failure key. Version 2 keeps reading exactly as before. - staging-contract: accept v3 exactly (status and event enums, `block`, the five-key failure, blocked/failed/other rules); versions 2 and 3 are the structured contract everywhere a check was pinned to 2; a run cannot mix versions. - staging-artifact, build-runs: v3 manifests list as structured runs, their diagnostics keep the declared path and digest check, and `blocked` is final. - build-monitor: `blocked` maps straight to the blocked state with a failure line built from the block (falling back to the terminal event, the collector's copy); the gate-count inference stays for version 2 only; a v3 failure's class and code come from the run's failure; recorded refusals count their class in the stop statistics. - views: labels for the new failure classes, a warning tone and pill for blocked runs on the staging page. - Fixtures: microcosm's v3 staging fixtures copied byte for byte from PolicyEngine/microcosm#1147 head 0e80b0361, SHA256SUMS digest pinned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A `run` / `blocked` event (or a `blocked` stage event) ends the run as `blocked` with `ended_at` and keeps the block details (phase, blocking failure count, gate ids) in the materialized documents; failed events keep `error_code` in `failure`. No migration: status is Text, and the block is rebuilt from the events on every read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Automated review pass (Claude Code, high effort) — round 1 at
|
…cer responses - Collector: a `blocked` event must carry a valid block (safe-identifier phase, blocking_failure_count of at least 1, blocking_gate_ids, possibly empty), or ingestion answers 422; a block of nulls is never stored. gate_statuses stays optional. - README: which responses a producer treats as final (403, 404, 409, 413, 422) and which it retries, including why an events 404 means the run disappeared after it registered. - Name the producer of the dry_run_refusal class (the US fiscal-refresh release builder). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They declare schema_version 2 for the monitor's lifecycle reader but can carry version 3's blocked status, block and failure classes; the staging contract validates only staged run documents. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks. Addressed in 1. Collector documents say version 2. We took the documentation route. 2. Block of nulls. 3. 404 and permanent 4xx. The collector README has a new section, "Responses a producer acts on". It lists what #1147's client treats as final (403, 404, 409, 413, 422) and what it retries (401 re-exchanges the token; 408, 429, 5xx and the maintenance 503 are retried). On the 404: the delivery service posts events only after its registration has returned 201, and registration commits before it answers. So an events 404 can't come from a race. It means the run disappeared after it registered, for example a database reset while a build was running. 4. Stale fixture copy. The PR body now has a "Before merging" check: the digest of #1147's 5. Frontend 581 pass and |
Summary
Implements #206, the dashboard and collector half of PolicyEngine/microcosm#1147. UK staging documents move to
schema_version3: a run whose gates refuse its candidate closes asblocked, with ablock(gate phase, blocking failure count, blocking gate ids), and every failure carries afailure_class. Version 1 and 2 runs read exactly as before.Contract (
staging-contract.ts)running | completed | blocked | failed, event status addsblocked,blockrequired on run manifests and progress, five-keyfailurewithfailure_class(lowercase identifier or null).blockedrequiresblockandfailure: null;failedrequiresfailureandblock: null; any other status has neither. A block's gate ids may be empty; its count is at least 1.schema_version === 2now treats versions 2 and 3 as the structured contract: event sequence, the mixed-version check and the run-consistency checks. A run cannot mix versions.Readers (
staging-artifact.ts,build-runs.ts)runs.jsonindex.blockedis a final status, so blocked runs get the long cache time and are not fetched again on every request.Monitor (
build-monitor.ts, views)blockedmaps straight to the blocked state. The failure line comes from the block, e.g. "The gates refused the candidate at preflight (2 blocking failures, no gate named)". The block is read from the run documents, with the terminalblockedevent's details as a fallback (the collector's copy).blocking_failure_countstays for version 2 runs only.progress.failure, falling back to the terminal event.refused,aborted,unrecorded_gate_block,build_failure,unexpected_process_exitanddry_run_refusal. Blocked runs get a warning tone on the staging page and ablockedpill in its event table. Lists of names, such as the blocking gate ids, show as detail chips there.Collector (
telemetry-service)TelemetryEvent.statusacceptsblocked.run/blockedevent sets statusblocked,current_stageblockedandended_at, and keeps the block in the materialized progress and manifest.error_codeinfailure.blockedevent without a valid block (a safe-identifierphase, ablocking_failure_countof at least 1, andblocking_gate_ids, which may be empty) gets a 422, so a block of nulls is never stored.gate_statusesstays optional.statusis Text, and the block is rebuilt from the events on every read.Fixtures
fixtures/staging-contract/v3/is copied byte for byte from Make UK build outcomes honest in staging, telemetry and the Logbook microcosm#1147 at head0e80b0361, withSHA256SUMSdigeste31a5e33…bf3def5pinned. The v2 digest0d54c630…455e5is unchanged. If #1147's fixtures change before it merges, this copy and the digest must be updated with them.Before merging
git show <#1147 head>:packages/microcosm-build/tests/fixtures/staging/v3/SHA256SUMS | shasum -a 256givese31a5e337840e24d7a1203b83eb1a5039eeb5f35777a895ab6ab28163bf3def5(last checked atb82df99ac). If it doesn't, copy the fixtures again and update the pinned digest.Order of operations
This must be deployed, and a
blockedevent posted to the qualification collector must return 2xx, before PolicyEngine/microcosm#1147 merges.Verification
cd frontend && bun test: 581 pass, 0 fail. New cases: v3 blocked atterminal(fixture) and atpreflight(no gate counts, no gate named); a v3 failed run's code and class in the stop statistics; a v3 completed run with gate counts stays passed; a collector run closed by a blocked event; v3 listing and the diagnostics digest check; rejection of a sixth failure key, a missingfailure_class, a block on a failed run, a blocked run without a block, a bad block, and v3 fields on v2 documents. A mutation check (versions pinned back to 2) turns three v3 tests red.bun run lint(tsc --noEmit) clean;bun run buildpasses.cd telemetry-service && uv run pytest -q: 80 passed, 8 skipped (the PostgreSQL integration tests needTEST_DATABASE_URL; CI runs them). New cases include a 422 for eight malformed blocked events and a 202 for one naming no gate.ruff checkandruff format --checkclean.MICROCOSM_LOCAL_RUNS_DIRpointing at the v3 fixtures plus a preflight-blocked run. The Build progress tab shows "Blocked by gates · at Preflight gates" with "2 blocking failures, no gate named", the terminal block withuk_target_fit, and the failed run with class Error andBUILD_FAILED.🤖 Generated with Claude Code