Repository navigation
Add the shared gate-battery pieces for US adoption (#1585 item 11, PR 1 of 4) - #1609
Conversation
|
Review of 7aea573. I checked the moved blocking rule and binding against Should
Nit
Checked and fine
CI at head: all 12 checks pass (lint, wheels, installed-emitter, select-countries, integration-uk, engine-free, engine-uk and engine-us on 3.13 and 3.14, and ci). Verdict: the moves are exact, no pin moves, and the checker fix is pinned by tests that fail on 🤖 Generated with Claude Code |
`evaluate_entries` resolves named entries where their gates run, with the same binding lookup, parameter validation and fail-closed evaluation as a batched phase. `blocking_outcomes` applies the phase-boundary blocking rule to those outcomes, and `GatePhaseReport.blocking_outcomes` now calls it. `assemble_phase_report` gathers the outcomes into the phase's report in manifest order. It refuses a missing or duplicate entry, and after an early block (`blocked_by`) it records the phase's remaining entries as `unreached` with a reason naming the entry that blocked. `record_phase` takes a phase that stopped part way, with some entries reached and the rest unreached, only if it blocks under the run's posture, and then records `blocked_at_phase` in the same write. No producer on main writes that shape. Phases evaluated as today hold no unreached entry, and a phase whose entries are all unreached (the UK spine graph's record of a phase an earlier one blocked) records as before, so existing reports are unchanged. `unreached` now also means that an earlier stage of the same phase blocked first. Part of #1585 (item 11, PR 1) and #611. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The review of #1585 item 11 expected that a build which runs every phase and never calls `enforce` already records each phase and leaves its report unshippable. The test proves it for a release candidate and a dev build. A failed gate that `enforce` would have blocked on is recorded, every phase is evaluated, nothing is marked blocked, and the signed report is not shippable. No executor code was missing, so this commit adds only the test and a paragraph in `GateBatteryRun`'s docstring describing the posture, which the evidence tier and the dry run will use. Part of #1585 (item 11, PR 1) and #611. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One battery run takes one manifest and runs each phase once, so each build tool needs its own scope, as the UK has. `scoped_gate_manifest` is the UK's `uk_scoped_gate_manifest` moved into `gate_battery.py`: it keeps the declared entry order, suffixes the policy, and raises the same error for an undeclared id. `uk_scoped_gate_manifest` keeps its signature and default source and now calls it. `EvaluatorBinding` is the UK's `UKGateBinding` moved unchanged: the evaluator over `(context, parameters)`, the parameter-dependent artifact selector and frame predicate, and `legacy_name` re-minting. `UKGateBinding` is now an alias of it, so every UK caller and test is unchanged. The executor already sits in the hash closure of every UK graph kernel that hashes `battery_bindings.py`. Part of #1585 (item 11, PR 1) and #611. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`load_gates_manifest(country)` reads `country_package.json` only to find
the declared `legacy_json` `gates.json` row, then parses that one file with
the validator `load_country_spec` uses. It runs no bundle load and no
file-closure check, so the US tools can read their gate policy without the
full `load_country_spec("us")`. A test holds it equal to
`load_country_spec(cc).gates` for uk, be, am and nz.
`country_resource(country, name)` returns
`files("microcosm.build.<country>").joinpath(name)`. The UK bindings use it
in place of the nine hard-coded `files("microcosm.build.uk")` reads, with
the same object read the same way. No vocabulary name and no phase is
added; those wait for Max's answer before PR 2.
Part of #1585 (item 11, PR 1) and #611.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`_check_uk_gate_battery_report` required exactly 15 report fields and an exact attestation field set. Neither included `synthetic_smoke`, which the executor writes into both on every report, so the checker refused every report the executor writes today. It runs only for UK exact-k release ids, so nothing failed on main. The checker now requires `synthetic_smoke` in both sets, requires it to be false (a smoke build ran on a fixture and is never a release), and holds the attestation's copy equal to the body's. The contract test's hand-built report gains the field. The pins test now also searches for the two "must contain exactly" messages, and a new round-trip test runs the real executor over the UK manifest with every entry green and requires the checker to return no failures. Against the unfixed checker, both of those tests fail on exactly those two messages. Part of #1585 (item 11, PR 1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`docs/gate-battery-contract.md` now covers: - the narrow `load_gates_manifest`; - `EvaluatorBinding` and `country_resource`; - `scoped_gate_manifest` and why each build tool needs its own scope; - stage-level evaluation and the wider meaning of `unreached`; - the posture that runs every phase without enforcing. It also fills omissions the review of #1585 item 11 listed: `record_phase` replay through the portable phase payload, the transport graph's `gates.battery@1` kernel, `population_fact_check`, `evidence_absent_blocks` and the `synthetic_smoke` posture. It states that `population_fact_check` is in neither digest. The UK row now reads 94 entries (85 national-line, 7 local-candidate and 2 local diagnostics; 92 release-blocking), not 73. Two stale test paths are corrected, and one line says US adoption is in progress. Part of #1585 (item 11, PR 1) and #611. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… fix Part of #1585 (item 11, PR 1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 of #1609, point 1. Whether an outcome blocks depends on the run's posture, but `assemble_phase_report` checked `blocked_by` only against the entry's criticality and status, and `record_phase` asked only whether some outcome in the phase blocks. So a dev run could record a phase whose unreached entries named an absent-evidence entry, while `enforce` then blocked on a different, failed one. `assemble_phase_report` now takes `release_candidate` and `synthetic_smoke` with `blocked_by`, and refuses a blocker that is not among `blocking_outcomes` under them. `record_phase` regenerates the unreached reason for each entry that blocks under the run's own posture, and refuses a phase whose unreached entries name any other, so a posture mismatch between the assembly and the run is refused too. The phase payload does not change. A new test covers the dev case, the mismatched posture and a failed `population_fact_check` blocker in a synthetic smoke build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 of #1609, point 2. The transport graph's `gates.battery@1` kernel evaluates each phase in one batch, and still reads `unreached` only as an earlier phase's block. `phase_outcome` ranks it above `evidence_absent`, and `decode_gate_report` refuses a phase that mixes reached and unreached rows. Nothing sends an assembled phase into the kernel, so the `phase_outcome` docstring and the contract doc now say that phases assembled stage by stage are for `GateBatteryRun` only for now. The kernel's code does not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 of #1609, point 3. No test held the attestation's `synthetic_smoke` equal to the body's: removing it from the checker's equality loop left every test passing, since the smoke-report test re-signs the attestation from the body. The new test sets only the attestation's copy to true, re-signs it honestly, and expects the equality failure and no signature failure. It fails with the field removed from the loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7aea573 to
f3ecc79
Compare
|
Thanks, Vahid. I rebased the branch onto main at 52aea14, which had no conflicts and leaves the seven commits' content unchanged, so 7aea573 is now ee31b0a. Then I addressed your three points in three commits on top.
The same 21 files pass locally, 1,259 tests in all, each file in its own process with the engines blocked. CI is running on the new head. |
|
…er ran Review round 2 of #1609 (Max), points 1 and 2. 1. The module-level `evaluate_entries` defaulted its registry to `DEFAULT_REGISTRY`, so a stage that left the argument out recorded a named gap for every gate only its country binds, and a dev build went on where `run_phase` blocks. `GateBatteryRun.evaluate_entries` now takes the stage call with the run's own registry. It refuses a call after a block and an entry of a phase already recorded. The module-level function keeps working but requires `registry`, with no default. 2. With `blocked_by` set, `assemble_phase_report` marked every entry without an outcome as never reached, including entries whose stage did run. The caller now names the entries that never ran in `unreached`. Any other missing entry is refused, as is an `unreached` entry that has an outcome, is declared `not_applicable`, is not in the phase, repeats, or comes without `blocked_by`. The contract doc and its onboarding checklist say both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 2 of #1609 (Max), point 4. No test failed when one of these refusals was removed: the phase-order check and the `validate_gate_parameters` call in `evaluate_entries`, and the folder-country match, the row kind, the outside-the-package check and the not-a-file check in `load_gates_manifest`. One new test in `TestStageLevelEvaluation` and one in `test_country_gates_manifest.py` hold them. With any one of the six removed, exactly one test fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, Max. Points 1, 2 and 4 are addressed in two commits on top of f3ecc79. Point 3 is a question for the PR 2 plan, and the proposal is below.
The 21 targeted files pass locally, 1,263 tests in all. |
|
Thanks, María. fd3ad06 and 5575ac8 close points 1, 2 and 4. Removing any one of the six refusals fails one test, and removing any refusal fd3ad06 adds fails at least one.
|
Review round 3 of #1609 (Max), point 1. The test asked for an entry of the blocked phase after the block, which the recorded-phase check also refuses, so with the block check removed it failed only on its message while the run evaluated a later phase's entry. It now blocks at preflight and asks for a terminal entry, which only the block refuses. With the block check removed, it fails because nothing is raised. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 3 of #1609 (Max), point 2. A caller that dropped a stage's outcome and filled `unreached` from the entries it lacked outcomes for still recorded that gate as never reached, though the run had evaluated it. `GateBatteryRun.evaluate_entries` now keeps the ids it evaluates, and `record_phase` refuses a phase that marks one of them `unreached`, whether the phase stopped part way or has every entry unreached. The ids stay in the run, so the report gains no field. The check sees only the run's own stages, since a phase carried in from another process holds outcomes, not those ids. `test_the_run_refuses_an_unreached_entry_it_evaluated` fails with the check removed. The docstrings, the contract doc and its onboarding checklist say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vahid-ahmadi
left a comment
There was a problem hiding this comment.
Thanks for da67e41, which closes the evaluated-but-unreached case. One gap of the same kind remains.
A stage can re-evaluate an entry and record the outcome it prefers (packages/microcosm-build/src/microcosm/build/gate_battery.py:1451-1494, :1533-1544). GateBatteryRun.evaluate_entries refuses a call after a block, and an entry of a phase already recorded. It does not refuse a second call for an entry whose phase is still open. The run keeps only the ids it evaluated (self._stage_evaluated.update(outcome.entry.id ...)), and record_phase checks only that none of them is marked unreached. So a stage can evaluate g, get failed, evaluate it again with another context, get passed, and record the second outcome. It could also record an outcome from the module-level evaluate_entries under another registry. run_phase evaluates once and records at once, so the stage path can produce a signed pass the batch path cannot, contrary to "stops exactly where the batch would have blocked".
Could the run keep entry_id -> outcome (or its evidence digest) for the entries it evaluates? It could then refuse a second evaluate_entries for one of them, and have record_phase require the recorded outcome to equal the stored one. Phases carried in from another process would be unaffected. If retries are meant to be allowed, they probably belong with the PR 2 waiver and crash design, recorded on the report.
Review drafted with AI assistance and checked against the code at da67e41.
Review of #1609 (Vahid). The run kept only the ids its stages evaluated, so a stage could evaluate an entry again, with other evidence, and record the outcome it preferred, or record one evaluated outside the run under another registry. The run now keeps the outcome of each entry it evaluates at a stage. evaluate_entries refuses an entry the run has already evaluated, before it evaluates anything, and run_phase refuses a phase whose entries the run evaluated at their stages, since the batch would evaluate them again. record_phase refuses a phase that carries another outcome for one of those entries, beside the existing refusal of one marked unreached, whose message is unchanged. Outcomes are compared by content, over every field a phase payload carries: gate_phase_report_payload now builds its rows with the same helper, and writes the same payload. So the same outcomes carried through a payload and back still record. The check covers only the entries this run evaluated, as before. The report shape and the pins do not change. The block-check test now asks for a terminal entry the run has not evaluated, so the new refusal cannot stand in for the block check. Each new test fails with its check removed, because nothing is raised. The docstrings and the contract doc say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, Max. Both points are fixed in two commits on top of 5575ac8.
At da67e41, the 21 targeted files pass locally, 1,264 tests in all. |
|
Thanks, Vahid. Fixed in 3870461, on top of da67e41. The run now keeps the outcome of each entry it evaluates at a stage, not only its id, and evaluates each entry once:
Each new test fails with its check removed, because nothing is raised. Phases carried in from another process are unaffected: for an entry the run did not evaluate, it has no outcome of its own to compare. This PR allows no retry. If PR 2 needs one, it belongs with the waiver and crash design, recorded on the report, as you suggest. The block-check test from Max's round 3 now asks for a terminal entry the run has not evaluated, so the new refusal cannot stand in for the block check. The 21 targeted files pass locally, 1,266 tests in all. |
|
Thanks, María. a860d3d, da67e41 and 3870461 close both points. With the block check ( The run can still sign a gate it evaluated as |
Review of #1609 (Max, round 4): a run that evaluated a terminal entry at its stage and then blocked at preflight signed that entry as unreached, with no failures. The blocked run never records the terminal phase, and the report took outcomes only from recorded phases. For an entry that no recorded phase holds, the report now carries the outcome this run's stage produced, so an entry is unreached only if the run never evaluated it. Such an outcome counts toward shippable only once its phase is recorded. An entry counts through a recorded phase or its declared excuse, so shippable comes out as it did before in every case. Stages may still run in any phase order. Refusing an entry whose phase comes after the next one to record would also refuse a run assembled at the end, which the contract allows. The US shadow stacked on this PR relies on that: it evaluates each gate when the tool reaches it and records the phases in order when the tool finishes. No UK flow evaluates through the run's evaluate_entries, so no UK report or pin changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, Max. Fixed in 7fb0bab, on top of 3870461. I took your first option: the run now carries the stage's outcome into the report. For an entry that no recorded phase holds, Such an outcome counts toward I didn't take the second option, for two reasons. First, the contract lets a run be assembled at the end, and PR 2's shadow (#1635) relies on it: it evaluates each gate when the tool reaches it and records the phases in order when the tool finishes. Refusing an entry whose phase comes after the next one to record would turn every check outside the first phase into a shadow error. Second, it would leave a gap. An entry of the next phase, evaluated after the phase before it was recorded but before No UK flow evaluates through |
#1609 has merged, so this branch now targets main. Against main, the merge conflicts only in the six F0 pin files. They were resolved to main's side and regenerated on the merged tree: first `tools/repin_us_spec_engine_contracts.py --legacy-only` (no change), then the same tool without the flag, then `tools/spec_engine_coverage.py`, all with the country engines blocked. As in 335a144, the generator step was skipped because it needs the US engine. Main changed no US `country_package.json`, so the row this branch commits stands. The pins now count both sides: main's resolved binding field (9786) and this branch's three `us/gates.json` fields (32612 authored, and 107 `country_manifest` pointers). Coverage reads 42398/42398 configuration fields and 41/41 inventory checks. The US bundle's `spec_sha256` moves to 4a7df12e, and the pool tool test's list of what moves it gains this branch's row. Both tools' `--check` modes pass. The engine-contract and engine-workflow pins were not run here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main gained #1619, #1621, #1609, #1540, #1629 and #1594 since 429d7a0. Two files conflicted. docs/evidence/spec-engine/us-f0-coverage.json and test_us_multispine_pool_tool.py took main's side, and the five-step US spec-engine repin then regenerated them: spec_sha256 3fd1a384..., with the field counts and pointer digests from tools/spec_engine_coverage.py. The spec_sha256 comment keeps main's #1387 line and this PR's #922 line. Checks: the three --check modes, ci_test_plan verify, ruff check and git diff --check pass. Tests: county focused 751 (1 skip), pins 116 and national 481, all passing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main brought nine first-parent merges since c4ad232: #1626 (Belgium gate rows), #1628 (NZ B8 reference teen heads), #1621 (County Files household measures sidecar and schema manifest tools), #1540 (L0 release practice docs), #1609 (gate battery shared scopes), #1619 (ACS partnership_income kept at zero where SEMP holds it, #1387), #1629 (untimed composed stage-scan test), #1594 (withdraw a release build) and #1541 (Microcosm name sweep). Main changed nothing under packages/microcosm-fit or packages/microcosm-graph. Four pin files conflicted; each block took main's text plus this branch's own comment lines, placed after main's #1387 sentence: - docs/evidence/spec-engine/us-f0-coverage.json: five digest blocks, main's side (the branch has no comment there). - packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py: main's #1387 comment, then the branch's #1543 sentence, then the digests. - packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py: main's #1387 comment, then the branch's fit-input-checks sentence, then the golden. - packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py: main's #1387 comment, then the branch's #1543 line, then spec_sha256. No code or test file conflicted, and no other file was changed by both sides. The tools then wrote every value on the merged tree: - tools/repin_us_spec_engine_contracts.py: EXPECTED_HASHES seed_map d5898b93 and seed_protocol 206be396, the loader golden b7c843a1 and the multispine pool spec_sha256 4062e22e (its first pass moved the coverage tool test's covered_item_count to 40; its second pass restored 41, so that file equals main's). - tools/spec_engine_coverage.py: us-f0-coverage.json's eight digest lines (42395/42395 configuration fields; 41/41 inventory checks). - fit.qrf/pins.json keeps the branch's values: the merged fit sources equal the branch's and the kernel's implementation hash reproduces, so tools/graph_parity_repin.py was not run. The repinner's quote style was then reformatted with ruff format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part of #1585 (item 11, PR 1 of 4) and #611.
This PR adds the shared pieces the US needs before its release gates can move onto the country-agnostic gate battery, and fixes a stale UK checker found along the way. It runs no build and adds no US gate. UK gate verdicts, report shapes and pinned digests do not move, and no committed pin was re-pinned; the evidence is under "What does not move".
What it adds
Stage-level evaluation (
gate_battery.py)GateBatteryRun.evaluate_entries(entry_ids, context)evaluates named entries at the site where their gates run today, with the run's own registry. Each entry resolves exactly as it would in a batched phase: its binding, its named evidence gaps, fail-closed evaluation and its evidence digest. The whole manifest's parameters are validated first. The run refuses a call after a block, an entry of a phase it has already recorded, and an entry it has already evaluated: it keeps each outcome and evaluates each entry once, andrun_phaserefuses a phase whose entries it evaluated at their stages. The module-levelevaluate_entries(gates, entry_ids, context, registry=...)does the same for a caller without a run, and requiresregistry, with no default.blocking_outcomes(outcomes, release_candidate=..., synthetic_smoke=...)is the phase-boundary blocking rule as a function, so a build that gates stage by stage stops exactly where the batch would have blocked.GatePhaseReport.blocking_outcomesnow calls it; the rule's code moved unchanged.assemble_phase_report(gates, phase, outcomes, blocked_by=None, unreached=(), release_candidate=None, synthetic_smoke=False)gathers those outcomes into the phase'sGatePhaseReport, in manifest order. It refuses a missing or duplicate entry and an outcome evaluated against a different declaration. After an early block, the caller names the entries whose stages never ran inunreached. Those becomeunreached, with a reason naming the entry that blocked, and any other entry without an outcome is still refused. Since the run's posture decides which outcomes block,blocked_bycomes with that posture, and the assembly refuses a blocker that is not amongblocking_outcomesunder it.record_phasetakes a phase that stopped part way (some entries reached, the rest unreached) only if the entry its unreached entries name blocks under the run's own posture, and recordsblocked_at_phasein the same write. So a phase assembled under another posture is refused too. No producer on main writes that shape. A phase whose entries are all unreached, which the UK spine graph stores when an earlier phase blocked it (uk_runtime/graph_evidence.py), records as before. Either way,record_phaserefuses a phase that marksunreachedan entry the run itself evaluated, or that carries an outcome for it other than the one its stage produced. Outcomes are compared by content, over every field a phase payload carries, so the same outcomes carried through a payload and back still record. These checks see only the run's own stages: for an entry the run did not evaluate, such as one in a phase carried in from another process, it has no outcome of its own to compare.unreached. So an entry isunreachedonly if the run never evaluated it, and a block in an earlier phase cannot sign a gate a stage already evaluated as never reached. Such an outcome counts towardshippableonly once its phase is recorded, soshippablecomes out as before in every case. Stages may run in any phase order, so a tool can still evaluate each gate when it reaches it and record the phases when it finishes.gate_phase_report_payloadandgate_phase_report_from_payload, so a tool can evaluate gates at their stages, carry the phases between processes, and assemble the signed run at the end.unreachedhas meant "an earlier phase blocked". It now also means "an earlier stage of the same phase blocked", and it never marks an entry the run evaluated at its stage; the docstrings anddocs/gate-battery-contract.mdsay so. Phases assembled stage by stage are forGateBatteryRunonly for now. The transport graph'sgates.battery@1kernel evaluates each phase in one batch and still readsunreachedonly as an earlier phase's block, and its report check refuses a phase that stopped part way; itsphase_outcomedocstring says so.The record-without-enforce posture
The plan's review expected that a build which runs every phase and never calls
enforcealready records each phase and leaves its report unshippable. A test now proves it for a release candidate and for a dev build: every phase is recorded, nothing is marked blocked, and the signed report is not shippable. No executor code was missing, so this adds only the test and a docstring paragraph. The US evidence tier and the dry run will use this posture.Shared scoping and the re-minting binding
scoped_gate_manifest(gates, scope, phases=..., policy_suffix=...)is the UK'suk_scoped_gate_manifest, moved intogate_battery.py. OneGateBatteryRunruns one manifest, each phase once and in order, so each US build tool needs a scope of its own, as each UK producer has.EvaluatorBindingis the UK'sUKGateBinding, moved unchanged: the evaluator over(context, parameters), the parameter-dependent artifact selector and frame predicate, andlegacy_namere-minting. US gates mint their own result names, which a plainFunctionBindingfails closed.uk_scoped_gate_manifestkeeps its signature and default source and now calls the shared function.UKGateBindingis now an alias. No UK caller or test changes.Two narrow helpers in
country_spec.pyload_gates_manifest(country)readscountry_package.jsononly to find the declaredgates.jsonrow, then parses that one file with the validatorload_country_specuses. It runs no bundle load and no file-closure check, so the US tools can read their gate policy without the fullload_country_spec("us"). A test holds it equal toload_country_spec(cc).gatesfor uk, be, am and nz.country_resource(country, name)returnsfiles("microcosm.build.<country>").joinpath(name). The UK bindings use it at the nine sites that hard-codedfiles("microcosm.build.uk"): the same object, read the same way.ALLOWED_GATE_FUNCTIONSand no phase is added. Both wait for the answers the plan asks Max for before PR 2.What it fixes
_check_uk_gate_battery_reportrequired exactly 15 report fields and an exact set of attestation fields. Neither set heldsynthetic_smoke, which the executor writes into both on every report, so the checker refused every report the executor writes today. It runs only for UK exact-k release ids, which have no publication path since the UK repository moved toreleases.json, so nothing failed on main. The checker now requiressynthetic_smokein both sets, requires it to be false (a smoke build ran on a fixture and is never a release), and holds the attestation's copy equal to the body's.The pins test (
test_gate_battery_contract_pins.py) now also searches for the two "must contain exactly" messages. A new round-trip test runs the real executor over the 94-entry UK manifest, with stub bindings that pass every entry with synthetic details shaped as the checker reads them, and requires the checker to return no failures at all. Against the unfixed checker, both tests fail on exactly those two messages.What does not move
policy_sha256,gates_manifest_sha256andspec_fingerprintof the full UK manifest, and the scoped digests of each certification part and of the local battery, still equal the contract's pinned mirrors.TestMirrorConstants,TestCertificationMirrorsandTestDenseLineMirrorsintest_gate_battery_contract_pins.pyhold them.record_phase.gate_phase_report_payloadwrites gain and lose no field. A UK report is unchanged: no UK flow evaluates throughGateBatteryRun.evaluate_entries, so none carries a stage's outcome.uk/orus/changed, the seed protocol attests none of the edited modules, and the H1 parity kernels (simulate,calibrate,fit.qrf) import nothing frommicrocosm.build.gate_battery.pyandbattery_bindings.pyare hashed by the UK spine gates (UKSpineGateKernel) and both terminal gate kernels (UKNationalGateKernel,UKFullGateKernel), so an in-graph UK build re-runs from its first spine gate on.calibration_run.pyis hashed by the bound-spine checkpoint (UKBoundSpineKernel), so a build on a bound spine re-runs its preflight and solve.gates.battery@1and the kernels that hash the target-compile modules, which includecountry_spec.py, re-key.UKBoundSpineKernelhashescalibration_run.pybut notgate_battery.py, so the scoping body it calls now sits outside its code hash. Its node parameterspine_gate_digestscomes from that function, so a change to the scoping still re-keys the node.Tests
Each file ran in its own process, never with
-n. A plugin setpolicyengine_uk,policyengine_usandpolicyengine_coretoNoneinsys.modules, since CI's engine-free job has no engines. Counts are from JUnit: 1,268 tests in 21 files, all passing, none skipped. 29 of them are new.engine_free/shared/in microcosm-build:test_gate_battery.py: 48, 18 of them new (the stage-level API, the run's stage call, the named blocker's posture check and the entries that never ran, the run's refusal to sign an entry it evaluated as unreached or with another outcome, its rule that each entry is evaluated once, the stage outcomes its report carries before their phase is recorded, the refusals before any gate runs, the record-without-enforce posture, and the shared scope and binding);test_gate_battery_contract_pins.py: 22, 1 new (the green round-trip);test_country_gates_manifest.py: 8, all new, with one case for each resource check the narrow loader keeps;test_gate_battery_contract_example.py1,test_gate_battery_replay.py2,test_country_spec.py144,test_transport_gate_bindings.py131,test_transport_gate_kernels.py31, andtest_transport_compile_modules.py11, which listscountry_spec.engine_free/uk/in microcosm-build:test_uk_battery_bindings.py95,test_uk_terminal_gates.py77,test_uk_local_gate_battery.py4,test_uk_gate_signing_key_registry.py18;calibration_run.py's scoping:test_uk_calibration_run.py19,test_uk_release_certification.py35,test_uk_rowwise_posture.py17;record_phasereplay:test_uk_national_graph.py13,test_uk_graph_evidence.py8;test_uk_target_compile_modules.py52, whose exclusions namecountry_spec.engine_free/shared/test_contract.py345, 2 new (a smoke report is refused, and so is an attestation whosesynthetic_smokediffers from the body's), andengine_free/uk/test_uk_dense_release_contract.py187.tools/ci_test_plan.py verifypasses, andruff checkandruff format --checkare clean on every edited file.Overlap with open pull requests
contract.pyandtest_contract.pyfar from these lines and merges cleanly with this branch.git merge-treeagainst Move the UK spine to geography first (#931) #1538's head 9b60cda); both also edittransport/gate_kernels.py, which merges cleanly:uk_runtime/calibration_run.py: Move the UK spine to geography first (#931) #1538 movesuk_scoped_gate_manifesttouk_runtime/gate_scopes.py, while this branch makes it a wrapper. Resolving means taking the move, giving the moved function this wrapper's body, and dropping thescoped_gate_manifestimport this branch adds tocalibration_run.py.uk_runtime/battery_bindings.py: this branch dropsfrom importlib.resources import files, next to Move the UK spine to geography first (#931) #1538'sfrom types import MappingProxyType, ModuleType. Keeping both changes resolves it. The rest of Move the UK spine to geography first (#931) #1538'sbattery_bindings.pychanges merge cleanly, and the merged file keeps no hard-codedfiles("microcosm.build.uk").test_country_gates_manifest.py, sotest_country_spec.pyandtest_uk_battery_bindings.pyare untouched.For review
@MaxGhenis,
gate_battery.pyis your module, so two points need your call before PR 2 builds on them:unreached. Is it acceptable forunreachedto mean also "an earlier stage of the same phase blocked", with the reason naming the entry that blocked andblocked_at_phaseset? The alternative is a sixth status, which every verifier would have to learn.evaluate_entries,blocking_outcomes,assemble_phase_report) plus therecord_phaserule for a phase that stopped part way. Would you rather have oneGateBatteryRunmethod, or different names for these or forEvaluatorBinding,scoped_gate_manifestandcountry_resource?Found in passing and not changed here:
population_fact_checkrides neitherpolicy_sha256norgates_manifest_sha256. It changes only the synthetic smoke posture, which can never be a release candidate. Adding it would move every UK pin, since 26 UK entries carry it.🤖 Generated with Claude Code