Skip to content

fix(sidebar): restore session rename key#91

Merged
bnema merged 1 commit into
mainfrom
fix/sidebar-session-rename-key
Jun 20, 2026
Merged

fix(sidebar): restore session rename key#91
bnema merged 1 commit into
mainfrom
fix/sidebar-session-rename-key

Conversation

@bnema

@bnema bnema commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Restore context-sensitive r handling so sessions invoke the existing rename prompt while categories keep inline rename.
  • Wire session rename through the sidebar UI action layer.
  • Surface concrete rename failures from prompt submissions and run prompt commands in the background.

Test Plan

  • rtk go test ./internal/adapters/uity ./internal/app
  • rtk go test ./...

Summary by CodeRabbit

  • New Features

    • Added session renaming functionality accessible via the r key using tmux rename prompt.
  • Documentation

    • Updated README to document the new session rename behavior alongside existing category rename functionality.
  • Tests

    • Added test coverage for session rename workflows and edge cases.
  • Bug Fixes

    • Added error message display when session operations fail.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a8788cb6-39c0-4631-92a5-c59a533e832b

📥 Commits

Reviewing files that changed from the base of the PR and between e0279bf and b097cd0.

📒 Files selected for processing (8)
  • README.md
  • cmd/tmux-session-sidebar/uity_runner.go
  • internal/adapters/uity/sidebar_model.go
  • internal/adapters/uity/tree_render_test.go
  • internal/app/router.go
  • internal/app/session_actions.go
  • internal/app/session_actions_test.go
  • internal/app/sidebar_ui.go

📝 Walkthrough

Walkthrough

The PR extends the sidebar r key from renaming only categories to a unified flow that also renames sessions. A new RenameSession func(string) bool callback is added to the Actions and SidebarUIActions structs, wired through the router and UI runner. commandPrompt gains background execution (run-shell -b), and a new displayActionFailure helper emits a tmux message on rename errors.

Changes

Session Rename via r Key

Layer / File(s) Summary
RenameSession contracts and failure helpers
internal/adapters/uity/sidebar_model.go, internal/app/sidebar_ui.go, internal/app/session_actions.go
RenameSession func(string) bool added to Actions and SidebarUIActions. displayActionFailure helper introduced to emit tmux display-message on rename failure; called from renameSession on error. commandPrompt updated to use run-shell -b for background execution.
Unified rename logic and app wiring
internal/adapters/uity/sidebar_model.go, internal/app/router.go, cmd/tmux-session-sidebar/uity_runner.go
startRenameSelectedCategory replaced by startRenameSelected, which branches on selected item: categories enter ModeRenameCategory inline, sessions call actions.RenameSession directly and reload the tree. Wired through buildSidebarActions via handleMetadataAction and mapped in toUIActions.
Tests and README
internal/adapters/uity/tree_render_test.go, internal/app/session_actions_test.go, README.md
New tests cover r on session rows (calls RenameSession, reloads tree, stays in ModeBrowse), r on non-renamable rows (no-op), and renameSession invalid-name failure (error identity + display-message log). run-shell -b assertion added to prompt test. README updated to document dual rename UX.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • bnema/tmux-session-sidebar#20: Overlaps at the renameSession implementation in internal/app/session_actions.go, which this PR modifies to add failure display and background execution.
  • bnema/tmux-session-sidebar#61: Both touch buildSidebarActions in internal/app/router.go to add or restructure sidebar action handler wiring.
  • bnema/tmux-session-sidebar#64: This PR builds directly on the category-first sidebar tree rename infrastructure established in PR #64, extending it to cover sessions.

Poem

🐇 A tap of r and sessions heed the call,
No longer just for categories tall.
A prompt appears, tmux awaits your name,
Background shells and errors display their shame.
The sidebar tree reloads with newfound grace —
This rabbit renamed sessions with a smile on its face! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: restoring session rename functionality in the sidebar, which aligns with the primary objective of reintroducing context-sensitive handling of the rename key.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sidebar-session-rename-key

Comment @coderabbitai help to get the list of available commands and usage tips.

@bnema bnema merged commit ad19309 into main Jun 20, 2026
4 checks passed
@bnema bnema deleted the fix/sidebar-session-rename-key branch June 20, 2026 07:53
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