Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions changelog.d/1800-be-release-files-and-assembly.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
A spec country's transport build can now be assembled into a release build that `microcosm-publish-release-build` publishes, with the three files BE's release contract adds to the base three (microcosm#1800). Until now nothing wrote `source_coverage.json`, `demographics.json` or `reform_validation.json` for BE, so no new BE build could pass the contract #1744 put in force.

- **The release files.** `microcosm.build.spec_release_files` builds each from the country's spec and the build's calibration diagnostics, reading no population. `source_coverage.json` has the US file's fields under the contract name `be_source_coverage`: each target category (or each reference's `family`, where the spec declares no category, as NZ's does) with an executable calibration reference is a hard target, each whose references are all parked is a source gap, and each held-out one is validation-only, under its own ID even where a target family has the same name; the check fails when the build left out an executable reference or calibrated a held-out one. `demographics.json` has the US file's fields (each age band without `min_age` and `max_age`, which the spec does not give) for the spec's demography references (BE: Statbel population by NUTS1 region, sex and age band), with each cell's calibrated population and benchmark and their sums by age band; BE calibrates these cells, so the file reports in-sample fit (`in_sample` true). `reform_validation.json` lists no reforms until scored BE reforms exist (microcosm#264), and records `out_of_sample_simulated` true, as the US writer does when no out-of-sample reform exists, so publication does not refuse it.
- **The release step.** `tools/assemble_spec_release_dir.py --build-dir <transport --out> --country be` (`microcosm.build.spec_release_assembly`) reads what the transport build wrote, as the UK national assembler reads its candidate's outputs. It refuses a build that still owes outputs; records no clean Microcosm commit, no runtime or no spec digests; ran on a spec whose resources differ from the one the step loads; has an H5, export descriptor, diagnostics file or run manifest that changed after the build wrote it, or an H5 that does not read back against its descriptor (which needs the pandas and NumPy versions the build used); has a gate that did not pass; has a year with no release that publishes into build folders; or fails its source coverage check. It also refuses to replace an earlier assembly. It writes `releases/<release>/` with each file the release contract requires, puts the H5 (`populace_be_<year>.h5`) and a weights file from its household table (`populace_be_<year>_calibration.npz`) beside the build, validates the directory with the release contract, and prints the publish and promote commands. It uploads nothing. The build is named `microcosm-be-<year>-chronicle-<Chronicle pin>-<finish time>`.
- **Transport builds record what they ran on.** `build-status.json` now records the Microcosm commit of the checkout that tracks the transport command's code and whether a tracked file differed from it (`microcosm.graph.reconstruction.code_revision`), the Python and package versions (`transport_build_provenance`), and the digest of each JSON spec resource the graph was composed from; its `produced` record now also gives the run manifest's digest.

Out of scope: a BE transport graph (BE's spec declares none yet, so no BE build runs through the release step until it does), scored BE reforms, and a BE registry entry or staging.
9 changes: 8 additions & 1 deletion docs/agent-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ chooses the tier (certified, or `--evidence-release`), runs the release's
post-export checks, places the build in that tier's release directory, writes
the manifests and prints both commands (microcosm#1585 item 11). The ACS
package stage prints both commands itself.
A spec country's transport build (BE's releases) goes through
`tools/assemble_spec_release_dir.py`, which reads the build's `--out` folder,
writes the release directory with the files the country's release contract
lists and prints both commands (microcosm#1800).
`tools/preflight_us_release_gates.py` runs the US national release checks that
need no calibration on the base before a build, and again with the finished
build's `--release-manifest`. The emitter changes
Expand Down Expand Up @@ -707,7 +711,10 @@ The transport build driver (`tools/build_transport.py`, a shim over
`microcosm.build.transport.cli`) composes a country's graph from its
`transport_graph.json` spec resource and runs it locally: every file it
writes, including its `.graph-store`, lies under `--out`, and it has no
upload or staging path. Before it opens the store it refuses any link in an
upload or staging path. Its `build-status.json` records the Microcosm
commit, whether a tracked file differed from it, the Python and package
versions and the digest of each JSON spec resource the build ran on, which the
release step reads. Before it opens the store it refuses any link in an
existing store tree (the root, `objects`, `tmp` or a shard), because the
store creates those directories by following links; it does not guard
against links planted while a build is running. Activation checks run before
Expand Down
29 changes: 29 additions & 0 deletions docs/release-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,35 @@ work.
BE builder in this repository stages and the collector registers no BE
staging repository; a BE build whose manifest records no staging is not
refused for it.
- *BE's release files and release step* (microcosm#1800). A BE build's
three added files come from `microcosm.build.spec_release_files`, which
reads only the country's spec and the build's calibration diagnostics:
`source_coverage.json` has the US file's fields under the contract name
`be_source_coverage`, with the spec's target categories (or, where it
declares none, each reference's `family`) as its source families;
`demographics.json` has the US file's fields (each age band without
`min_age` and `max_age`, which the spec does not give) for the spec's
demography references, whose fit is in-sample because BE calibrates
them; and `reform_validation.json` lists no reforms, with
`out_of_sample_simulated` true as the US writer records it when no
out-of-sample reform exists, until microcosm#264. The release step for a
transport build, `tools/assemble_spec_release_dir.py`
(`microcosm.build.spec_release_assembly`), reads the build's `--out`
folder as the UK national assembler reads its candidate's outputs:
`build-status.json` (nothing owed; a clean Microcosm commit, the runtime
and the digest of each JSON spec resource, which a transport build
records there and which must equal those of the spec the step loads),
the H5 read back against its export descriptor (under the pandas and
NumPy versions the build used, which the descriptor records), the
calibration diagnostics and the run manifest (every gate passed). It
writes `<out-dir>/<release>/` with each file the country's release
contract requires, puts the H5 and a weights file beside the build under
the manifests' names, validates the directory and prints the publish and
promote commands; it uploads nothing. The release is
`microcosm-<country>-<year>-national` for the export's year, and only a
name `publishes_to_build_folder` admits is taken. BE's spec declares no
transport graph yet, so no BE build runs through this step until it
does.
- *The first build of a new UK `k`* (2026-11-13). `validate_release_dir`
refuses every layout of a local-area release until a registry entry names
it, and `build_folder_identity` and `microcosm-publish-release-build`
Expand Down
Loading
Loading