Skip to content

Name the build for the collector in UK staged-bundle hand-overs - #1588

Merged
anth-volk merged 8 commits into
mainfrom
claude/staged-bundles-name-their-build
Nov 12, 2026
Merged

anth-volk merged 8 commits into
mainfrom
claude/staged-bundles-name-their-build

Conversation

@anth-volk

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

Copy link
Copy Markdown
Contributor

Fixes #1587 (in part: the staging hand-overs; see "What this does not do")

What this changes

UK builds, and the re-stage command tools/stage_uk_rowwise_candidate.py, now hand their staged dataset bundle to the emitter with the interface's CollectorProvenance. Copied-back Modal runs (#1499) go through the re-stage command, so they do too. With the provenance, the emitter submits the bundle's calibration diagnostics to the collector once the bundle's Hugging Face commit lands, while its collector submissions are on.

Field Value
country_code UK. Staging telemetry registers UK runs as GB, but the collector's calibration tree handler knows the country as UK and builds no tree from a submission naming another code. Its Orrery graph handler records whatever code it is given.
build_id The build's attempt ID, which a release build keeps as its folder name, even under --staging-run-id. The build passes its attempt ID. The re-stage command takes the manifest's build_id (national builds record it), else the release_id the registered local gate report records (dense builds, as the dense release assembler reads it), else --build-id (which may not contradict either), else the one build the Logbook rows name, else the run ID with a note. Rows that name more than one build stop it before it starts an emitter. Without --run-id, it stages the bundle under the run ID of the manifest's staged record, else the one staged_manifest.json records, else the same build ID.
licensed_data true: every UK staged bundle holds licensed microdata.
release The manifest's release_id when it is the national or dense release (microcosm-uk-2024-25-national, microcosm-uk-2024-25-dense), and null otherwise, as decided on PolicyEngine/microcosm-collector#42. Every national and dense build records its role's release, whether or not it is fit to release, so null comes only from older or other manifests.
  • microcosm.build.staging_dataset: bundle_request and stage_bundle take an optional collector. Without it, the request and its hand-over ID are unchanged.
  • microcosm.build.uk_runtime.rowwise_staging: collector_provenance(manifest, build_id=...), and a required build_id argument for stage_dataset. The full-build driver passes its attempt ID at both of its staging calls. If the interface refuses a build ID, the build warns and hands the bundle over without provenance. Staging never stops a finished build.
  • The re-stage command builds the same provenance before it starts an emitter, and gains --build-id. If the interface refuses the build ID, or the Logbook rows name more than one build, the command stops there. A hand-over it resumes keeps whatever the build named.
  • docs/uk-staging-operations.md describes the fields. The changelog entry is changelog.d/1587-staged-bundles-name-their-build.added.md.

The failure-evidence bundle (orrery_publication.stage_graph_evidence) holds no calibration diagnostics, so it still names no build. UK Orrery inputs are a separate task.

What this does not do, and what it waits for

