Repository navigation
Name the build for the collector in UK staged-bundle hand-overs - #1588
Merged
Merged
Conversation
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>
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
marked this pull request as ready for review
November 12, 2026 20:21
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>
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.
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'sCollectorProvenance. 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.country_codeUK. Staging telemetry registers UK runs asGB, but the collector's calibration tree handler knows the country asUKand builds no tree from a submission naming another code. Its Orrery graph handler records whatever code it is given.build_id--staging-run-id. The build passes its attempt ID. The re-stage command takes the manifest'sbuild_id(national builds record it), else therelease_idthe 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 onestaged_manifest.jsonrecords, else the same build ID.licensed_datatrue: every UK staged bundle holds licensed microdata.releaserelease_idwhen it is the national or dense release (microcosm-uk-2024-25-national,microcosm-uk-2024-25-dense), andnullotherwise, 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, sonullcomes only from older or other manifests.microcosm.build.staging_dataset:bundle_requestandstage_bundletake an optionalcollector. Without it, the request and its hand-over ID are unchanged.microcosm.build.uk_runtime.rowwise_staging:collector_provenance(manifest, build_id=...), and a requiredbuild_idargument forstage_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.--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.mddescribes the fields. The changelog entry ischangelog.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:
collector_submissions, off by default, andHuggingFaceSettingscannot 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.PublishReleasehas no provenance, and the emitter submits only after a staged-bundle commit. Release submissions need an emitter release that submits after a release commit (folderreleases/<release>/<build>).skippedreceipt 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_VERSIONand 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 acollectorblock 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.
8e7ae16ab(9 cases, allAssertionError: the hand-over named no build), passing commit2a36137e1.76b2cb088(3 cases fail on assertions; 3 more pin the refusal and warning paths, which already worked), passing commitcb7bbf42a.96c55886a(2 cases fail on assertions; 4 more cover the fall-through and the note), passing commit6e7a62f2b.b016de12f(2 cases fail on assertions; 1 more covers a--build-idequal to the recorded one), passing commit69817d31b.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-idnames 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: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_emitterandtest_a_build_id_the_interface_refuses_leaves_the_bundle_unnamed_with_a_warning;tests/installed_emitter/shared/test_installed_emitter_staging.py::test_a_modal_runs_copied_back_outputs_are_staged_by_the_re_stage_commandwith--run-integration, against an installedmicrocosm-emitter==0.14.0.All pass. Ruff check and format are clean on the changed files.
Review
2a36137e1),microcosm-1588-review-round1-2026-11-12.mdin 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 requiredbuild_id, and the wording ofrelease. One point is outside this PR: the collector's past-build reconstruction files UK Orrery inputs asGB, while this PR's provenance saysUK. That matters for the Orrery task that follows.cb7bbf42a),microcosm-1588-review-round2-2026-11-12.md: no high- or medium-priority bugs. One low bug, fixed test-first: without--run-idor 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-idchecked against it, the changelog and help text, and tests for an unusable gate report and the run-ID note. Not taken: refusing the placeholderunbound-uk-dense-attemptin a gate report, which only tests produce.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-idand interrupted before its manifest gained a staged record was re-staged under its attempt ID; the run ID now comes fromstaged_manifest.jsonfirst. Also taken: the refusal names--run-idfor--local-only, help and guide wording, and tests for the--local-onlyrefusal 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-idwith the Logbook rows (the option exists for when the rows can't decide).🤖 Generated with Claude Code