Skip to content

Remove the build-folder switch tool now that every release repository has moved - #1793

Draft
anth-volk wants to merge 7 commits into
mainfrom
claude/remove-build-folder-switch
Draft

anth-volk wants to merge 7 commits into
mainfrom
claude/remove-build-folder-switch

Conversation

@anth-volk

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

Copy link
Copy Markdown
Contributor

Fixes #1792

What this changes

Microcosm no longer has the one-time build-folder switch tool, microcosm.build.build_folder_switch, with its copy, switch and delete-old-layout steps. The tool moved a dataset repository's builds into build folders listed in releases.json: the US and UK builds from tags, and BE's from untagged folders on main. It deleted each repository's latest*.json pointer files, and later deleted the old layout's files from main. All three repositories have moved and had their old layout deleted, BE's last on 2026-11-27. AM and NZ have no Hugging Face repository yet. The tool was kept only until BE had moved, as a temporary exception for operator tools that use the operator's own Hugging Face token (tracker 4a · 21).

Removed

  • packages/microcosm-build/src/microcosm/build/build_folder_switch.py. No pyproject.toml declared an entry point for it; it ran only as python -m.
  • Its three test modules: tests/engine_free/uk/test_build_folder_switch.py, tests/engine_free/us/test_us_build_folder_switch.py and tests/engine_free/shared/test_untagged_build_folder_switch.py.
  • Their in-memory Hub, test_support/microcosm_build/build_folder_switch.py, which nothing else used.
  • The root pyproject.toml's exemption of the module from ruff's rule against importing huggingface_hub (TID251), which Publish run_uk_cut.py builds through the emitter and refuse new direct Hugging Face imports #1743 added on main. Remove the tagged publisher, microcosm-publish-release #1797 has since moved microcosm.data.release's exemption into the datasets group, so this PR leaves that one as main has it.

Reworded

  • The refusal in release_publication.py. For a repository that has pointer files and no releases.json, microcosm-publish-release-build still refuses before any emitter starts and still says to keep the files in place. It no longer tells the operator to run the tool's copy and switch steps. The rest of the wording is unchanged; the separate task that removes pointer-file support decides whether this refusal stays. The module and function docstrings no longer say the switch reads the pointer files.
  • tools/generate_release_contract_fixtures.py. Its docstring named the tool's _switch_record as the step that sets default. It now says the tool took that step once. The generator imported nothing from the tool, and its fixtures are unchanged.
  • The README's "The switch" section. The section held the three commands and about 90 lines on their options. It is now one past-tense paragraph: how each repository moved, that the tool's last version is in Git history at d3b7f4b4a, and what moved builds' manifests carry.
  • docs/release-contract.md. Its C1 and C5 passages describe the tool in the past tense, and say it was a fourth reader of pointer files. The gap entry on releases.json's default now says that nothing in Microcosm sets it in a live record, including for a new repository such as AM's or NZ's. The tool was its only writer; the fixture generator sets it only in the C5 golden records, and no loader reads it.
  • microcosm-data. Three present-tense mentions of the delete-old-layout step are now past tense: in packages/microcosm-data/README.md, the registry.py docstring and the test_examples_read_build_folders.py docstring.
  • Changelog. changelog.d/1792-remove-build-folder-switch.removed.md.

Kept

  • microcosm.data.build_folder_manifests (rewrite_release_dir, referenced_build, publication_commands, require_offered_build). The builders use it, and the tool never imported it; the tool had private functions with two of the same names.
  • The migrated_from field: annual_projections.py accepts it and tools/assemble_us_annual_release_dir.py drops it. The manifests of moved builds on Hugging Face carry it, as BE's two moved builds carry unpublished_artifacts. The docs still describe both fields.
  • Everything the tool imported. Other Microcosm modules use each of its Microcosm imports. The emitter-interface checks it called that no Microcosm source module calls (check_change, check_repository) belong to the separately released interface package, and the test-support emitter stand-in calls them too.
  • changelog.d/, PROGRESS.md and mentions of "the switch" as a past event ("the builds the switch moved"). In the gate-shadow code, "the switch" means a setting, not this tool.

Not in this PR

  • Pointer-file support: readers, constants, the loader's fallback, registry.py's pointer_path, and whether _refuse_pointer_files stays (tracker 5b · 12).
  • microcosm-publish-release and its docs: Remove the tagged publisher, microcosm-publish-release #1797 (tracker 5b · 10) removed them, and that change is merged into this branch.

What its merge waits for

Tracker task 5b · 11 of "1. Collector/Emitter". Its merge waits for:

It builds on main, which has been merged in twice with merge commits:

  • b1bb463f6, from main at 35ec6c7d2, with no Git conflict. Publish run_uk_cut.py builds through the emitter and refuse new direct Hugging Face imports #1743 had added the lint exemption for the removed module on main, and only a merge let this branch remove it.

  • baf7caeee, from main at 8ea088de0, which includes Remove the tagged publisher, microcosm-publish-release #1797 (5b · 10). It resolves three conflicts:

    • pyproject.toml: main had moved microcosm.data.release's exemption into its datasets group and kept the switch module's. Both entries in the conflicted block go.
    • The release_publication.py module docstring: this branch's removal of "the switch reads them" is combined with main's sentence that the tagged publisher is gone.
    • docs/release-contract.md: this branch's past-tense lines on the switch tool are combined with main's rewritten pointer-files bullet.

    Nothing that main added names the removed module or its test helper.

5b · 12, removing latest.json pointer support, follows this task.

Tests

Red-green, run locally by node ID only.

  • Failing commit 4dbe19f2d: 4 cases fail on assertions.
    • The new module packages/microcosm-build/tests/engine_free/shared/test_switch_tool_removal.py (named test_build_folder_switch_removal.py until 1994900b9) has two tests. test_the_build_folder_switch_module_is_removed checks that importlib.util.find_spec finds no such module, as test_candidate_restoration_module_is_removed does for a removed UK module. The scan test reads every file of nine text suffixes in the package sources and tests, test_support/, tools/ and docs/, plus the READMEs, and asserts that none names build_folder_switch. Before the change, it listed nine files.
    • The changed test_the_command_refuses_a_repository_that_has_not_switched_without_advising_removal, in both of its cases (publish, promote). It used to assert that the refusal names the module. It now asserts that the refusal names no python -m command, no microcosm.build. module, neither the copy nor the switch step, and no --write, and that it still says to keep the files in place.
  • Passing commit c71f0093d: the removal and the rewording.
  • Review round 1's bug.
    • Failing commit 16f853187: the scan also reads the root and package pyproject.toml files, the root conftest.py and .github/workflows. It failed on the root pyproject.toml alone. A new test, test_the_scan_reads_directories_and_files_that_exist, checks that every directory and file the scan reads exists, so a wrong path cannot make the scan pass without reading anything.
    • Passing commit 765819cd4: the exemption is removed.
  • Round 1's other points (765819cd4): a new test test_download_certified_reads_a_moved_builds_manifest in packages/microcosm-data/tests/engine_free/shared/test_loader.py. The only test that the loader certifies a moved build's manifest carrying migrated_from was in a deleted module.
  • Round 2's points (1994900b9): wording, the test module's new name, and one case dropped from the loader test.
  • The merge of main (baf7caeee): no test changed. Ruff check and format are clean on the resolved release_publication.py, and tools/ci_test_plan.py verify passes.

Tests were not re-run locally after the fixes; PR CI runs them. Round 2's reviewer ran this PR's added and changed tests by node ID at 765819cd4, and all seven cases passed. Ruff check and format are clean on every changed Python file, and tools/ci_test_plan.py verify passes.

Review

Two rounds of adversarial review, each in a fresh subagent with its own clone.

  • Round 1, on c71f0093d: one medium bug, no high or low bugs.
    • The medium bug: Publish run_uk_cut.py builds through the emitter and refuse new direct Hugging Face imports #1743 merged to main after this branch's base and exempted the removed module in the root pyproject.toml. Git reported no conflict, and the scan did not read that file. Fixed test-first in 16f853187 and 765819cd4, after merging main in.
    • Quality points applied in 765819cd4: the scan now checks that what it reads exists; the refusal test checks the step names; a loader test of a moved build's manifest; two docs/release-contract.md sentences made precise (the tool as a fourth reader of pointer files, and the fixture generator's default).
  • Round 2, on 765819cd4: no bugs. Its quality points, applied in 1994900b9:
    • the TID251 comment's accuracy;
    • the test module's own name contained the name it scans for;
    • the loader test's untagged-folder case matched no repository the loader reads;
    • two README phrases claimed more than the facts;
    • this description was out of date.

Review stopped after round 2, since it found no bugs. No known bugs remain.

🤖 Generated with Claude Code

anth-volk and others added 2 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>
anth-volk and others added 5 commits November 27, 2026 17:51
main's root pyproject.toml (from #1743) exempts the removed module from
ruff's TID251 rule; the merge lets this branch remove that entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1: main's root pyproject.toml, merged in from #1743, still
exempts the removed module from ruff's TID251 rule, and the scan did not
read it. The scan now also reads the root and package pyproject.toml
files, the root conftest.py and the CI workflows, and a second test
checks that every scanned directory and file exists, so a wrong path
cannot make the scan pass without reading anything. The scan fails on
pyproject.toml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bug (medium): remove the root pyproject.toml's TID251 exemption for the
removed module, which #1743 added on main, and reword its comment so it
names only the tagged publisher.

Also from the review's quality points:
- the refusal test checks that the refusal names neither the `copy` nor
  the `switch` step;
- the loader again has a test that it certifies a moved build's
  manifest carrying migrated_from, from a tag or an untagged folder; the
  only such test was in a deleted module;
- docs/release-contract.md says the switch tool was a fourth reader of
  pointer files, and that the fixture generator sets `default` only in
  the C5 golden records.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The root pyproject.toml's comment on microcosm.data.release's TID251
  exemption names everything there that imports huggingface_hub: the
  tagged publisher, the pointer-file readers and the Hub error checks
  the loader imports.
- The removal test module is now test_switch_tool_removal.py, so a doc
  or command that names it by path does not contain the name it scans
  for.
- The loader test of a moved build's manifest keeps only the case a
  loaded repository has: migrated_from naming a tag.
- The README and the test module's docstring say the US and UK builds
  moved from tags and BE's from untagged folders, and that the tool
  copied the builds it moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in #1797, which removed the tagged publisher. Conflicts resolved:
- pyproject.toml: main moved microcosm.data.release's TID251 exemption
  into its datasets group and kept one for the switch module; both
  entries in the conflicted block go, since the module is removed.
- release_publication.py's docstring: this branch's removal of "the
  switch reads them" with main's sentence that the tagged publisher is
  gone.
- docs/release-contract.md: this branch's past-tense lines on the
  switch tool with main's rewritten pointer-files bullet.

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.

Remove the build-folder switch tool now that the US, UK and BE release repositories have moved

1 participant