Skip to content

WIP: FOR REVIEW: Generate the migration guides from per-change migration records - #7133

Draft
hjmjohnson wants to merge 5 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:doc-migration-records
Draft

hjmjohnson wants to merge 5 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:doc-migration-records

Conversation

@hjmjohnson

@hjmjohnson hjmjohnson commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

WIP: FOR REVIEW. This is a full working implementation of #7131, so the design can be judged by its real output. Each change adds one small YAML migration record, and the docs build generates the migration guides from them. No PR edits a shared guide file again.

The generated guides are in this PR's Read the Docs preview, and as raw snapshots for review on GitHub: itk_6_migration_guide_DRAFT.md and itk_5_migration_guide_DRAFT.md. Criticism of the records' content, and of the layout and ranking, is the point of this draft.

Commits
  1. DOC: Document migration records.
    • Documentation/AI/migration-records.md is the one guide, for contributors and agents. It covers when a change needs a record and how to write one.
    • The JSON Schema is the single definition of each field and of the impact rubric. _template.yaml is generated from it.
    • The template's core fields are live with generic example values, and optional fields are commented. Uncomment an optional field once it has a value; removing unused fields before committing is recommended, not required.
    • Also adds a row in AGENTS.md, a checklist line in pull-requests.md, and a link from the contributing docs.
  2. ENH: Generate the migration guides from records.
    • Utilities/Maintenance/MigrationRecords.py has four subcommands: validate, generate, template, and release. It is also the Sphinx extension that builds the guide pages.
    • New pre-commit hooks: advisory validation, and local generation into the git-ignored migration_guides/generated/.
    • SetupForDevelopment.sh generates the pages once, and its version is bumped to 13 so existing clones rerun it. The release checklist gains a step that assigns records to the new release.
    • Fixture tests run in the pre-commit workflow.
  3. DOC: Freeze the hand-written guides. Their old URLs redirect to the generated pages. They keep their content, gain a "frozen" note, and leave the docs build. Open PRs that append to them still rebase cleanly (11 of 33 open PRs touch migration_guides/). A later cleanup PR converts late additions and deletes the files.
  4. DOC: Convert the existing entries into records.
    • Counts: 92 records, 51 in itk6/ and 41 in itk5/. Catch-all sections are split into one record per change, and each split record starts with its section's heading in bold.
    • Wording: the words are the originals, moved into fields without rewriting, typos included. An audit of every paragraph, list item, table row, and code line, in both directions, finds nothing lost or added.
    • Releases: the releases.yaml manifests come from git tag --contains on each record's commit. 42 ITK 6 records are in no tag yet and show as Unreleased.
  5. WIP: Snapshots of the generated guides (*_DRAFT.md), for review on GitHub only. They are excluded from the docs build and not kept up to date. Drop this commit before merge.
Record format

The file is records/itk<N>/YYYYMMDD_<Descriptor>.yaml, and the descriptor is the record's ID and anchor. Every field is optional, so {} is valid. The fields are:

  • title, summary, details, actions;
  • categories (what changed) and environment (where to act);
  • impact: high, medium, or low, rated with the rubric in the schema;
  • pr, and commits: the commit that introduced the change first, then follow-up fixes appended over time;
  • deprecated_in, removed_in, legacy_guard;
  • renames and before/after examples.
  • hints: freeform pointers for people and agentic tools doing the migration, such as scripts in Utilities/Maintenance/ or sed/grep commands. They are not shown in the guide.

Markdown fields are limited to the subset that renders the same on GitHub and in MyST. Releases live in releases.yaml, written only by MigrationRecords.py release, and unlisted records appear under "Unreleased".

Validation is advisory

The hook prints suggestions and never blocks. ITK_MIGRATION_RECORDS_STRICT=1 makes errors fail, for anyone who opts in. Schema checks use the jsonschema library (the engine behind check-jsonschema) and style checks use yamllint, both inside one local hook. That keeps both advisory; a standalone check-jsonschema or yamllint hook would block commits.

