Skip to content

fix: pane-centric migration cleanup - normalize mixed session keys#59

Merged
boxp merged 3 commits intomainfrom
fix/pane-centric-migration-cleanup
Mar 11, 2026
Merged

fix: pane-centric migration cleanup - normalize mixed session keys#59
boxp merged 3 commits intomainfrom
fix/pane-centric-migration-cleanup

Conversation

@boxp
Copy link
Copy Markdown
Owner

@boxp boxp commented Mar 11, 2026

Summary

  • Add read-time normalization (normalize-sessions) to read-state-file that re-keys legacy session-id entries to pane-id canonical keys
  • When multiple entries share the same pane-id, the entry with the latest :last-updated wins
  • Write operations (which read first) automatically clean up the file on next write
  • Ensures 1 pane = 1 row even with mixed-key sessions.edn from pre-migration period

Root Cause

After pane-centric migration, sessions.edn can contain both session-id keys (UUIDs) and pane-id keys (%NN) for the same pane, causing duplicate entries in the TUI.

Canonicalization Strategy

  • Entries with non-empty :pane-id -> keyed by pane-id
  • Entries without :pane-id -> keep original key (non-tmux sessions)
  • Conflicts resolved by :last-updated timestamp (newest wins)

Cleanup Behavior

  • Read-time: read-state-file normalizes on every read (transparent to callers)
  • Write-time: All write functions read first, so next write produces a clean file

Tests (7 new)

  1. Mixed session-id + pane-id key normalization
  2. Newer timestamp entry wins regardless of key type
  3. Different pane-ids stay as separate entries
  4. Non-tmux sessions (empty pane-id) keep session-id key
  5. Multiple legacy session-id keys for same pane collapse to one
  6. Read-then-write produces clean file
  7. Update after normalize leaves no legacy key remnants

Review Points

  • Migration logic is minimal (single reduce-kv pass)
  • No dead compatibility code added
  • pane-centric canonical store assumption is consistent
  • Tests cover the exact mixed-state scenario from the bug report

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a9877a243

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ceeker/state/store.clj
@boxp boxp merged commit 7b7d9ed into main Mar 11, 2026
6 checks passed
@boxp boxp deleted the fix/pane-centric-migration-cleanup branch March 11, 2026 19:17
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.

1 participant