fix(doctor): wire --fix to migrate legacy v1 pack shape#2058
Open
Rome-1 wants to merge 1 commit into
Open
Conversation
The v2-agent-format, v2-import-format, and v2-default-rig-import-format checks all reported their FixHint as "run gc doctor --fix to rewrite safe mechanical cases", but their CanFix() returned false — so the hint led nowhere and the warnings could only be cleared by manually running gc import migrate. Each check now declares CanFix()=true and routes Fix() through a shared runV2PackMigration helper that calls migrate.Apply. migrate.Apply is idempotent on a city that has already been migrated, so chaining the three Fix() calls in one doctor --fix invocation is safe — the second and third calls are no-ops on the partially-rewritten city. Test: TestV2DeprecationChecksFixMigratesPackShape.
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
Split out from #1998 per review feedback — this is the code-fix half that was previously co-mingled with a docs-only PR.
The
v2-agent-format,v2-import-format, andv2-default-rig-import-formatdoctor checks all reported theirFixHintas "run gc doctor --fix to rewrite safe mechanical cases", but theirCanFix()returnedfalse— so the hint led nowhere and the warnings could only be cleared by manually runninggc import migrate.Changes
CanFix() = true.Fix()is routed through a sharedrunV2PackMigrationhelper that callsmigrate.Apply.migrate.Applyis idempotent on a city that has already been migrated, so chaining the threeFix()calls in onedoctor --fixinvocation is safe — the second and third calls are no-ops on the partially-rewritten city.Test plan
TestV2DeprecationChecksFixMigratesPackShapecovers the three checks running in one--fixpass on a legacy v1 city.make testfor the touched packagegc doctor --fixon a v1 city, confirm warnings clear without separately invokinggc import migrate🤖 Generated with Claude Code