Open questions for review
  • A full docs build gives 29 warnings, down from 74 on main, because the old guide's heading warnings are gone. The generated pages add only two inherited CMake highlighting warnings, from ... placeholders in example code.
  • The impact ratings of the converted records are first guesses from the rubric; please correct them.
  • The "Fine-grained versioning between release tags" section stays in migration_guides/index.md because it describes a mechanism, not a migration.

🤖 Generated with Claude Code

@github-actions github-actions Bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots area:Python wrapping Python bindings for a class type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Documentation Issues affecting the Documentation module labels Nov 6, 2026
@hjmjohnson
hjmjohnson force-pushed the doc-migration-records branch from 0571025 to 0e3c9a0 Compare November 6, 2026 18:16
@hjmjohnson

Copy link
Copy Markdown
Member Author

Force-push 0571025→0e3c9a0 is content-only (same base): bumps SetupForDevelopment_VERSION to 13, replaces commit with a commits list (introducing commit first, follow-up fixes appended), and adds a WIP: commit with *_DRAFT.md snapshots of the generated guides for review, to be dropped before merge.

@hjmjohnson

Copy link
Copy Markdown
Member Author

Force-push 0e3c9a0→752d930 is content-only (same base): following @dzenanz on #7131, each generated guide now opens with Most impactful changes (every high-impact record, with what to do) followed by All changes (the index and every record by release). The *_DRAFT.md snapshots are regenerated to match.

@hjmjohnson

Copy link
Copy Markdown
Member Author

Force-push 752d930→ad304e9 is content-only (same base): adds an optional hints field, a freeform list of pointers for people and agentic tools carrying out a migration (scripts in Utilities/Maintenance/, sed/grep commands). Hints are not rendered in the guide. Four ITK 6 records carry examples.

@hjmjohnson

Copy link
Copy Markdown
Member Author

Force-push ad304e9→4ff2902 is content-only (same base).

  • Records are now verbatim. Every record's prose is the original guide text, moved into fields without rewriting, typos included. A record split from a catch-all section ("Class changes", "C++11", …) starts with that section's heading in bold.
  • Verified by an audit. It checks every paragraph, list item, table row, and code line of the frozen guides in both directions. Only the guides' own titles and intros are unplaced, plus one HTML anchor tag whose paragraph is in the record. No record holds prose that is not in the originals.
  • Documentation/AI/migration-records.md now separates the two tiers of rule-tiers.md:
    • Project standards decide whether a record is acceptable, and have no length limit.
    • Agent default: generation guidelines hold the brevity limits. They constrain how an agent writes a record and are not acceptance criteria, so reviewers (Greptile included) should not cite them.

@dzenanz dzenanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good.

@hjmjohnson
hjmjohnson force-pushed the doc-migration-records branch from 4ff2902 to 14dbe40 Compare November 6, 2026 19:27
@hjmjohnson

Copy link
Copy Markdown
Member Author

Force-push 4ff2902→14dbe40 is content-only (same base): per @dzenanz, the template now has its core fields live with generic example values and optional fields commented, with header steps for uncommenting. The validator flags an unedited copy. Details are in the resolved template thread.

@hjmjohnson
hjmjohnson force-pushed the doc-migration-records branch from 14dbe40 to 18016e7 Compare November 6, 2026 19:45
@hjmjohnson

Copy link
Copy Markdown
Member Author

Force-push 14dbe40→18016e7 is content-only (same base): MathSqrtepsOneUlp keeps impact: low (the rubric uses it as the low example) and gains one details line giving the reason, which clears the advisory warning. That line is the one sentence in the converted records not taken from the original guide.

@hjmjohnson

Copy link
Copy Markdown
Member Author

@greptile review

@greptile-apps

This comment has been minimized.

Comment thread Documentation/docs/conf.py Resolved
@hjmjohnson

