feat: support canonical hook wing consolidation - #2071
feat: support canonical hook wing consolidation#2071Michael-WhiteCapData wants to merge 1 commit into
Conversation
fatkobra
left a comment
There was a problem hiding this comment.
Blocking: explicit --rename OLD=NEW is an arbitrary namespace migration, but the implementation only rewrites drawer, closet, and topic metadata.
Explicit palace tunnels are persisted separately with source_wing and target_wing stored as their endpoints, and their IDs are derived from those endpoints. Read-time wing normalization cannot translate an arbitrary mapping such as wing_claude=sessions.
After this migration, drawers may live in sessions while existing tunnels still point at wing_claude, so navigation can silently break and stale tunnel IDs remain.
Please include explicit tunnels in the migration plan and apply phase:
- rewrite either endpoint that matches a source mapping;
- regenerate the canonical tunnel ID;
- handle resulting ID collisions deterministically;
- preserve the tunnel’s remaining metadata.
Please add regressions for source-only, target-only, both-endpoint, and resulting-ID-collision cases.
The existing “no tunnel rewrite needed” reasoning may be valid for punctuation-only canonicalization, but it does not hold for user-supplied arbitrary renames.
What changed
hooks.wing/MEMPALACE_HOOK_WINGso hook-created diary checkpoints can use one canonical wing instead of deriving a new wing per project path.mempalace migrate-wingswith repeatable--rename OLD=NEWmappings for explicit, in-place wing consolidation.Why
Large long-lived palaces can accumulate split session-history wings from encoded Claude project directories, worktrees, and historical hook derivation changes. Operators need a supported way to prevent recurrence and consolidate existing metadata without direct SQLite edits.
Verification
ruff check .: passed.ruff format --check .: passed.The full suite was batched because a one-shot collection run hit a CPython segfault in pytest assertion rewriting before executing tests; every test file passed when collected in smaller batches.