Skip to content

Stop reading and writing latest.json pointer files - #1795

Draft
anth-volk wants to merge 12 commits into
mainfrom
claude/stop-reading-latest-pointer-files
Draft

anth-volk wants to merge 12 commits into
mainfrom
claude/stop-reading-latest-pointer-files

Conversation

@anth-volk

@anth-volk anth-volk commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1794. Tracker task 5b · 12 ("Microcosm: Stop reading and writing latest.json pointer files") of the collector/emitter project.

What this does

Every release repository lists its builds in releases.json, and each repository's switch deleted its latest*.json pointer files: UK and US in November, BE on 2026-11-26. This PR removes what still read those files or wrote them, and moves the AM and NZ release contracts to build folders and releases.json.

Nothing that loads an older build needs a pointer file.

  • The loader has no revision argument, and build= pins only a build that releases.json lists.
  • policyengine.py pins each Microcosm file by its full path at a commit or tag (src/policyengine/data/bundle/manifest.json); it reads no pointer file and imports no pointer reader.
  • The UK and US switches kept every tag, so a tagged build stays readable by path at its tag.
  • One caller outside this repository uses a removed name: PolicyEngine/bottom-50-tax-analysis calls microcosm.data.release.latest_release for a provenance ID before load("us", 2024). That call already fails, because the US repository has no latest.json (Hugging Face answered 404 on 2026-11-27); after this PR it fails at import instead. GitHub code search finds no other use of latest_release, latest_line_release, latest_evidence_release, LatestPointer or unverified_root outside this repository.

