feat(identifier): add reversible file migration

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a023c0-a0a3-7c03-b395-5a0d2757214d
This commit is contained in:
tegwick 2026-08-22 00:32:04 +02:00
parent 887943108e
commit 1d5b60346d
4 changed files with 354 additions and 2 deletions

View file

@ -8,7 +8,7 @@ status: active
owner: codex
topic_slug: infotech
created: "2026-08-17"
updated: "2026-08-21"
updated: "2026-08-22"
parent_project: prj-state-hub-retirement
parent_workplan: SHR-WP-0001
related:
@ -380,6 +380,29 @@ file-first or direct-PK rewrite would split the projection. Evidence and the
required transactional/alias/rollback contract are recorded in
`docs/evidence/RMGR-WP-0005-helixforge-migration-readiness-2026-08-21.md`.
**Central projection gate passed in isolation (2026-08-22):** State Hub commit
`cb1b028` adds Alembic revision `b8d4f0a2c6e1`, durable old→new alias
provenance, and a repository-atomic forward/reverse executor. All 20 foreign
keys into workplans/tasks now retain their delete policy while cascading primary
key updates. An isolated PostgreSQL upgrade/downgrade rehearsal verified 20/20
constraints in both directions and alias-table creation/removal; service tests
prove forward/reverse cascades and all-or-nothing failure, and the full State
Hub suite passes (`622 passed`). No live database or fleet file was migrated.
**Repository file gate implemented (2026-08-22):** `rmgr identifier
migration-files` validates the plan seal and repository source before touching
bytes, requires the exact `--confirm-plan-sha256` plus an explicit `--execute`,
prepares all mapped files before replacing any, restores original bytes on a
write failure, and supports reverse. Reverse restores replaced IDs and removes
fields introduced by `action: assign`. Focused forward/dry-run/reverse tests and
the full Repo Manager suite pass (`70 passed`); Ruff is clean.
The guard correctly rejected the 2026-08-21 fleet plan after this workplan
changed, proving source drift cannot slip into apply. Regenerate and reseal that
plan after this implementation commit. The remaining gate is a single-repository
pilot that couples database apply, authoritative file rewrite, consistency
verification, and database rollback if the file phase fails.
## Retire the interim rule
```task