Copy link
Copy Markdown
Member Author

Force-push 18016e7→5d5405e is a rebase only, onto main (587858a). All five commits are unchanged (git range-diff: =). A content push follows with the Greptile fixes and records for the SSE2 (#7125) and Visual Studio 16.2 (#7129) sections added to the frozen guide.

@hjmjohnson
hjmjohnson force-pushed the doc-migration-records branch 2 times, most recently from 5d5405e to 4d00fe1 Compare November 6, 2026 20:26
@hjmjohnson

Copy link
Copy Markdown
Member Author

Force-push 5d5405e→4d00fe1 is content-only (same base): Greptile fixes (wrong field types no longer crash, UTF-8 everywhere, redirects at the old guide URLs, multi-line actions), and records for the three sections added to the frozen guide by #7125, #7129, and #7123, converted verbatim. 91 records in all.

@hjmjohnson

Copy link
Copy Markdown
Member Author

Force-push 4d00fe1→583f099 is a rebase only, onto main (4dbf738). All five commits are unchanged (git range-diff: =). A content push follows that adds the record for the work-unit ratio section #7122 added to the frozen guide.

@hjmjohnson
hjmjohnson force-pushed the doc-migration-records branch from 4d00fe1 to 583f099 Compare November 6, 2026 21:18
@hjmjohnson

Copy link
Copy Markdown
Member Author

Force-push 583f099→d459af4 is content-only (same base): adds 20261106_WorkUnitPerThreadRatio.yaml, the verbatim record for the work-unit ratio section #7122 added to the frozen guide. 92 records in all.

@hjmjohnson
hjmjohnson force-pushed the doc-migration-records branch from 583f099 to d459af4 Compare November 6, 2026 21:19
Each downstream-visible change gets one YAML record, so no PR edits a
shared guide file (issue InsightSoftwareConsortium#7131). Documentation/AI/migration-records.md
says when a record is needed and how to write one, for contributors and
agents alike. The JSON Schema is the single definition of every field
and of the impact rubric; _template.yaml is generated from it.
MigrationRecords.py validates records, generates the guide pages, writes
_template.yaml from the schema, and assigns records to a release. Sphinx
loads it as an extension; SetupForDevelopment and a pre-commit hook write
the same pages to the git-ignored migration_guides/generated/.

Validation is advisory: findings print, and only
ITK_MIGRATION_RECORDS_STRICT=1 makes errors fail. Fixture tests run in
the pre-commit workflow.
The guides are now generated from records into migration_guides/generated/,
which the index points to. The hand-written guides keep their content, gain
a frozen note, and leave the docs build. Open PRs that append to them still
rebase cleanly; a cleanup PR converts late additions and deletes the files.
Each section of the frozen ITK 6 and ITK 5 guides and the two ITK 6 topic
guides becomes one or more records: 51 in itk6/ and 41 in itk5/. The words
are the originals, moved into fields without rewriting; a record split from
a catch-all section starts with that section's heading in bold. Each record
keeps the original PR and commits, and releases.yaml lists the first tag
containing them; 42 ITK 6 records are not yet in a tag.
Snapshots of the guides generated from the records, so reviewers can read
the result on GitHub without building the docs. Not kept up to date and
excluded from the docs build; drop this commit before merge. The ITK 6
draft exceeds the 100 kB file limit, so .gitattributes raises it for
*_DRAFT.md only.
@hjmjohnson

Copy link
Copy Markdown
Member Author

Force-push d459af4→dc6c7e9 changes commit messages only (tree identical, same base): removes the Co-Authored-By: Claude … trailers, which Documentation/AI/attribution.md forbids. AI assistance is disclosed in the PR description only.

@hjmjohnson
hjmjohnson force-pushed the doc-migration-records branch from d459af4 to dc6c7e9 Compare November 6, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Documentation Issues affecting the Documentation module area:Python wrapping Python bindings for a class type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants