Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ad8130e
Test the narrow gates loader's refusal on a package copy, not the US
juaristi22 Nov 15, 2026
b25f570
Add the shared US pieces for running the gate battery in shadow
juaristi22 Nov 15, 2026
00344eb
Declare Route A's base gates and run them in shadow (us_base)
juaristi22 Nov 15, 2026
51a30f9
Declare the stacked pool's gates and run them in shadow (us_pool)
juaristi22 Nov 15, 2026
d5f6ec5
Declare the national release's gates and run them in shadow (us_natio…
juaristi22 Nov 15, 2026
85c1289
Declare ACS local's gates and run them in shadow, stage by stage (us_…
juaristi22 Nov 15, 2026
660d46c
Document the US gate battery in shadow, and add its changelog fragment
juaristi22 Nov 15, 2026
a40807c
Let the wiring scan read ACS's own site helpers and function-local im…
juaristi22 Nov 15, 2026
d1dfdf8
Run the US tools' gate shadows in real builds only; the suite turns t…
juaristi22 Nov 15, 2026
155b969
Keep the release gates' call and the engine's lifetime as they are today
juaristi22 Nov 15, 2026
7ad4c5f
Hold the national shadow's files until the certified-dir refusal, per…
juaristi22 Nov 15, 2026
3dc1966
Pin the weights-audit sites to the shared binding's own gate
juaristi22 Nov 15, 2026
d466ad8
Check the base's shadow on real gates in the opt-in equivalence workflow
juaristi22 Nov 15, 2026
3294497
Say where the national shadow writes, and that the test suite turns i…
juaristi22 Nov 15, 2026
ac94c68
Never name unreached a gate today's code reached, here or in another …
juaristi22 Nov 15, 2026
5018faf
Note the base stages that ran and saved no shadow observations (us_base)
juaristi22 Nov 15, 2026
a0d25a6
Note the ACS stages that ran and saved no shadow observations (us_local)
juaristi22 Nov 15, 2026
40bbddc
Say when the US shadow records the phase a run stopped in
juaristi22 Nov 15, 2026
44050a6
Let ACS's staging-check test read a check inside its shadow site (us_…
juaristi22 Nov 15, 2026
5de94d6
Let the national source-shape tests read a call inside its shadow sit…
juaristi22 Nov 15, 2026
335a144
Re-pin the US F0 contracts for the us/gates.json row
juaristi22 Nov 15, 2026
660cb53
Classify the gate battery's US runtime modules for the spine-blindnes…
juaristi22 Nov 15, 2026
3d4f8a6
Pin the shadow against the run's evaluate-once refusals
juaristi22 Nov 16, 2026
1885fe3
Merge main 0402f5628 into us-gate-battery-shadow-1585 and re-pin
juaristi22 Nov 16, 2026
425acff
Finish the national shadow after the build's handler, so its staging …
juaristi22 Nov 16, 2026
7091218
Count us_runtime.gate_shadow among the modules the gate bindings reach
juaristi22 Nov 16, 2026
2829e4f
Let the stored-input wiring test read its checks inside their shadow …
juaristi22 Nov 16, 2026
2c34c57
Merge main 950427888 into us-gate-battery-shadow-1585 and re-pin
juaristi22 Nov 16, 2026
c599e2a
Merge main 3b75cf151 into us-gate-battery-shadow-1585 and re-pin
juaristi22 Nov 17, 2026
034dd87
Answer Max's round 1 on the US gate battery shadow (us_*)
juaristi22 Nov 17, 2026
013a34a
Retire the two opt-in base equivalence tests a real build covers (us_…
juaristi22 Nov 17, 2026
6996343
Record a shadow difference instead of failing the build (us_*)
juaristi22 Nov 17, 2026
e8a8d1f
Answer Max's round 2 on the US gate battery shadow (us_local, us_nati…
juaristi22 Nov 17, 2026
455d466
Print shadow differences when the comparison can't be written (us_*)
juaristi22 Nov 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1585-us-gate-battery-shadow.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The four US build tools (Route A's base, the multispine pool's stacked path, the national release and ACS local) declare their 143 gates in the new `us/gates.json`, one scope per tool, and run the shared gate battery in shadow beside today's gates: each gate's entry is evaluated on the same evidence, the verdicts are compared, and the scope's battery report and the comparison are written beside the tool's outputs. A verdict difference is flagged in the comparison and printed as a warning. It never fails the build, since today's gates decide until the battery becomes authoritative. Today's raises, exit codes, written files and manifest keys are unchanged (microcosm#1585 item 11).
20 changes: 10 additions & 10 deletions docs/evidence/spec-engine/us-f0-coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"country": "us",
"documentation_sha256": "fda6ec0dd925077f4d84d30a1c206dd81d82c5e16bd94506e81fe1b9f7e2f466",
"field_usage": {
"authored_normative_field_count": 32615,
"authored_normative_field_count": 32618,
"claim_count": 48,
"claims": [
{
Expand All @@ -16,8 +16,8 @@
"legacy_sinks": [],
"mode": "front_end_validation",
"pointer_class": "all",
"pointer_count": 110,
"pointer_sha256": "368fe74c5a1ac00cc51079ffc1e13add27471d6daeaf2bf362cb321be9535619",
"pointer_count": 113,
"pointer_sha256": "11b70807bf06832e71367643c7d0e09891c1d4923fe574b471d6632562129897",
"rationale": null,
"relative_sink_prefix": null,
"source_prefix": "/authored/country_package.json",
Expand Down Expand Up @@ -758,20 +758,20 @@
"verifier": "vintages"
}
],
"configuration_field_count": 42401,
"consumed_field_count": 42401,
"configuration_field_count": 42404,
"consumed_field_count": 42404,
"generation0_effect_counts": {
"legacy_behavior": 38780,
"no_generation0_effect": 3621
"no_generation0_effect": 3624
},
"mode_counts": {
"compiler_semantic": 27674,
"front_end_validation": 355,
"front_end_validation": 358,
"identity_only": 103,
"legacy_behavior": 14269
},
"multiple_primary_use_field_count": 0,
"pointer_inventory_sha256": "65c75e48867b39bc443891c2bada2fcc6eed80b2c1fa1bf5ced14ae862bad47f",
"pointer_inventory_sha256": "38fc67ba13d62a5c0eaff36abb8f04d4d2974e21baaed6d2966d76480e643608",
"resolved_binding_field_count": 9786,
"unused_field_count": 0
},
Expand Down Expand Up @@ -2585,7 +2585,7 @@
"country": "us",
"schema_id": "country_spec",
"schema_version": 1,
"spec_sha256": "372858d059a129d7b3bcbd7ac2dbdc314742345bd35aaff8d53943e737c98f84"
"spec_sha256": "0088d3f69666b09e28b94bbf8b1b2f07ebf0b8a32cec6d0a8358b568a7f35ac6"
}
},
"report_schema_version": 3,
Expand All @@ -2595,7 +2595,7 @@
"country": "us",
"schema_id": "country_spec",
"schema_version": 1,
"spec_sha256": "372858d059a129d7b3bcbd7ac2dbdc314742345bd35aaff8d53943e737c98f84"
"spec_sha256": "0088d3f69666b09e28b94bbf8b1b2f07ebf0b8a32cec6d0a8358b568a7f35ac6"
},
"status": "pass"
}
49 changes: 48 additions & 1 deletion docs/gate-battery-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,54 @@ local publication work in #146; they are evaluated in their own signed
`local_candidate` report rather than silently disappearing from union
accounting.

