Repository navigation
Conversation
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The repository spells artifact, materialize and normalize the American way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ns and match local path spellings Round 3 found that create materialized every source before using any, that an old flat year file could load after two stems' pins converged, and that two spellings of one local file were refused as different sources. Create now checks result-key collisions first and uses each source before materializing the next. Managed flat files carry their source SHA-256, and a file with a stale or missing hash is regenerated. Local sources compare by resolved path. Tests cover each case, batch refusal across create, load and ensure, and recertification in both rename directions. The microsim guide and changelog record the cache migration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
load_datasets now refuses a managed US flat year file whose recorded source SHA-256 is missing or differs from the bundle's pin, so files written by earlier releases need regenerating once. The changelog lists this under changed, and the microsim guide defines flat year files and says that ensure_datasets regenerates them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er local preflight - ensure_datasets maps an exact pinned URI to its bundle key and rebuilds a pre-upgrade flat year file through it; opt-in creation derives the legacy SPM declarations from the verified pin. load_datasets still refuses a pre-upgrade managed flat file until ensure_datasets rebuilds it. - A download whose URI exactly matches a pinned bundle artifact is verified before it replaces the raw cache, and year files are staged, stamped and validated before they replace a warm cache. - The batch planner treats absolute paths, symlinks and planned outputs as local inputs without resolving them, and checks each file when its request runs, so an earlier request in the batch can create it. - A flat file that records a source SHA-256 is refused for a request without an exact pin, conflicting URI pins are refused, and an unpinned same-stem entry no longer forces a split cache; the guide's split condition needs more than one distinct source SHA-256. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng, document local keys - Materialization returns the bundle provenance after it verifies a download whose URI exactly matches a bundle pin, so managed microsimulation records verified provenance for that URI and US runs apply the legacy SPM declarations registered for the pin. - Opt-in creation raises ValueError during planning for an explicit local file that no earlier request in the batch can produce. - New unpinned year files go to a source-specific path when their stem has a bundle pin, so alternating managed and unpinned requests reuse their own files instead of overwriting one flat file. - The guide and changelog cover full local stems such as sample@local, unpinned requests refusing hash-stamped flat files, and moving to source-specific paths. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ck, read year files from one snapshot Round 5 found five P1s in the cache-identity and provenance code. Legacy SPM declarations now come from the full verified input and align to scoped regional runs. Models receive pin-specific raw paths that other downloads cannot replace. Unpinned requests for a stem with a bundle pin use only their source-specific year file. Opted-in URI rebuilds keep the ordered raw-cache updates. Stamp, SPM record and tables load from one file snapshot. Exact URIs verify pinned metadata sidecars, ambiguity checks include the package name, and explicit relative paths and unpinned bundle keys fail in preflight. Co-Authored-By: GPT-6.2 Sol <noreply@openai.com> 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.
Summary
Accept
microcosm_us_2024andmicrocosm_us_2024_acs_localas US dataset selectors alongsidepopulace_us_2024andpopulace_us_2024_acs_local. Dataset selection uses an exact bundle key when present and falls back to the corresponding spelling when that key is absent. If the bundle records both spellings, each exact key selects its own artifact.The current bundle has one US artifact per filename stem. With that bundle, existing bundle keys and calls without a selector keep main’s artifact selection, artifact SHA-256, result values and result keys. They still populate the repository-relative raw cache. Runtime provenance records the pin-specific path the model uses. Distinct same-stem sources must be requested separately, and managed flat year files require the bundle’s source hash. Local keys and filenames retain the full stem. When the bundle has a pin for the same stem, unpinned requests read and write only their source-specific year-file path. If the file is missing, build it with
ensure_datasets(..., allow_unmanaged=True)orcreate_datasets(..., allow_unmanaged=True). When both spellings resolve to the same entry, they produce the same results and reuse the same year files.create_datasets,load_datasetsandensure_datasetskey bundle results by artifact filename stem and year. For a local file such assample@local.h5, the 2024 key issample@local_2024and the year filename issample@local_year_2024.h5.Separate derived US year files by source SHA-256 when the bundle records more than one distinct source SHA-256 for that filename stem. Each such source writes and reads its year files under
.policyengine-us-year-files/in the data folder, in a subdirectory named by a hash of the source’s SHA-256, so each exact selector loads its own source’s year files. An explicit URI that identifies a bundle pin uses managed materialization. Materialization verifies the temporary download against the bundle’s SHA-256 before replacing the raw cache file. It also verifies any pinned metadata sidecar. Managed microsimulation records verified provenance for opt-in Hugging Face URIs that exactly match a bundle pin. US runs derive any legacy SPM declarations registered for that pin from the full verified source and align them to the selected cohort and its reform branches. This includes state and congressional-district runs that use the registry’s dataset URI and row filter.In any batch,
create_datasets,load_datasetsandensure_datasetsnow refuse distinct sources that would share a result key, such as two explicit URIs whose files share a stem (e54b0d892); main returned one entry for them, and itscreate_datasetsoverwrote the shared year file. The three functions resolve local paths before they compare them, so they return one result for a relative and an absolute path to one file, as main did (47eb2d63f). They still refuse other pairs of spellings for one artifact, such as a Hugging Face URI with and without@main, or a bundle key and a local path to its cached file; main returned one entry for these. Before materializing any source,create_datasetsrejects result-key collisions and raisesValueErrorfor missing explicit local files that no earlier request can produce. It then cuts each source’s year files before it materializes the next source, as main did (47eb2d63f).Record the source SHA-256 in flat year files (
47eb2d63f).create_datasetswrites a bundled US artifact’s year files straight into the data folder, as main did, unless the bundle records more than one distinct source SHA-256 for that filename stem. It now adds the artifact’s bundle SHA-256 to the stamp of each of these flat year files assource_sha256.load_datasetsrequires a managed flat year file to match the bundle’s pin.ensure_datasetscan regenerate it from the bundle key or an exact pinned URI. By default, regeneration from an exact URI uses its bundle key. Withallow_unmanaged=True, regeneration preserves the explicit URI’s ordered raw-cache updates. An unpinned request with no same-stem bundle pin requires an unbound stamp on its flat year file. Main could reuse a flat year file after an updated bundle pinned a different SHA-256 for the same filename stem. Releases from 6.3.3 up to this change read a stamp that holdssource_sha256as malformed. When one of them and a release with this change share a data folder, each one’sensure_datasetsregenerates the flat year files the other wrote. Unpinned year files omitsource_sha256. When their stem has a bundle pin, they are written to a subdirectory keyed by the resolved local path or URI. Managed year files in per-source subdirectories omit the hash because the directory identifies the pin. Thechangelog.d/microcosm-dataset-selectors.changed.mdfragment says thatload_datasetsrefuses year files without the matching hash and thatensure_datasetsregenerates them (1e8b78986).docs/microsim.mddefines flat year files and describes the same check and regeneration.New tests in
47eb2d63fcover a flat year file with a stale or missing hash after the bundle pins two same-stem keys to one SHA-256, a pin change that keeps a same-stem artifact’s URI, a download whose bytes do not match the bundle SHA-256 for its URI, the order in whichcreate_datasetsmaterializes sources, and relative and absolute spellings of one local file. Another checks thatcreate_datasetsrefuses a batch of two URIs whose files share a stem before it downloads either. The batch refusal test now runscreate_datasets,load_datasetsandensure_datasets, and the recertification warning test renames keys in both directions.Accept
--data-producer microcosminscripts/bundle.py certify-dataandscripts/certify_data_release.pyas an alias forpopulace, and use it in the two US commands indocs/engineering/skills/data-certification.md. Either spelling recordspopulaceas the producer and keeps the release’s published dataset names in certification summaries, generated changelog fragments and bundle records. UK examples still pass--data-producer populace, the producer that the UK release metadata records. Recertification now applies the same alias fallback when it checks which previously certified selectors still resolve through the new release or the bundle’s dataset overlays. It no longer warns about a Populace selector that resolves to a Microcosm key (ddac5afc9).Correct the US certification examples and the microsimulation guide (
ada238e06):docs/bundles.md,docs/release-bundles.mdanddocs/engineering/runbooks/build-m-us-populace-certification.mdnow certify a national build and an ACS-local build thatreleases.jsonlists. The old commands used tag-based manifest paths, which the CLI refuses once the repository has areleases.jsonindex, and one omitted--data-producer, which selects the unsupported legacy producer for the US. The commands now pin the commit that published each build, read the manifest from that build’s own release folder and pass--data-producer microcosm. Thebuild-m-us-populace-certification.mdrunbook now says state and congressional-district simulations use the ACS-local release through the bundle’s regional routes, not the national release, and it names the changelog fragment after the national build.docs/bundles.mdalso puts the UK example’s manifest URI in double quotes, so the shell does not read the<and>around its<release>placeholders as redirections.docs/engineering/runbooks/canonical-spm-development.mdadds--regional-manifest-urito its certification command, because certification refuses a national-only run while the bundle routes regions.docs/microsim.mdseparates the source check against the bundle SHA-256 from the checks on derived year files. It describesload_datasetsas loading the default dataset’s current year files, and its local-area examples use the registered keypopulace_us_2024_acs_local.#786 tracks two follow-ups: matching a bare
hf://URI with its@mainspelling, and a year-file stamp revision bump.Verification
py_compile,git diff --check,ruff format --check,ruff check); CI runs the test matrix and the documentation build at the head. The runs below predate47eb2d63fand1e8b78986, so none of them covers the code or tests that47eb2d63fadds.646963a39, this PR’s first commit, the three test files this PR changes recorded 123 passed. With those files taken fromcdb13de60, 127 passed and 16 failed at646963a39, and all 143 passed atcdb13de60. Five further checks of the documentation wording, run outside the test suite, failed at646963a39and passed atcdb13de60.cdb13de60with the new same-stem and recertification tests copied in, six test files covering year files, dataset materialization, certification and release manifests recorded 333 passed and 8 failed:test_us_year_file_stamp.py,test_dataset_materialization.py,test_certify_data_release.py,test_release_manifests.py,test_local_data_manifest.pyandtest_us_legacy_spm_integration.py. The failures were six national and ACS-local same-stem year-file cases intest_us_legacy_spm_integration.pyand two recertification warning cases intest_certify_data_release.py. Ated22ad6d3, all 341 cases in those files passed.ed22ad6d3, the remaining 138 of the 144 test files recorded 4,599 passed, none failed and 20 skipped. The skipped cases need unpublished or credentialed inputs, opt-in local setups, other package versions, or Python before 3.14. The passes include the fourtest_preparation_generates_new_sidecars_and_verifies_the_exact_paircases, which ran against a local not-found response instead of a request to a Hugging Face index that needs a credential. Without that credential they fail at that request; this PR does not change that test.releases.jsonand release-manifest fixtures, the five US certification commands in the four certification documents failed atcdb13de60. Ated22ad6d3,docs/release-bundles.mdhas one US command where it had two, and all four commands passed. All 27 Bash blocks in the four certification documents thatada238e06changes passedbash -nated22ad6d3.ed22ad6d3, Ruff 0.17.6 lint and format checks (the unpinned release CI installs),scripts/bundle.py checkandgit diff --checkpassed, andgit merge-treereported no conflicts with main atddfef2a8e.test_the_certified_dataset_projects_to_2030, which needs a certified UK dataset the run could not download.705324d8fchanges only spelling (artifact, materialize, re-normalizes) indocs/microsim.md, the US certification runbook and two comments inus/datasets.py, so the results ated22ad6d3hold for it.Related to #490, the issue on adopting Microcosm naming.
axiom: n/a: dataset selection, US year-file caching and certification inputs; no policy-rule changes.
🤖 Generated with Claude Code