fix: worktree session UI safety and visibility (review)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 20:49:12 -04:00
parent 9efa270422
commit ace537e3d6
3 changed files with 32 additions and 15 deletions
+10 -4
View File
@@ -1404,18 +1404,24 @@ async def test_confirm_delete_cancel_returns_none():
def test_format_session_text_appends_worktree_branch_marker():
"""nickname != branch → show both nickname and branch around the ⎇ glyph."""
from hqt.tui.widgets.session_list import format_session_text
text = format_session_text("mywork", "claude", "idle", "", "feature-x")
assert "⎇ feature-x" in text
assert "mywork ⎇ feature-x" in text
def test_format_session_text_no_marker_when_nickname_equals_branch():
"""Avoid duplication: when nickname already equals the branch, no marker."""
def test_format_session_text_marker_shows_once_when_nickname_equals_branch():
"""nickname == branch (the common case) → ⎇ still appears, glyph once, no
duplicated branch name."""
from hqt.tui.widgets.session_list import format_session_text
text = format_session_text("feature-x", "claude", "idle", "", "feature-x")
assert "" not in text
assert "" in text
# Glyph appears exactly once, and the branch is not duplicated.
assert text.count("") == 1
assert "⎇ feature-x" in text
assert "feature-x ⎇" not in text
def test_format_session_text_no_marker_for_plain_session():