Skip to content

fix(doctor): wire --fix to migrate legacy v1 pack shape#2058

Open
Rome-1 wants to merge 1 commit into
gastownhall:mainfrom
Rome-1:fix/doctor-v1-pack-migration
Open

fix(doctor): wire --fix to migrate legacy v1 pack shape#2058
Rome-1 wants to merge 1 commit into
gastownhall:mainfrom
Rome-1:fix/doctor-v1-pack-migration

Conversation

@Rome-1
Copy link
Copy Markdown
Contributor

@Rome-1 Rome-1 commented May 13, 2026

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, and v2-default-rig-import-format doctor 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.

Changes

  • Each of the three v2-deprecation checks now declares CanFix() = true.
  • Fix() is routed 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 plan

  • New test: TestV2DeprecationChecksFixMigratesPackShape covers the three checks running in one --fix pass on a legacy v1 city.
  • make test for the touched package
  • Manual: run gc doctor --fix on a v1 city, confirm warnings clear without separately invoking gc import migrate

🤖 Generated with Claude Code

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.
@github-actions github-actions Bot added the status/needs-triage Inbox — we haven't looked at it yet label May 13, 2026
@randy-release-manager randy-release-manager Bot added kind/bug Broken behavior priority/p2 Medium — real problem, workaround exists and removed status/needs-triage Inbox — we haven't looked at it yet labels May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Broken behavior priority/p2 Medium — real problem, workaround exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant