Repository navigation
feat(migrate): tfmgr migrate plan, apply and verify, and the legacy gate (M301) - #27
Merged
Merged
Conversation
The superdataset builds the legacy skeleton from the templates and their .renames.tsv, and stops when a name of the previous skeleton would vanish. Every plan now simulates that build (the rule of templateflow/templateflow#219, where several old names may share a target) and blocks with M301 when its result would stop it. The previous names come from the legacy zip when given, and are otherwise inferred from the template and its rows. Plan.names_rows and Plan.names_result describe the template after the first of the two commits (the names), for apply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
plan writes, for each template, plan.json (self-contained: what apply reads), plan.md (the complete plan, for review), pr.md (the pull request body, within GitHub's limit) and renames.tsv; summary.md with --all. apply builds two commits with git plumbing in a temporary index (the names, then the metadata), checks fingerprints, annex keys, the paths changed and the predicted validation, and only then creates and checks out the branch. It refuses stale, dirty, adjusted or unlocked checkouts and existing branches, rolls back on failure, and never pushes. A dry run keeps its objects in a temporary store. verify checks a commit against the plan. A CI job runs the apply tests with git-annex. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A template that does not move to 2.0 in its first migration (most lack a README) is planned again once its README is written. That plan renames nothing, and apply made an empty first commit. Now each commit is built only when its tree differs from its parent's, the commits are numbered (1/2, 2/2) only when both are made, and a plan that changes nothing in the checkout is refused. plan.json keeps each commit's part, title and body; the headings of plan.md and pr.md no longer number the commits. The checks say "1 path changes" and "1 renamed annexed file keeps its key". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oesteban
marked this pull request as ready for review
December 6, 2026 08:31
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ec9bef49a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…eton may list previous_names dropped the targets of rename rows, taking them for new names. The Archive has targets that the legacy skeleton lists: the rows of tpl-MNI152NLin6Asym (11) and tpl-fsaverage (1) were written after their renames, so the legacy zip lists their targets and not their old paths. The inference missed those 11 + 1 names and added the 11 + 1 old paths the zip does not list. The names are now the template's files and the old paths of its rows: a superset of the zip's (a test checks it on every Archive template), so the gate never passes a result that the build would stop. On the Archive, no plan gets M301 either way. Co-Authored-By: Claude Opus 5.5 <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.
Summary
Stacked on #26 (base
feat/migrate-atlases). WP4 PR 6: the commands that turn a plan into a template's pull request.Plan options:
--date,--authored DIR(DIR/tpl-<label>/<path>),--headers TSVand--labels DIR(added to the shipped facts),--legacy-skeleton ZIP(exact names for M301; otherwise the gate checks every name the skeleton may list: the template's files and the old paths of its rows), and--config FILE. plan.json records the sha256 of every input, and each commit carries aMigration-Plan: sha256:...trailer.Evidence
Archive:
tfmgr migrate plan --allfrom the pinned v2 zip (45755e5), with--legacy-skeletonthe pinned legacy zip (597b047):--legacy-skeletoneither. The names checked then include every name of the zip (test_archive_previous_names). Before fe29a21 (after Codex's review) they did not: the rows of tpl-MNI152NLin6Asym (11), tpl-MNIInfant (11) and tpl-fsaverage (1) were written after their renames, so the zip lists their targets, not their old paths. fe29a21's message leaves out tpl-MNIInfant;Pilot,
~/tmp/templateflow/tpl-MNI152NLin2009cSymat fc02ec3, planned from the checkout:Its refs, HEAD, index, object counts and status are the same before and after, and the checkout's plan equals the zip's. The pilot's rows replay through templateflow/python-client
tests/compat(clients 25.0.4, 25.1.2 and 26.0): 16 passed, 2 expected failures, once the harness handles text files (its first table with one; draft templateflow/python-client#167).Tests:
test_migrate_apply.py(20), on a repository with annex links. It covers:.gitattributes;annextest: keys follow the renames,git annex fsck --fastpasses, and the written files stay in git.test_migrate_legacy.py(6, with a row written after its rename: a target that leaves without its own row is caught),test_archive_legacy_gatewith the pinned legacy zip, andtest_archive_previous_names.Local CI (stacked PR, so no GitHub CI), a mirror of pythonapp.yml on a clean worktree of a scratch merge of the stack (this PR at fe29a21, #25 at 2f17daf, #28 at 69aa5c5; it merges without conflicts):
On this branch alone (fe29a21), 413 passed. The first commit (92cb4fb) passes on its own: 389 passed.
Merge Danger
Door: two-way
New commands and modules. Existing code changes in two places:
GitTreeandload_checkouttake an optional git environment.The legacy skeleton fixture moves from
test_archive.pytoconftest.py.Blast Radius: migration tooling
Nothing runs against a template until WP5, and
applynever pushes. The new CI jobannexinstalls git-annex from apt onubuntu-26.04.