Repository navigation
Conversation
Tracker 5b · 13. Tests, a fixture transport build folder and placeholder modules, so each test fails on an assertion: - the three files a spec country's build adds to the base three (source coverage, demographics, reform validation), on fixture calibration diagnostics and BE's spec; - an assembler that reads a transport build's output folder and writes the release directory microcosm-publish-release-build publishes; - a transport build recording its Microcosm commit, dirty flag and Python and package versions in build-status.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uilds Tracker 5b · 13 (microcosm#1800). A new BE build must carry the six files BE's release contract lists, and nothing wrote source_coverage.json, demographics.json or reform_validation.json, so no BE build could publish. - microcosm.build.spec_release_files builds the three files from the country's spec and the build's calibration diagnostics: source coverage with the US file's fields over the spec's target categories, the demography references' calibrated cells and age bands, and a reform validation with no reforms yet. - microcosm.build.spec_release_assembly (tools/assemble_spec_release_dir.py) reads a transport build's --out folder as the UK national assembler reads its candidate's outputs, refuses a build it cannot publish, writes the release directory with the H5 and its weights beside the build, validates it and prints the publish and promote commands. It uploads nothing. - A transport build's build-status.json records the Microcosm commit, whether the checkout was clean, and the Python and package versions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… copy Review round 1 of #1801: - The assembler reads the spec of the checkout it runs from, so a build of another spec would be named and judged against references it did not compile. Tests require the build to record its spec's resource digests and the assembler to refuse a build whose spec differs or is not recorded. - transport_build_provenance measured git in the module's directory, so an untracked installed copy inside another repository, or GIT_DIR, recorded another repository's commit. Tests name the code file and require it to be tracked, ignoring repository-selecting variables. - Guards: a contract refusal after staging leaves nothing behind, and the writers' file table equals the contract's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 of #1801: - execute_transport_graph records the digest of each spec resource the graph was composed from under build-status.json 'spec' (the command passes load_transport_spec's resource_hashes), and the release step refuses a build that records none or whose digests differ from the spec it loads. - transport_build_provenance takes the code file and measures it with microcosm.graph.reconstruction.code_revision: the file must be tracked, and git runs without repository-selecting variables. - The run manifest's known failures already cover every gate outcome, so the second loop over them goes; demographics docs say the age bands have no min_age or max_age. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 of #1801 (high): reform_validation.json recorded out_of_sample_simulated false, which microcosm-publish-release-build reads as skipped out-of-sample reforms and refuses without an override, so the printed publish command failed for every BE build. Anthony chose to record true, as the US writer does when no out-of-sample reform exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eforms Review round 1 of #1801 (high), as Anthony chose: the US writer records true when no out-of-sample reform exists, and publication refuses false, so the printed publish command now passes the publisher's checks. Docs and changelog also name every refusal, the spec digests, the pandas and NumPy versions the read-back needs, and the age bands' missing bounds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ecord Review round 2 of #1801 (two low-priority bugs and one gap): - A spec whose references declare no category (NZ's) gave the source coverage check nothing to compare, so it passed whatever the build calibrated. - The build manifest's run start was the start of the transport command's last pass over the stored graph, not of the build. - The export descriptor, whose weight entity picks the NPZ's weights, was not compared with the digest the build recorded. Guards: the environment-variable test's two repositories are at different commits, and the command passes the loaded spec's digests to the run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 2 of #1801: - Source coverage groups a reference whose category the spec does not declare by its 'family', so a spec like NZ's, with no categories, still has its references checked. - The build manifest's run record keeps the run manifest's key and end, not the start of the command's last pass over the stored graph. - The release step compares the export descriptor with the digest the build recorded, and reports a malformed gate outcome as a refusal. - Docs: the spec digests cover the JSON spec resources; the refusal list drops the release tier, which no transport build records; a refusal may leave the out directory created. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 3 of #1801: - (low) Where a spec declares no categories, a held-out reference and a calibrated target in families of the same name made the source coverage check report the held-out family as calibrated. - The run manifest, which decides the gate refusal and the build's name, was the only build file the release step read without a digest from build-status.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 3 of #1801: - A held-out family whose ID a target family also has takes a '.held_out' suffix, so a calibrated target never counts as a calibrated held-out reference. - The transport command records the run manifest's digest under build-status.json 'produced', and the release step compares it before reading the manifest. - Docs: only JSON spec resources are hashed; the changelog's refusal list names the descriptor and the run manifest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main removed microcosm.data.publish_cli with the tagged publisher and moved publication_refusal into microcosm.data.release. The assembler test and the reform validation docstring name the new place; the docstring's old module name would also have failed test_tagged_publisher_removed's search of package sources. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1800. Tracker task 5b · 13 ("BE builder: write source coverage, demographics and reform validation into each build") of the collector/emitter project.
What this does
Since #1744, a new build of a BE release must carry the six files BE's release contract lists and declare the three added ones (
source_coverage,demographics,reform_validation) in its release manifest. Nothing wrote those three files, and nothing turned a BE build into a directorymicrocosm-publish-release-buildcan publish, so no new BE build could publish. Microcosm's own BE builds run through the spec-driven transport command, which writes a local--outfolder and has no release step; this PR adds that step, modelled on the UK national assembler, and the three files.main)tools/assemble_uk_release_dir.pytools/assemble_spec_release_dir.py(microcosm.build.spec_release_assembly), country-neutralbuild-status.json(commit and runtime, now recorded there), the H5 read back against its export descriptor, the calibration diagnostics, the run manifest's gate outcomesuk_source_coverage.json(dense release only, UK-specific)source_coverage.jsonwith the US file's fields underbe_source_coveragedemographics.jsonandreform_validation.json(below)microcosm.build.spec_release_filesbuilds the three files from the country's spec and the build's calibration diagnostics; it reads no population and runs no simulation.source_coverage.json: the sharedsource_coverage_gateover the spec's target categories. A category with an executable calibration reference is a hard target (BE: Statbel demography), one whose references are all parked is a source gap, and each held-out category is validation-only. It fails when the build left out an executable reference or calibrated a held-out one, and the release step treats it as a release gate.demographics.json: the US file's fields for the spec's executable demography references (BE: Statbel population by NUTS1 region, sex and age band), each cell's calibrated population and benchmark from the calibration rows, and their sums by age band. BE calibrates these cells, so the file reports in-sample fit (in_sampletrue), where the US file reports an uncalibrated age distribution.reform_validation.json: schema 1, no reforms,out_of_sample_simulatedtrue (as the US writer records when no out-of-sample reform exists, so publication accepts it), until scored BE reforms exist (Validate populace-be against EUROMOD-BE and Federal Planning Bureau scores #264).microcosm.build.spec_release_assemblyrefuses a build that still owes outputs; records no clean Microcosm commit, no runtime or no spec digests; ran on another spec; has an H5, export descriptor, diagnostics file or run manifest that changed after the build wrote it; has a gate that did not pass; has a year without a release that publishes into build folders; or fails its source coverage check. The release ismicrocosm-<country>-<year>-national; the build ismicrocosm-<country>-<year>-chronicle-<Chronicle pin>-<finish time>. The H5 is copied beside the build aspopulace_be_<year>.h5and its household weights written aspopulace_be_<year>_calibration.npz; both are declared and publish into BE's private repository, as the contract's private file list names them.microcosm.build.transport.cli:build-status.jsonnow records the Microcosm commit of the checkout that tracks the command's code and whether a tracked file differed from it (code_revision), the Python and package versions (transport_build_provenance), the digest of each JSON spec resource (spec) and the run manifest's digest.docs/release-contract.md(C5),docs/agent-guide.md,changelog.d/1800-be-release-files-and-assembly.added.md.Commits
89217fcc9adds the tests and placeholder modules: all 30 failed on assertions (11 as "DID NOT RAISE"), run by file and, fortest_transport_composed_graph.py, by the one modified test's node ID.317c0ffd8is the change.720f9f42a(tests) and1ab647435(fix) for its two medium-priority bugs and the low one;d86fb35d7(tests) and807a12ecf(fix) for its high-priority bug.bd7d83732(tests) and401d4045d(fix) for its two low-priority bugs.088672fd5(tests) and54a92c807(fix) for its low-priority bug.a299890f1mergesmain(8ea088de0, with Remove the tagged publisher, microcosm-publish-release #1797's removal of the tagged publisher) at Anthony's request; it merged with no conflict.c84773e7cthen readspublication_refusalfrommicrocosm.data.release, where Remove the tagged publisher, microcosm-publish-release #1797 moved it from the removedmicrocosm.data.publish_cli.New tests:
test_spec_release_files.py,test_spec_release_assembly.pyandtest_transport_build_provenance.pyinpackages/microcosm-build/tests/engine_free/shared/, and assertions intest_transport_composed_graph.py::test_cli_checkpoints_write_only_under_out_and_resume_warm. The fixture build folder istest_support/microcosm_build/spec_release.py; its calibration rows are BE's demography references read from BE's spec.Review
Round 1 (one high, two medium, one low; all fixed):
reform_validation.jsonrecordedout_of_sample_simulatedfalse, whichmicrocosm-publish-release-buildreads as skipped out-of-sample reforms and refuses without--allow-incomplete-reform-validation, so the printed publish command failed for every BE build. Fixed as Anthony chose: the file records true, as the US writer does when no out-of-sample reform exists. A test checks the assembled folder against the publisher's own checks (publication_refusal).build-status.json(spec), and the release step refuses a build that records none or whose digests differ.GIT_DIRand similar variables, so an installed copy inside another repository recorded that repository's commit. Fixed:transport_build_provenance(code_file=...)usesmicrocosm.graph.reconstruction.code_revision.min_ageandmax_age. Documented: BE's spec gives age bands as values without bounds.Round 2 (two low; both fixed):
family.Round 3 (one low; fixed):
.held_outsuffix.Left after three rounds (not bugs the reviews rated, or not cheap):
code_revisionrunsgit status, which can rewrite the checkout's git index file (outside--out); it is shared with Orrery reconstruction, so a change there is its own PR.--spec-dirassembles only when its JSON resources are byte-identical to the packaged spec.Not in this PR
transport_graph.jsonyet, so no BE build runs through the release step until it does. NZ's graph exercises the transport output format the step reads.Merge waits for
Tracker task 5b · 12
done, and Anthony.Environment variables
None: the change reads no environment variable and touches no workflow, image or deployment code.
transport_build_provenancerunsgit rev-parse HEADandgit statusin the checkout.🤖 Generated with Claude Code