US adoption is in progress (microcosm#1585 item 11).
US adoption is in progress (microcosm#1585 item 11), in four steps, and
`us/gates.json` now declares 143 entries, each US build tool's share of
them a scope of its own (`us_runtime/gate_scopes.py`): `us_base` (Route
A's base, 37), `us_pool` (the multispine pool's stacked path, 6),
`us_national` (the national release, 76) and `us_local` (ACS local, 24). A
scope owns the entries whose id starts with its name, checked
closed-world. In this step the battery runs **in shadow**: each tool still
gates as it did, and beside each gate it evaluates the declared entry
through its scope's `GateBatteryRun` on the same evidence, with the
record-without-enforce posture, then compares the verdicts
(`us_runtime/gate_shadow.py`). Verdicts are compared, not enforcement: a
gate an `--allow-*` flag waives today matches if it fails in both, a crash
in today's code matches an `evaluation_error`, and a gate today's code did
not evaluate matches `evidence_absent`. The shadow writes its scope's
report and the comparison beside the tool's outputs (never inside a
release directory), and, once armed, never fails the build. A finished run flags a
verdict difference in the comparison (`verdict_difference`) and prints a
warning, because today's gates decide until the flip, and today's own
exception always propagates unchanged. If the comparison cannot be
written, the warning says so and still lists the differences. When today's code stops, the phase it stopped in is recorded
only if every entry there without an outcome is one today's code never
reached. The run refuses a phase that marks unreached an entry it
evaluated, but a scope rebuilt from stages run as separate processes
(Route A's checkpointed base, ACS local) holds only their outcomes, so each
stage's saved observations also name every entry it reached, and a stage
that ran and saved none leaves the stopped phase unrecorded. A finished run
names that stage where it would otherwise call an unobserved entry unwired,
and Route A's base locks the switch in its run config when it is off, so a
resume cannot mix stages run with and without the shadow. The national
release's shadow is armed before its preflight gates, which run ahead of
the refusal to reuse a certified release directory, so it holds its files
until that refusal has passed: a refused rerun leaves the certified
build's shadow files as they were, and each
release keeps its own, in `<out>/gate_battery_shadow/<release>`. Real
builds always arm the shadow. The test suite turns it off for every test
(`MICROCOSM_US_GATE_SHADOW=off`, in `packages/microcosm-build/tests/conftest.py`),
because its tests stand stubs in for whole stages, and the shadow's own
tests turn it back on.

Most US entries are `stage_health` entries whose `check` names the gate,
and `us_runtime/battery_bindings.py` binds each check to the gate function
its site calls, looked up in the tool's own globals or the runtime module
where the site runs, so a test that patches one reaches both verdicts. A
threshold the gate takes as a keyword is routed from the entry; one it
reads from a module constant is declared at today's value and pinned equal
to it until the flip, when the spec becomes the only source. The flip,
signing, the verifier and head-to-head certification are the next three
steps.

## The reference rule

Expand Down
8 changes: 5 additions & 3 deletions docs/release-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,10 @@ The 2026-10-09 report's plan brings the US to this shape by adapter at M2: the
fiscal-refresh tool declares its gates in `us/gates.json`, projects its own
verdicts through the gate battery under `BlockingMode.MARKS_ARTIFACT`, and
composes the certification from the projected reports. It projects; it does not
re-evaluate. On 2026-11-12 neither `us/gates.json` nor that adapter exists, and
no US build carries a certification. The US national golden,
re-evaluate. microcosm#1585 item 11 takes another route: `us/gates.json` exists,
and the four US build tools re-evaluate its entries in shadow beside their own
gates, comparing verdicts (see the gate-battery contract), before a later step
makes the battery authoritative. No US build carries a certification. The US national golden,
[`v1/c1/microcosm-us-2024-national/`](#golden-fixtures), therefore freezes
the two manifests the US fiscal-refresh tool writes today for a run that
passes `_build_manifests` only its required arguments and a staging block. A
Expand Down Expand Up @@ -1161,7 +1163,7 @@ version 1 takes that shape.
| --- | --- | --- | --- | --- |
| M0 | 2026-10-16 | This document and the golden fixtures; nothing refuses | Max's session | microcosm#1285, which adds this document |
| M1 | 2026-10-23 | A UK national cut on policyengine-uk ≥ 2.122.2 with staging version 3, a Logbook row and a certification; the registry's UK default flips to it | juaristi22 | The registry flip, in microcosm#1432 (merged 2026-11-02). Since microcosm#1505 the entry also names release `microcosm-uk-2024-25-national`, and the loader reads that release's current build from `releases.json` where the repository has one. microcosm#1574 (merged 2026-11-11) moved the national certification to schema 2, which adds `reference` and `since_baseline`, and renamed the score receipt to `score_vs_reference.json`. This document does not check the current build's staging, Logbook row or certification on the Hub |
| M2 | 2026-10-30 | `us/gates.json` and the US adapter (C1); the US writes staging version 3 and a Logbook row and records `producer` (C3, C4); staging version 1 goes; the registry gains an entry for the US local-area release, which carries the state and district file (C5); one compatibility rule in both loaders and, at publication, for every role (C2) | Max's session, PavelMakarchuk, anth-volk | None of it: only am, be, nz and uk carry a `gates.json`; the fiscal-refresh tool composes no certification, still writes staging version 1 through `StagingRunBundleWriter` and records no Logbook row; no release manifest records a `producer`; the registry has no entry for `microcosm-us-2024-local`; `_check_local_area_release_manifest` checks no compatibility list; and microcosm.data's loader keeps today's containment rule. policyengine.py, at 5b6d7901c on 2026-11-11, keeps its three bases and the `legacy_compatible_model_package` label |
| M2 | 2026-10-30 | `us/gates.json` and the US adapter (C1); the US writes staging version 3 and a Logbook row and records `producer` (C3, C4); staging version 1 goes; the registry gains an entry for the US local-area release, which carries the state and district file (C5); one compatibility rule in both loaders and, at publication, for every role (C2) | Max's session, PavelMakarchuk, anth-volk | Only `us/gates.json`, which the US tools evaluate in shadow without the adapter (microcosm#1585 item 11); the fiscal-refresh tool composes no certification, still writes staging version 1 through `StagingRunBundleWriter` and records no Logbook row; no release manifest records a `producer`; the registry has no entry for `microcosm-us-2024-local`; `_check_local_area_release_manifest` checks no compatibility list; and microcosm.data's loader keeps today's containment rule. policyengine.py, at 5b6d7901c on 2026-11-11, keeps its three bases and the `legacy_compatible_model_package` label |
| M3 | 2026-11-06 | Release manifest schema 2 and declared-country dispatch; the validator refuses unknown countries, which also closes a new country's tagged publish; `microcosm-publish-release-build` refuses non-conforming builds, derived builds included; the staging re-delivery command; policyengine.py's registry check | Max's session, juaristi22, anth-volk | None of it: `RELEASE_MANIFEST_SCHEMA_VERSION` is 1; `required_release_files`, `_expected_model_package` and `publishes_to_build_folder` still key on the release name, and an unknown name still gets the base file set; `microcosm-publish-release-build` runs the nine checks that C5 lists under "Order" and adds none of M3's: no check it runs asks for a `run_outcome`, a Logbook row or a manifest's declared `country`, and `required_release_files` names `release_certification.json` for `microcosm-uk-2024-25-national` alone; C1's other certification rule keys on the gate files a directory carries, not on a declared country. `test_release_contract_keying.py`, which arrives with this document, pins today's keying. This document has not looked for policyengine.py's registry check |

Max's rulings still decide anything that changes published numbers, such as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
)
from .schemas import load_schema_registry

EXPECTED_AUTHORED_FIELD_COUNT = 32615
EXPECTED_AUTHORED_FIELD_COUNT = 32618
EXPECTED_RESOLVED_BINDING_FIELD_COUNT = 9786
EXPECTED_CONFIGURATION_FIELD_COUNT = 42401
EXPECTED_CONFIGURATION_FIELD_COUNT = 42404


class FieldUsageError(AssertionError):
Expand Down Expand Up @@ -369,8 +369,8 @@ def _path_inventory(rows: Sequence[tuple[str, object]]) -> tuple[int, str]:
"bdd9e79157590fade42d28cc2b5d5c8b58e13903af75375a0e3235c94d2a8339",
),
"country_manifest": (
110,
"368fe74c5a1ac00cc51079ffc1e13add27471d6daeaf2bf362cb321be9535619",
113,
"11b70807bf06832e71367643c7d0e09891c1d4923fe574b471d6632562129897",
),
"generated_authorities": (
8_614,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@
"kind": "legacy_json",
"schema_id": "legacy_json"
},
{
"path": "gates.json",
"kind": "legacy_json",
"schema_id": "legacy_json"
},
{
"path": "obbba_reforms.json",
"kind": "legacy_json",
Expand Down
Loading
Loading