Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b56bdaa
Add a shared reader and selector for declared target sets
juaristi22 Nov 25, 2026
7f4006f
Declare the US target sets and select by them, with no surface change
juaristi22 Nov 25, 2026
416261d
Merge main 268156c8f into claude/us-target-set-declarations
juaristi22 Nov 26, 2026
3316038
Classify the US target-set module and re-pin the US F0 contracts
juaristi22 Nov 26, 2026
f605ffa
Pin the bytes of the ACS local target surface on the pinned feed and …
juaristi22 Nov 26, 2026
fb34e5e
Move the US ledger filter rules into us_runtime and compile in one place
juaristi22 Nov 26, 2026
f4dee4c
List target_sets.json in the US bundle generator's resources
juaristi22 Nov 26, 2026
868f414
Run the ACS local hold-outs on shared code
juaristi22 Nov 26, 2026
904a46d
Build the state and district ladder population rows with shared code
juaristi22 Nov 26, 2026
33cdf66
Declare the US compile registers as data, and document the declarations
juaristi22 Nov 26, 2026
5083516
Merge main 5df16cfd2 into claude/us-target-set-declarations
juaristi22 Nov 26, 2026
38dbd01
Merge main 4b78a9b23 into claude/us-target-set-declarations
juaristi22 Nov 26, 2026
fba28da
Pin the new name of the US matrix-row measures
juaristi22 Nov 26, 2026
e9317a3
Read a declared level rule and select by level in the shared target sets
juaristi22 Nov 26, 2026
61e2439
Select the UK full build's solve surface with the declared target sets
juaristi22 Nov 26, 2026
0d5dc1a
Declare the UK calibration lines as target sets
juaristi22 Nov 26, 2026
4e74c81
Share the hold-out split and the held estimates between the UK and th…
juaristi22 Nov 26, 2026
2ead043
Add the shared review core for signed register entries
juaristi22 Nov 26, 2026
c866b89
Check the UK exclusions' and support floor's dates with the review core
juaristi22 Nov 26, 2026
34c8d43
Read the UK reviewed exclusions with the shared review core
juaristi22 Nov 26, 2026
ca3a67e
Pin the UK target nodes' artifacts on the pinned feed
juaristi22 Nov 26, 2026
9130ebe
Describe the UK target sets
juaristi22 Nov 26, 2026
dcd2e47
Read the declaration files strictly
juaristi22 Nov 27, 2026
47561f9
Keep the replaced refusal texts in the shared hold-out and ladder code
juaristi22 Nov 27, 2026
f7cdd43
Raise a plain ValueError from the UK reviewed-exclusion reader
juaristi22 Nov 27, 2026
b66abff
Hash the shared modules the UK hold-out kernel runs
juaristi22 Nov 27, 2026
0f4b6e8
State what the proofs of the shared target code cover
juaristi22 Nov 27, 2026
202b825
Sort the US resource rows
juaristi22 Nov 27, 2026
781e784
Merge main 5589fae09 into claude/us-target-set-declarations
juaristi22 Nov 27, 2026
ca24442
Skip the UK target pins while the package pins another feed
juaristi22 Nov 27, 2026
36d976c
Declare the US level rule and record the rows left out by level
juaristi22 Nov 27, 2026
8fd3e88
Make the declared target sets a typed resource of the spec engine
juaristi22 Nov 27, 2026
c586e1c
Merge main a2e5f4d11 into claude/us-target-set-declarations
juaristi22 Nov 27, 2026
884f1eb
Name the declarations reader in the battery's binding identity
juaristi22 Nov 27, 2026
5eac92f
Exclude the target-set reader from the transport compile list
juaristi22 Nov 27, 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/1728-one-level-rule-form.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Each country now declares how to read a target's geography level in one form, a `level_rule` (microcosm#1728, from the review of microcosm#1755). `us/spec/target_sets.yaml` gives the US rule in full: the first of `ledger_geography_level` and `geography_level` that has a value, any level accepted. The short `level_keys` form is removed from `microcosm.calibrate.target_sets`, with `target_level`; `target_set_census` takes the rule. `us_runtime.target_loss_weights.target_geography_level` reads the declared rule in place of its own copy of that reading, so a US target has one level in the selection, in the loss weights and in the summaries. No level changes: `test_us_target_sets.py` holds the reader to a verbatim copy of the replaced code, and on the pinned feed every compiled target sets `ledger_geography_level` only.
1 change: 1 addition & 0 deletions changelog.d/1728-rows-left-out-by-level.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A declared selection now records the rows it leaves out because of their level (microcosm#1728, from the review of microcosm#1755). `select_target_set` counts, by family and level, the targets that an active clause names by family and that no such clause keeps at their level (`TargetSetSelection.left_out_by_level`). The ACS local tool writes the counts in `materialize_rss.json` under `target_levels_left_out`. No target or receipt changes: the SOI receipt is as before, and `test_us_target_sets.py` pins the counts of each local mode on the pinned feed (the country rows of the three families in every mode, and the district SOI rows in `state` and `state_county`).
1 change: 1 addition & 0 deletions changelog.d/1728-shared-ladder-population-targets.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ladder population targets are shared code for any country (microcosm#1728): `microcosm.build.ladder_population_targets` makes, for each declared geography level, the population rows (household size times the cell indicator), the cells no household supports, and the target specs with their calibration hierarchy, from declared names, record codes, geography ids and label lookups. The ACS local release declares its state and district levels in the `ladder_population` section of `us/local_target_construction.json`; the county rows stay with the county rung. The district module no longer imports the county module: the local tool picks the county rows for a county run. No target changes: `test_us_ladder_population.py` holds the shared code to verbatim copies of the replaced tool code, and the pinned bytes of `test_us_acs_local_surface_bytes.py` are unchanged.
1 change: 1 addition & 0 deletions changelog.d/1728-shared-target-holdouts.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Target hold-outs are shared code for any country (microcosm#1728): `microcosm.build.target_holdouts` draws held-out targets by hashed blocks from declared passes (scope, eligibility, unit key, salt, fractions, receipt), builds the training target set, and scores the held rows against a pro-rata baseline. The ACS local release declares its district and county passes in the new `us/local_target_construction.json`, read by `microcosm.build.us_runtime.local_target_construction`; the tool functions call the shared code under their old names. No target, role or receipt changes: `test_us_target_holdouts.py` holds the shared code to verbatim copies of the replaced tool code, and the pinned bytes of `test_us_acs_local_surface_bytes.py` are unchanged. A refusal keeps its text and stays a `ValueError` (the shared `TargetHoldoutError` is a subclass), except where one shared check now serves both passes: the county fraction refusal also names the value, the district pass checks its salt first, and the county scorer reads `role` on every record. `fraction=None` and `salt=None` are refused; only an omitted argument draws with the declared value. `docs/us-target-sets.md` lists these under "Refusals". The new resource row moves the US F0 spec-engine pins (42,410 configuration fields at this step; 42,413 after the compile registers). One label changes: `calibration_diagnostics.json` names each matrix-row measure `microcosm.build.target_holdouts.target_matrix_row[N]` instead of `us_acs_local_cd_surface.target_matrix_row[N]`, because the function that makes it moved to the shared module. So the diagnostics' `target_surface.sha256` (and the same field in `build_manifest.json`) changes for the same targets and weights; `names_sha256` and `values_sha256` do not. Accepted on 26 Nov 2026 and pinned in `test_us_target_holdouts.py`.
1 change: 1 addition & 0 deletions changelog.d/1728-strict-declaration-readers.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The declaration readers of microcosm#1728 are strict: `microcosm.build.declared_registers.package_registers` and the US local target construction refuse a repeated JSON key (plain `json.loads` kept the last one, so a second register of one name replaced the first without a word), a non-finite number, and a version that is not the integer 1. The declared target sets are read by the spec engine's strict reader, as a typed resource. A list of clause names refuses `"*"`, which would match only a name `*`; give `"*"` alone for every name. The packaged files already pass, so no selection or register changes.
1 change: 1 addition & 0 deletions changelog.d/1728-typed-target-sets-resource.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The declared target sets are now a typed resource of the spec engine (microcosm#1728 and microcosm#1759, from the review of microcosm#1755). The spec engine has a new resource kind, `target_sets`, with the schema `target_sets.schema.json`, the sixteenth schema of its catalog. `us/target_sets.json` and `uk/target_sets.json` become `us/spec/target_sets.yaml` and `uk/spec/target_sets.yaml`. The schema marks each `description` and `rationale` as documentation and every other field as normative, so the spec engine keeps the prose apart from the content a selection reads, and the bundle's `spec_sha256` now covers that content: a changed clause changes the spec hash, and a reworded rationale does not. The products and the modes are lists with an `id`, so their declared order is content; the order of the fields of an object is not. `microcosm.calibrate.target_sets.load_target_set_declarations` takes the object the spec engine parsed, and the file reader it had is removed; the country modules read through the new `country_spec.load_country_target_sets`, which loads the one resource as the bundle loader does. The US file is written by hand (`AUTHORED_DOMAIN_KINDS` of `tools/generate_us_bundle_from_constants.py`), with a reviewed claim in the F0 field ledger; the US pins move to 42,557 configuration fields and a new `spec_sha256`. No target, order or receipt changes: the pinned US surfaces and the UK equivalence tests hold.
1 change: 1 addition & 0 deletions changelog.d/1728-us-fiscal-target-registers.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The reviewed registers of the US fiscal target compile are declared data (microcosm#1728): the fact exclusions with their reasons and vintage scope, the misread source columns, the restamped source packages, the SOI variable maps, the direct and indicator Ledger targets, and the M-CHIP states moved from Python literals in `us_runtime/fiscal_targets.py` and `us_runtime/source_vintage.py` to `us/fiscal_target_registers.json`, with the comments that stood beside them as descriptions and notes. The new shared `microcosm.build.declared_registers` reads a register back as the literal it replaces (JSON arrays as tuples, entries in order), and the code keeps every name. No target changes: `test_us_fiscal_target_registers.py` pins each register's digest as measured on the literals, the pinned-feed compile under four flag sets, and the exclusion receipt. `docs/us-target-sets.md` describes the declared construction and the registers. The new resource row moves the US F0 spec-engine pins (42,413 configuration fields).
1 change: 1 addition & 0 deletions changelog.d/1728-us-ledger-filter-rules.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The US ledger filter rules (how the national `irs_soi` slice reads a spec's AGI band, filing status and EITC child count, and which restated `ledger_filter_*` keys a spec may carry) moved unchanged from `tools/build_us_fiscal_refresh_release.py` to `microcosm.build.us_runtime.ledger_filter_rules` (microcosm#1728). The tool imports them back under the same names, and the ACS local district surface reads them from the package instead of importing the tool. The ACS local tool now compiles the target registry in one function, `_compiled_fiscal_registry`. No target changes: `test_us_acs_local_surface_bytes.py` pins the bytes of the local registry, roles and target receipts on the pinned feed and ladder.
1 change: 1 addition & 0 deletions changelog.d/1728-us-target-set-declarations.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Each US release's target set is now declared as data (microcosm#1728): `us/spec/target_sets.yaml` states, for the national tool's `--target-surface` modes and the ACS local tool's `--soi-mode` modes, the compiled families and levels each mode keeps, the tests and named rules that pick them, and the rows the tool builds itself. The shared, country-free reader and selector `microcosm.calibrate.target_sets` replaces the selection code in `_select_target_surface`, `state_admin_surface` and `soi_surface_predicate`. No surface changes: on the pinned `41b2fb2` feed every mode keeps the same targets in the same order (`national_state` 6,102, the local default 4,867 with its population rows), and `test_us_target_sets.py` pins each count and registry version. `docs/us-target-sets.md` explains the declarations.
1 change: 1 addition & 0 deletions changelog.d/1759-shared-holdout-split.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The UK and US hold-outs share their last two steps (microcosm#1759). `microcosm.build.holdout` gains `HoldoutSplit` (a split's training rows and held rows), `fold_splits` (the UK's rotated folds as splits) and `held_estimates` (the held rows' estimates from the target matrix and the solved weights, in float64). The UK rowwise hold-out (`uk_runtime.local_rowwise.rotated_uk_local_holdout`) and the US local hold-out (`microcosm.build.target_holdouts`, through the new `role_split`) both use them; the two draws stay apart on purpose (rotated folds over UK local target rows, hashed blocks over US units). No hold-out result changes: `test_holdout.py` holds the new functions to the replaced UK and US expressions byte for byte on float64 matrices, which is what both builds pass (a float32 matrix with float32 weights is widened before the product, where the replaced UK expression multiplied in float32), and the US hold-out tests compare with verbatim copies of the old tool code. The UK hold-out node now also hashes `microcosm.build.holdout`, which it ran without hashing, and the modules it reaches when it rebuilds the problem inputs: the declared level rule (`microcosm.calibrate.target_sets`, `uk_runtime.target_sets`) and the review core (`microcosm.build.declared_registers`). `test_uk_graph_terminal.py` pins these entries and the gate kernels' review-core entry. The UK hold-out keeps its constants (5 folds, seed 20260529, in `uk_runtime/local_rowwise.py`); a stricter UK hold-out would start there.
1 change: 1 addition & 0 deletions changelog.d/1759-shared-review-core.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Signed register entries are checked with one shared review core (microcosm#1759). `microcosm.build.declared_registers` gains `read_strict_json`, `canonical_date`, `ReviewWindow` and `stale_entries`; they return values, and each country's code keeps its texts and decides what a lapse does. The UK calibration measure exclusions and the support floor (`uk_runtime.measure_simulation`, `uk_runtime.support_floor`) read their dates and windows with it. No result, warning, error class or error text changes: `test_uk_review_loaders.py` holds the new code to verbatim copies of the old functions on the packaged file, on changed copies and on the days around each window edge. The UK target and national kernels now also hash `declared_registers`. The small-cell deferrals keep their own expiry check: it also accepts compact dates, so moving it would change what it accepts. The UK reviewed-exclusion registers (target fit, local target fit and area support, in `uk_runtime.weighted_integrity`) read their files with `read_strict_json` and their dates and windows with `canonical_date` and `ReviewWindow` (`UKReviewedExclusion.window()` is new); `test_uk_reviewed_exclusions_core.py` holds them to verbatim copies of the old reader, date checks and window methods, by error class and text (a gate that fails closed records the class name, so the reader still raises a plain `ValueError`). The UK gate kernels that read these registers now also hash `declared_registers`.
1 change: 1 addition & 0 deletions changelog.d/1759-uk-declared-target-selection.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The UK full build selects its solve surface with the shared declared target sets, as the US does (microcosm#1759). `uk/spec/target_sets.yaml` declares the UK level rule (a target's level is `geography_level` or `ledger_geography_level`; the two must agree, and the level must be one of country, region, constituency, la and brma) and the full build's selection by level, one clause for each level. `microcosm.calibrate.target_sets` reads a declared `level_rule` (the US file declares its rule in the same form) and its new `select_by_levels` keeps the requested levels in compile order with the same receipt (`microcosm.calibrate.target-selection.v1`). `microcosm.calibrate.target_selection` is removed: the UK selection kernel was its only caller, and `uk_runtime.graph_targets.target_geography` now reads the declared rule. No selection changes: `test_uk_level_selection.py` holds the new code to verbatim copies of the removed selector and resolver on random registries, refusals included. The new UK resource is in the UK solve fingerprint, so the first UK build after this change computes the spine from `frs_brma` on, the target nodes and the national graph again. The two UK calibration lines are declared there too, as the modes of a `calibration_line` product: `uk_runtime.ledger_targets.uk_registry_on_calibration_line` selects through it with one UK predicate that reads each contract target's `calibration_lines`, which stay in `uk/uk_population_targets.json`; `UK_CALIBRATION_LINES` is the declared modes. The shared selector now reads a target's level only when a clause tests levels. `test_uk_calibration_line_selection.py` holds the line filter to a verbatim copy of the replaced function: the same registry (the same object when nothing drops), the same receipt, or the same refusal.
1 change: 1 addition & 0 deletions changelog.d/1759-uk-target-sets-content-key.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The UK solve fingerprint now reads `uk/spec/target_sets.yaml` by its normative content, not by its bytes (microcosm#1759, from the review of microcosm#1755). The country spec records, for each typed resource of a package, the sha256 of the normative projection that the spec engine gives it (`ResolvedCountrySpec.content_hashes`), and `fingerprint_excluding` takes that hash for the resources named in `by_content`. The UK solve names its declared target sets there (`uk_runtime.solve_scope.UK_CONTENT_KEYED_RESOURCES`). A reworded description or rationale, or a new layout of the file, re-keys no solve node, so it cannot force the second build of a local release to solve again; a changed clause, level or exclusion re-keys every node that keys on the solve fingerprint. The calibrated gates and the release manifests keep the byte hash. The solve fingerprint has a new value, so the first UK build after this change computes the solve-scoped nodes again, with the same outputs. `test_uk_solve_scope.py` edits the packaged file both ways and compares every solve kernel's key.
38 changes: 26 additions & 12 deletions docs/evidence/spec-engine/us-f0-coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"version": 1
},
"country": "us",
"documentation_sha256": "fda6ec0dd925077f4d84d30a1c206dd81d82c5e16bd94506e81fe1b9f7e2f466",
"documentation_sha256": "3342f5315eeef08e5d2e91f29c9d06e6f8e5e065dfdb0222c8de573716bf0a97",
"field_usage": {
"authored_normative_field_count": 32618,
"claim_count": 48,
"authored_normative_field_count": 32771,
"claim_count": 49,
"claims": [
{
"consumer": "loader.typed_resource_manifest",
Expand All @@ -16,8 +16,8 @@
"legacy_sinks": [],
"mode": "front_end_validation",
"pointer_class": "all",
"pointer_count": 113,
"pointer_sha256": "11b70807bf06832e71367643c7d0e09891c1d4923fe574b471d6632562129897",
"pointer_count": 122,
"pointer_sha256": "5887af82b9909867a4f39af35d63d857174c22509a036a5c94cdeeb7f5d27ac3",
"rationale": null,
"relative_sink_prefix": null,
"source_prefix": "/authored/country_package.json",
Expand Down Expand Up @@ -684,6 +684,20 @@
"source_prefix": "/authored/spec~1take_up.yaml",
"verifier": "legacy"
},
{
"consumer": "country_spec.declared_target_sets.us_runtime_target_sets",
"generation0_effect": "no_generation0_effect",
"id": "target_sets",
"legacy_sinks": [],
"mode": "front_end_validation",
"pointer_class": "all",
"pointer_count": 144,
"pointer_sha256": "476b22fb8944797601151d253e4a1f1c545d1e49029dc3d391f0b7ff89733b6d",
"rationale": null,
"relative_sink_prefix": null,
"source_prefix": "/authored/spec~1target_sets.yaml",
"verifier": "target_sets"
},
{
"consumer": "resolver.vintage_authorities",
"generation0_effect": "no_generation0_effect",
Expand Down Expand Up @@ -758,20 +772,20 @@
"verifier": "vintages"
}
],
"configuration_field_count": 42404,
"consumed_field_count": 42404,
"configuration_field_count": 42557,
"consumed_field_count": 42557,
"generation0_effect_counts": {
"legacy_behavior": 38780,
"no_generation0_effect": 3624
"no_generation0_effect": 3777
},
"mode_counts": {
"compiler_semantic": 27674,
"front_end_validation": 358,
"front_end_validation": 511,
"identity_only": 103,
"legacy_behavior": 14269
},
"multiple_primary_use_field_count": 0,
"pointer_inventory_sha256": "38fc67ba13d62a5c0eaff36abb8f04d4d2974e21baaed6d2966d76480e643608",
"pointer_inventory_sha256": "7c37171ae40e7e9f43e9ecf36937cbd0a907b5516868b45dc3d9cf7ddec12d4d",
"resolved_binding_field_count": 9786,
"unused_field_count": 0
},
Expand Down Expand Up @@ -2585,7 +2599,7 @@
"country": "us",
"schema_id": "country_spec",
"schema_version": 1,
"spec_sha256": "7e282f7fd459c63a25f1ad8b57fc88cb118088c353e81dce26080ad87f266375"
"spec_sha256": "e76daa6c13870a3d09a3201321ffbd5d55e27023578c69e3be20ed7685c0c220"
}
},
"report_schema_version": 3,
Expand All @@ -2595,7 +2609,7 @@
"country": "us",
"schema_id": "country_spec",
"schema_version": 1,
"spec_sha256": "7e282f7fd459c63a25f1ad8b57fc88cb118088c353e81dce26080ad87f266375"
"spec_sha256": "e76daa6c13870a3d09a3201321ffbd5d55e27023578c69e3be20ed7685c0c220"
},
"status": "pass"
}
11 changes: 11 additions & 0 deletions docs/spec-engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,17 @@ Per "Gates and calibration": each gate a full executable record; the
solver surface fully resolved; `k` a run-request knob with a declared
bundle default and precedence; no `device` in normative content.

### target_sets.yaml

The declared target sets: which compiled targets each product calibrates to,
for each mode, and the country's level rule (microcosm#1728, microcosm#1759).
The schema is country-free, and the UK and the US both ship the file. The
release tools read the typed domain themselves through
`country_spec.load_country_target_sets`. Each `description` and `rationale` is
documentation; the rest is normative. It is the one typed US file that is
written by hand: the constants-era code never held it. See
[US target sets](us-target-sets.md) and [UK target sets](uk-target-sets.md).

### publication.yaml

Attempt-event model + promotion protocol + release relationship graph;
Expand Down
Loading
Loading