The released emitter (0.14.0, Microcosm's minimum and the newest release) does three things that block the rest:

  1. No interface release can switch collector submissions on. The emitter's Hugging Face module reads collector_submissions, off by default, and HuggingFaceSettings cannot set it. Until an emitter release can, the emitter ignores the provenance this PR adds. Bundles still go to Hugging Face exactly as before. Microcosm sets only a minimum emitter version, so an emitter release that switched submissions on by default would start them with no Microcosm change.
  2. Nothing is submitted at release. PublishRelease has no provenance, and the emitter submits only after a staged-bundle commit. Release submissions need an emitter release that submits after a release commit (folder releases/<release>/<build>).
  3. Refused collector settings leave the submission receipt empty, as if submissions were off (Choose the collector origin in one place, from a fixed set of trusted origins microcosm-emitter#29's review). They should give a skipped receipt with an error code.

All three are PolicyEngine/microcosm-emitter#92 (tracker 2h · 1). A later Microcosm PR (tracker 3a · 2) then switches submissions on, passes provenance at release, raises MINIMUM_EMITTER_VERSION and reads the collector receipt; it needs that emitter release. The tracker has this PR wait for 2h · 1. In code it can merge on its own: with the released emitter it changes no upload. Adding a collector block changes a bundle's hand-over ID. A re-stage resumes a recorded hand-over by its recorded ID, so a bundle handed over before the merge is still found.

Tests

Red-green.

  • Change: failing commit 8e7ae16ab (9 cases, all AssertionError: the hand-over named no build), passing commit 2a36137e1.
  • Round 1 fix: failing commit 76b2cb088 (3 cases fail on assertions; 3 more pin the refusal and warning paths, which already worked), passing commit cb7bbf42a.
  • Round 2 fix: failing commit 96c55886a (2 cases fail on assertions; 4 more cover the fall-through and the note), passing commit 6e7a62f2b.
  • Round 3 fix: failing commit b016de12f (2 cases fail on assertions; 1 more covers a --build-id equal to the recorded one), passing commit 69817d31b.

New or changed tests:

  • tests/engine_free/uk/test_uk_full_build_cli.py::test_a_staged_dense_bundle_names_its_build_and_candidate_release_for_the_collector: a dense build under --staging-run-id names its attempt ID.
  • …::test_the_restage_tool_names_a_national_build_and_its_release_for_the_collector, …::test_the_restage_tool_takes_a_dense_build_id_from_its_logbook_row, and …::test_the_restage_tool_names_no_release_a_uk_build_cannot_publish_into (no release, a tagged release, and another country's release).
  • tests/engine_free/uk/test_uk_rowwise_national_role.py::test_restaging_a_national_build_records_the_bundle_its_emitter_delivered: the national build's queued hand-over.
  • tests/engine_free/uk/test_uk_modal_copy_back_staging.py::test_copied_back_outputs_are_handed_over_as_a_local_build_is_restaged.

Run locally by node ID, at 69817d31b: 69 node IDs (109 cases) and the installed-emitter test below, all passing. They include:

  • the 24 new or changed cases, among them the round 1 tests test_the_restage_tool_takes_a_dense_build_id_from_its_gate_report, …_refuses_logbook_rows_that_name_two_builds, …_names_the_build_given_with_build_id, …_refuses_a_build_id_before_starting_an_emitter and test_a_build_id_the_interface_refuses_leaves_the_bundle_unnamed_with_a_warning;
  • 57 existing tests that run the hand-over, the re-stage command, the national and dense staging, Modal copy-back and graph-evidence staging (94 cases with their parameters);
  • tests/installed_emitter/shared/test_installed_emitter_staging.py::test_a_modal_runs_copied_back_outputs_are_staged_by_the_re_stage_command with --run-integration, against an installed microcosm-emitter==0.14.0.

All pass. Ruff check and format are clean on the changed files.

Review

  • Round 1 (2a36137e1), microcosm-1588-review-round1-2026-11-12.md in the review handoffs folder: one medium bug, fixed test-first. For a dense build, the re-stage command took the build ID from whichever Logbook row file sorted last; the spool names rows by digest, and a retried output directory keeps an earlier attempt's row. Code-quality points taken: the country-code explanation, the minimum-only emitter version, tests for the refusal and warning paths, a required build_id, and the wording of release. One point is outside this PR: the collector's past-build reconstruction files UK Orrery inputs as GB, while this PR's provenance says UK. That matters for the Orrery task that follows.
  • Round 2 (cb7bbf42a), microcosm-1588-review-round2-2026-11-12.md: no high- or medium-priority bugs. One low bug, fixed test-first: without --run-id or a staged record, the run ID still came from whichever Logbook row sorted last. Code-quality points taken: one function for the attempt a directory records, --build-id checked against it, the changelog and help text, and tests for an unusable gate report and the run-ID note. Not taken: refusing the placeholder unbound-uk-dense-attempt in a gate report, which only tests produce.
  • Round 3 (6e7a62f2b), microcosm-1588-review-round3-2026-11-12.md: no high- or medium-priority bugs. One low bug, which was not a regression, fixed test-first: a build staged under --staging-run-id and interrupted before its manifest gained a staged record was re-staged under its attempt ID; the run ID now comes from staged_manifest.json first. Also taken: the refusal names --run-id for --local-only, help and guide wording, and tests for the --local-only refusal and an equal --build-id. Not taken: resolving the build ID once instead of twice (the second resolution gives the same answer), and comparing --build-id with the Logbook rows (the option exists for when the rows can't decide).

🤖 Generated with Claude Code

anth-volk and others added 4 commits November 12, 2026 19:06
The UK dense and national builds, the re-stage command and a Modal
copy-back hand their staged bundle over with CollectorProvenance: country
UK, the build's attempt ID, licensed data and the candidate release from
the manifest's release_id (none for a release that does not publish into
build folders).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UK builds and the re-stage command hand their staged bundle over with
CollectorProvenance: country UK, the build's attempt ID, licensed data
and the candidate release from the manifest's release_id (the national
or dense release, else none). The emitter submits the bundle's
calibration diagnostics from it once the commit lands, while its
collector submissions are on, which no emitter release Microcosm
accepts can switch on yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A dense build's ID comes from its registered local gate report, Logbook
rows that name two builds are refused before an emitter starts unless
--build-id names one, and the refusal and warning paths for a build ID
the interface does not accept are covered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round 1's finding: the re-stage command took a dense build's ID from
whichever Logbook row sorted last, and the spool names rows by digest.
It now reads the release_id the registered local gate report records,
refuses rows that name more than one build unless --build-id names it,
and notes when it falls back to the run ID. stage_dataset requires the
build ID, and the docs say how the country code, the release and the
minimum emitter version behave.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk and others added 4 commits November 12, 2026 20:04
A retried directory with no staged record is staged under the build it
records, --build-id may not contradict a recorded build ID, an unusable
gate report leaves the build ID to the Logbook row, and the note for a
build named by its run ID is printed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round 2's low-priority finding: without --run-id or a staged record, the
re-stage command still took the run ID from whichever Logbook row sorted
last. One function now works out the attempt the directory records, and
both the run ID default and the collector build ID use it; --build-id
may not contradict a recorded build ID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A re-stage without --run-id keeps the staging run ID the sidecar
records, the refusal for ambiguous Logbook rows names --run-id as well,
and a --build-id equal to the recorded build ID is accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round 3's low-priority finding: a build staged under --staging-run-id
and interrupted before its manifest gained a staged record was
re-staged under its attempt ID. Without --run-id the command now takes
the run ID from the staged record, then staged_manifest.json, then the
build ID. The refusal for ambiguous rows names --run-id too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anth-volk
anth-volk marked this pull request as ready for review November 12, 2026 20:21
@anth-volk
anth-volk merged commit 89e12fb into main Nov 12, 2026
12 checks passed
@anth-volk
anth-volk deleted the claude/staged-bundles-name-their-build branch November 12, 2026 20:23
MaxGhenis added a commit that referenced this pull request Nov 13, 2026
…and #1600

Main gained #1588, #1285, #1582, #1532 and #1600 since the last merge
(c93419c). One file conflicts, tools/build_us_fiscal_refresh_release.py,
in its import block: #1532 widened the input_mass import to four names,
right below this branch's immigration import. The merge keeps both.

No function is changed by both sides in that tool or in
test_us_fiscal_refresh_builder.py (syntax-tree comparison against the merge
base), and each side's changed functions carry over whole. Neither
tools/repin_us_spec_engine_contracts.py --check nor
tools/spec_engine_coverage.py --check moves a pin on the merged tree.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.

Builds submit calibration diagnostics to the collector at staging and at release

1 participant