Skip to content

feat: support canonical hook wing consolidation - #2071

Open
Michael-WhiteCapData wants to merge 1 commit into
MemPalace:developfrom
Michael-WhiteCapData:fix/canonical-session-wing
Open

feat: support canonical hook wing consolidation#2071
Michael-WhiteCapData wants to merge 1 commit into
MemPalace:developfrom
Michael-WhiteCapData:fix/canonical-session-wing

Conversation

@Michael-WhiteCapData

Copy link
Copy Markdown

What changed

  • Adds optional hooks.wing / MEMPALACE_HOOK_WING so hook-created diary checkpoints can use one canonical wing instead of deriving a new wing per project path.
  • Extends mempalace migrate-wings with repeatable --rename OLD=NEW mappings for explicit, in-place wing consolidation.
  • Preserves existing normalization behavior when no explicit mappings are supplied. Explicit-map mode touches only named source wings.
  • Keeps drawer and closet IDs unchanged and updates metadata through the backend API.

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

  • Focused feature/regression suite: 371 passed, 1 skipped.
  • Full suite in four collection batches under WSL: 3,411 passed, 31 skipped.
  • 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.

@fatkobra fatkobra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants