detached 2e6a467

test(daemon): cover recent session visibility boundaries

commit
2e6a4672ce1f881aa08bb1c590a5dd25fbd7978e
author
brice · · 2026-07-15 16:48 UTC
parent
7953828
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +28 -2
M internal/usecase/daemon/palette_test.go +19 -0
@@ -73,6 +73,25 @@ func TestPaletteEntryPublishesEligibleNamedSessionResults(t *testing.T) {
7373 }, got)
7474 }
7575
76+func TestPaletteRecentSessionsExcludeEphemeralSessions(t *testing.T) {
77+ p, release := newBlockingPTY(t)
78+ defer release()
79+ d, current, ac, _ := newManualSessionWithPTYs(t, p)
80+ named := &session{id: "named", name: "named", tabs: []*tab{{}}}
81+ named.mruAt.Store(1)
82+ ephemeral := &session{id: "ephemeral", name: "1", ephemeral: true, tabs: []*tab{{}}}
83+ ephemeral.mruAt.Store(2)
84+ d.sessions[named.id] = named
85+ d.sessions[ephemeral.id] = ephemeral
86+
87+ d.enterPalette(current, ac)
88+ ac.overlays.paletteMu.Lock()
89+ defer ac.overlays.paletteMu.Unlock()
90+
91+ require.Len(t, ac.overlays.paletteRecent, 1)
92+ require.Equal(t, named.id, ac.overlays.paletteRecent[0].id)
93+}
94+
7695 func TestPaletteSessionFailureFeedbackClearsOnQueryChange(t *testing.T) {
7796 p, release := newBlockingPTY(t)
7897 defer release()
@@ -73,6 +73,25 @@ func TestPaletteEntryPublishesEligibleNamedSessionResults(t *testing.T) {
73 }, got)73 }, got)
74 }74 }
75 75
76+func TestPaletteRecentSessionsExcludeEphemeralSessions(t *testing.T) {
77+ p, release := newBlockingPTY(t)
78+ defer release()
79+ d, current, ac, _ := newManualSessionWithPTYs(t, p)
80+ named := &session{id: "named", name: "named", tabs: []*tab{{}}}
81+ named.mruAt.Store(1)
82+ ephemeral := &session{id: "ephemeral", name: "1", ephemeral: true, tabs: []*tab{{}}}
83+ ephemeral.mruAt.Store(2)
84+ d.sessions[named.id] = named
85+ d.sessions[ephemeral.id] = ephemeral
86+
87+ d.enterPalette(current, ac)
88+ ac.overlays.paletteMu.Lock()
89+ defer ac.overlays.paletteMu.Unlock()
90+
91+ require.Len(t, ac.overlays.paletteRecent, 1)
92+ require.Equal(t, named.id, ac.overlays.paletteRecent[0].id)
93+}
94+
76 func TestPaletteSessionFailureFeedbackClearsOnQueryChange(t *testing.T) {95 func TestPaletteSessionFailureFeedbackClearsOnQueryChange(t *testing.T) {
77 p, release := newBlockingPTY(t)96 p, release := newBlockingPTY(t)
78 defer release()97 defer release()
M internal/usecase/daemon/picker_test.go +9 -2
@@ -87,8 +87,15 @@ func TestPickerViewsIncludesEphemeralSessions(t *testing.T) {
8787 views, _ := d.pickerViews(current)
8888
8989 require.Len(t, views, 2)
90- require.Equal(t, ephemeral.id, views[0].ID)
91- require.Equal(t, "1", views[0].Name)
90+ var ephemeralView picker.SessionView
91+ for _, view := range views {
92+ if view.ID == ephemeral.id {
93+ ephemeralView = view
94+ break
95+ }
96+ }
97+ require.Equal(t, ephemeral.id, ephemeralView.ID)
98+ require.Equal(t, "1", ephemeralView.Name)
9299 }
93100
94101 func TestPickerViewsCarryNamedLifecycleIdentity(t *testing.T) {
@@ -87,8 +87,15 @@ func TestPickerViewsIncludesEphemeralSessions(t *testing.T) {
87 views, _ := d.pickerViews(current)87 views, _ := d.pickerViews(current)
88 88
89 require.Len(t, views, 2)89 require.Len(t, views, 2)
90- require.Equal(t, ephemeral.id, views[0].ID)90+ var ephemeralView picker.SessionView
91- require.Equal(t, "1", views[0].Name)91+ for _, view := range views {
92+ if view.ID == ephemeral.id {
93+ ephemeralView = view
94+ break
95+ }
96+ }
97+ require.Equal(t, ephemeral.id, ephemeralView.ID)
98+ require.Equal(t, "1", ephemeralView.Name)
92 }99 }
93 100
94 func TestPickerViewsCarryNamedLifecycleIdentity(t *testing.T) {101 func TestPickerViewsCarryNamedLifecycleIdentity(t *testing.T) {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close