Changes:

  • Loader (microcosm.data.loader): reads every entry through releases.json.
    • A repository without it is refused, naming the file. When offline, a record that was never cached is refused too.
    • Any other failure to read the record propagates, as before.
    • Removed: the pointer fallback, the checks only tagged manifests needed, and load(unverified_root=True). No repository holds a root dataset file.
    • CertifiedRelease keeps its fields so callers don't change; artifact_revision is now always None.
  • Registry: DatasetSpec has no pointer_path, and release is required.
  • microcosm.data.release: removes latest_release, latest_line_release, latest_evidence_release (nothing called it), LatestPointer, line_pointer_path, line_pointer_payload, LINE_POINTER_PATH_TEMPLATE and RELEASE_TIER_CERTIFIED. With the tagged publisher gone (5b · 10, Remove the tagged publisher, microcosm-publish-release #1797), it also removes the pointer writers that publisher used: latest_pointer_payload, latest_evidence_pointer_payload, LATEST_POINTER_PATH, LATEST_EVIDENCE_POINTER_PATH, LATEST_POINTER_SCHEMA_VERSION and RELEASE_TIER_EVIDENCE. Neither microcosm.data nor microcosm.data.release has any pointer name left.
  • microcosm.data.contract: removes line_for_release_id, dataset_role_for_line and the per-build tag pattern, which only pointer-file code used. The fixture generator's C1 inventory loses its line field; the C1 and C5 fixtures are regenerated.
  • microcosm-publish-release-build: keeps its check for pointer files. The emitter refuses only a change of a release's current build while one exists, so this check is the only refusal for a publication without --make-current. It is now one message for any repository, with or without releases.json: remove the file.
  • AM's and NZ's release contracts follow BE's:
    • boundary.public lists releases.json instead of latest.json;
    • the policy says builds go into releases/<release>/<build>/ folders that releases.json lists, replacing "data_build_id plus Hugging Face revision";
    • the notes use BE's sentence on releases.json. NZ's sentence that the dashboard reads populace-nz/latest.json was out of date: the calibration diagnostics dashboard names no NZ or AM repository and reads no latest.json.
    • The golden country specs change only in each contract's digest and the spec fingerprint.
  • Docs and changelog: README, microcosm-data's README, the agent guide, docs/release-contract.md, and changelog.d/1794-stop-reading-latest-pointer-files.removed.md.

What this builds on

Commits

  • dbbc5f483 adds the tests, which failed before the change: 32 failing on assertions, run individually.
    • The new packages/microcosm-data/tests/engine_free/shared/test_no_pointer_files.py. Its two loader tests failed because the loader followed a pointer file and succeeded.
    • The AM and NZ contract test in test_country_spec.py.
    • Two fixture tests in test_release_contract_fixtures.py.
    • The refusal test in test_uk_release_publication.py.
  • 2ad51bfea merges 5b · 11's branch. The one conflict, in that refusal test, keeps this PR's expectations plus Remove the build-folder switch tool now that every release repository has moved #1793's checks that no tool command is named.
  • 0dc0dddda is the change.
    • Tests that read pointer files are removed. So are four tagged-publisher tests that read back what they published through latest_release; 5b · 10 removed the rest of that publisher's tests.
    • The loader checks those tests covered now run against build folders: a missing manifest, engine incompatibility, construction after verification, and a Hub failure reading releases.json.
    • The live loader test reads releases.json.
  • 5ee94414c merges main, to resolve conflicts in docs/release-contract.md (main replaced the UK-cut-runner gap with the .py certification tool's; the pointer-readers gap goes) and in the NZ golden spec (regenerated from the merged sources). The release-contract fixtures still reproduce (--check).
  • e7dbcaf10 fixes review round 1 (below).
  • 5752caec7 adds a test that DatasetSpec takes release by keyword, which failed on its assertion. 9f9cb4aa8 makes it pass and addresses round 2's other points (below).
  • 4d8776890 addresses round 3's points (below).
  • ed78493fd merges main, with 5b · 10's removal of the tagged publisher. Seven files conflicted:
    • In microcosm.data.release, microcosm.data's exports, the release tests and their helpers, main had removed the tagged publisher and this branch the pointer readers, so neither side's names stay. The six pointer-writer names go too, with the tests that only they used.
    • The publication command's docstring, the agent guide and docs/release-contract.md keep this branch's account of the pointer files and main's account of the tagged publisher's removal. The text main added about the pointer readers and line_for_release_id goes, since this PR removes them.
    • Also updated: the ruff configuration comment on release.py's pointer readers, and a test-helper comment on how the tagged publisher handled evidence releases.
    • The release-contract fixtures still reproduce (--check).
  • d2a6621e2 removes the six expected-failure marks.

Not changed

  • Dated history notes, such as the NZ and BE integrity_note saying which tag latest.json named on 2026-08-29.
  • Comments in producer files that builds record by hash (source_enrichment.py, tools/build_us_acs_donor_receipt_qualification.py). This avoids changing their bytes for prose alone. contract.py is in those lists too and changes here, as it does in most PRs.
  • changelog.d/, PROGRESS*.md and experiments/ are history.
  • Outside this repository, microcosm-collector's calibration-tree country settings still name latest.json and latest-national.json as pointer files.

Merge waits for

Review

Round 1, at 5ee94414c (three bugs, all fixed in e7dbcaf10; all three were in tests or in how CI reports, so there is no separate failing-test commit):

  • High: three tests still passed the removed expected_revision keyword to the loader's manifest check, so each raised TypeError.
  • Medium: test_declared_range_certifies_a_later_patch_for_both_readers gave the loader's package-certification reader a tagged-layout manifest. It now rewrites the manifest with the builders' build_folder_release_manifest first.
  • Medium: the six expected failures would have stopped CI's engine-free job early. They are now strict expected failures.
  • Also fixed: the live-load helper's offline check follows the loader's refusal to its cause, so an offline run of the US engine test still skips. Out-of-date text is fixed in the ruff configuration comment, the Armenia notes, the UK staging operations guide and two release-contract sentences.
  • Not changed:
    • The wording "Microcosm neither reads nor writes pointer files", and the changelog's list of removed names, were accurate only once 5b · 10's removal of the tagged publisher was merged in. They were re-checked after the merge at ed78493fd and are accurate now.
    • Two removed tagged-publisher tests also checked that a second publication reuses its tag in one commit. 5b · 10 removed that publisher.
    • CertifiedRelease.build and artifact_revision keep their optional types, as agreed, so existing callers don't change.

Round 2, at e7dbcaf10: no bugs. It confirmed round 1's fixes. Its code-quality points were addressed in 5752caec7 (test) and 9f9cb4aa8:

  • DatasetSpec.release is keyword-only, so variant keeps its position as the eighth positional argument.
  • Text fixes:
    • docs/release-contract.md C2 says the loader's certification reader reads only a build-folder manifest's top level, and its M1 row no longer says "where the repository has one";
    • DatasetSpec.hf_url's docstring says the URL is at the repository's root;
    • the tagged publisher's docstring says every release repository has releases.json;
    • two tools' help texts name the current build in releases.json instead of "HF latest";
    • the changelog names the outside caller.
  • The live-load helpers' offline check follows each cause once, so a cycle of causes cannot make it recurse until Python's recursion limit.
  • Not changed: the source-enrichment test still rewrites a tagged manifest with the builders' own build_folder_release_manifest, the function production uses, instead of certifying a build-folder candidate.

Round 3, at 9f9cb4aa8, was the last round. It found no bugs, and confirmed the keyword-only field on every declared Python version (3.11 and up), the C5 snapshot, and that every loader entry point goes through the same refusal. No caller in tools/ or packages/*/src catches the old EntryNotFoundError; the UK reference tool and run_uk_cut now report the new ValueError as a refusal. Its code-quality points were addressed in 4d8776890:

  • The refusal of a repository without releases.json says to check the registry entry's repository, and how to read a build published before its repository switched (by path at its tag).
  • The Raises sections of resolve_certified, download_certified and load list the refusal.
  • The offline check is one check applied to the exception and each cause once, kept in one copy in test_support.
  • The keyword-only comment says only that variant keeps its position.

No bugs are left open after the three rounds.

🤖 Generated with Claude Code

anth-volk and others added 12 commits November 27, 2026 17:19
Three failing tests for removing microcosm.build.build_folder_switch:
the module cannot be found; no package source or test, shared test
support, tool, doc or README names it; and the refusal for a
repository with pointer files and no releases.json names no tool or
step to run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The US, UK and BE release repositories have all moved to build folders
and releases.json and had their old layout deleted, so the one-time
tool has nothing left to move. Remove microcosm.build.build_folder_switch
(copy, switch and delete-old-layout), its three test modules and their
in-memory Hub helper.

The refusal for a repository with pointer files and no releases.json no
longer names the tool or its steps. The fixture generator's docstring,
the README, docs/release-contract.md and three microcosm-data mentions
of delete-old-layout describe the move in the past tense. What moved
builds' manifests carry (migrated_from, unpublished_artifacts) stays
documented and accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every release repository lists its builds in releases.json, and each
repository's switch deleted its latest*.json pointer files. These tests
fail before the change, 32 of them on assertions:

- DatasetSpec has no pointer_path and must name its release;
- microcosm.data and microcosm.data.release export no pointer reader,
  writer or constant, and keep no private pointer reader;
- microcosm.data.contract keeps no rules for latest-<line>.json names
  and their tags;
- load() has no unverified_root option;
- the loader refuses a repository without releases.json, online and
  offline, and requests no pointer file (today it follows latest.json);
- AM's and NZ's release contracts name build folders and releases.json,
  not latest.json or a Hugging Face revision;
- the C1 inventory fixture has no line field, and the C5 registry
  snapshot names no pointer file;
- the emitter publishing command refuses pointer files in a repository
  without releases.json with the same advice to remove them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch builds on 5b · 11's removal of the build-folder switch tool,
which changes the same refusal, README and release-contract paragraphs.

# Conflicts:
#	packages/microcosm-build/tests/engine_free/uk/test_uk_release_publication.py
…ases.json (#1794)

Every release repository lists its builds in releases.json, and each
repository's switch deleted its latest*.json pointer files.

- Loader: reads every entry through releases.json and refuses a
  repository without it, online and offline (when the cache never held
  it), naming the file; any other failure to read it propagates. The
  pointer fallback, the tagged-manifest checks and load(unverified_root=)
  are gone. CertifiedRelease keeps its fields; artifact_revision is
  always None.
- Registry: DatasetSpec has no pointer_path and must name its release.
- microcosm.data.release: latest_release, latest_line_release,
  latest_evidence_release, LatestPointer, line_pointer_path,
  line_pointer_payload, LINE_POINTER_PATH_TEMPLATE and
  RELEASE_TIER_CERTIFIED are gone, and microcosm.data exports no pointer
  name. The tagged publisher's own pointer writers (LATEST_POINTER_PATH,
  LATEST_EVIDENCE_POINTER_PATH, LATEST_POINTER_SCHEMA_VERSION,
  RELEASE_TIER_EVIDENCE, latest_pointer_payload and
  latest_evidence_pointer_payload) stay until 5b · 10 removes
  publish_release, their only caller.
- microcosm.data.contract: line_for_release_id, dataset_role_for_line
  and the per-build tag pattern are gone; the fixture generator's C1
  inventory has no line field.
- release_publication: one refusal for a pointer file in any repository,
  with or without releases.json: remove it.
- AM's and NZ's release contracts name build folders and releases.json,
  as BE's does; their golden specs pin the new digests.
- Tests: the pointer-reader and line-pointer tests go; the loader checks
  they covered (a missing manifest, engine incompatibility, construction
  after verification, a Hub failure reading the record) run against build
  folders; the live loader test reads releases.json.
- Docs and changelog: README, microcosm-data's README, the agent guide
  and docs/release-contract.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub reported conflicts with main. Two files conflicted:

- docs/release-contract.md: main replaced the UK cut runner gap with the
  policyengine.py certification tool's; the pointer-readers gap goes, as
  this branch removes the readers.
- tests/golden/nz_country_spec.json: main changed NZ's package; the file
  is regenerated from the merged sources, with this branch's NZ release
  contract digest.

The release-contract fixtures still reproduce (--check).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 found three bugs, all in tests or CI behaviour:

- High: three tests still passed the removed expected_revision keyword to
  the loader's manifest check (two in test_release_contract_fixtures,
  one in test_release_contract_fixture_generation), so each raised
  TypeError. The keyword is gone.
- Medium: test_declared_range_certifies_a_later_patch_for_both_readers
  handed the loader's package-certification reader a tagged-layout
  manifest; the loader now reads only build folders, so the test
  rewrites the manifest with the builders' own
  build_folder_release_manifest first.
- Medium: the six cases of the export test for names the tagged
  publisher still uses failed on purpose, and the engine-free job stops
  at its first failure. They are now strict expected failures, so CI
  reports the rest, and the marks must go when the names do.

Also from the review: the live-load helper's offline check follows the
loader's refusal to its cause, so an offline US engine run still skips;
the ruff configuration comment, the Armenia notes, the UK staging
operations guide and two release-contract sentences no longer describe
pointer files or the loader reading tagged builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 2 noted that making release a required field moved it in
front of variant, so a caller passing variant as the eighth positional
argument would set release instead. The test fails on its assertion:
the eighth positional field is release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 2 found no bugs. From its code-quality points:

- DatasetSpec.release is keyword-only, so variant keeps its position as
  the eighth positional argument (the test in 5752cae fails before).
- docs/release-contract.md: C2 says the loader's certification reader
  reads a build-folder manifest's top level only, and the M1 row no
  longer says "where the repository has one".
- DatasetSpec.hf_url's docstring says it names the root URL, which no
  repository holds a dataset at, for messages.
- The tagged publisher's docstring says every release repository has
  releases.json, not only the UK and US ones.
- The --base-h5 and --h5 help texts of build_us_fiscal_refresh_release
  and score_us_fiscal_targets name the current build in releases.json
  instead of "HF latest".
- The offline check in both live-load helpers follows each cause once,
  so a cause cycle ends.
- The changelog fragment names the one caller found outside this
  repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 3 found no bugs. From its code-quality points:

- The loader's refusal of a repository without releases.json says what
  to check (the registry entry's repository) and how a build published
  before its repository switched is read (by path at its tag), and the
  Raises sections of resolve_certified, download_certified and load list
  it.
- The live-load helpers' offline check is one check applied to the
  exception and each cause once, kept in test_support's loader module;
  the engine-free loader tests import it instead of keeping a copy.
- The registry comment and the keyword-only test say only that variant
  stays the eighth positional argument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ile removal (#1794)

main removed the tagged publisher and this branch removed the pointer-file
readers, so in microcosm.data.release, microcosm.data's exports, the release
tests and their helpers neither side's names stay. With publish_release gone,
nothing calls the pointer writers either, so they go in the resolution:
latest_pointer_payload, latest_evidence_pointer_payload, LATEST_POINTER_PATH,
LATEST_EVIDENCE_POINTER_PATH, LATEST_POINTER_SCHEMA_VERSION and
RELEASE_TIER_EVIDENCE, with the tests and the comment that only they used.

The publication command's docstring, the agent guide and
docs/release-contract.md keep this branch's account of the pointer files and
main's account of the tagged publisher's removal. The text main added on the
pointer readers and on line_for_release_id goes, since this branch removes
them, as does the ruff configuration comment on release.py's pointer readers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The six cases of test_microcosm_data_exports_no_pointer_file_reader_or_writer
that waited for publish_release were strict expected failures. The merge of
main removed the names, so the cases pass and the marks go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop reading and writing latest.json pointer files

1 participant