detached e374227

refactor(usecase/palette,picker): delete dead remote session result and preview size helpers

NewRemoteSessionResult has no production caller: the palette's remote rows
(Phase E3) are not wired through it. Its three test call sites are
removed, except TestReplaceResultsPreservesExactSelection in model_test.go,
which is rewritten against NewActiveSessionResultWithDisplayOrigin (a live
constructor) to keep ReplaceResults' exact-selection-preservation-across-
reorder behavior covered, since it was the only test of that behavior.

picker.PreviewSize has no caller anywhere, production or test: both the
client and the daemon compute their own preview viewport locally now
(pickerPreviewSize, remotePickerPreviewSize).
commit
e3742276a5118e3634b697f59df8d32c1795305b
author
brice · · 2026-09-23 01:55 UTC
parent
5e1cc30
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
5 files · +7 -45
M internal/usecase/palette/fuzzy_test.go +0 -10
@@ -4,7 +4,6 @@ import (
44 "testing"
55 "time"
66
7- "github.com/bnema/vev/internal/domain"
87 "github.com/bnema/vev/internal/protocol"
98 "github.com/bnema/vev/internal/usecase/command"
109 "github.com/stretchr/testify/require"
@@ -104,15 +103,6 @@ func TestFuzzyRanksExactSessionNameAheadOfPrefix(t *testing.T) {
104103 wantFirst: "Resume session vev@arch",
105104 offset: 15,
106105 },
107- {
108- name: "remote catalog session",
109- results: []Result{
110- NewRemoteSessionResult(domain.RemoteSessionKey{Host: "arch", Name: "vev-vt", DisplayOrigin: "arch"}, domain.RemoteSessionTarget{}, ""),
111- NewRemoteSessionResult(domain.RemoteSessionKey{Host: "arch", Name: "vev", DisplayOrigin: "arch"}, domain.RemoteSessionTarget{}, ""),
112- },
113- wantFirst: "Switch to session vev@arch",
114- offset: 18,
115- },
116106 {
117107 name: "recent route",
118108 results: []Result{
@@ -4,7 +4,6 @@ import (
4 "testing"4 "testing"
5 "time"5 "time"
6 6
7- "github.com/bnema/vev/internal/domain"
8 "github.com/bnema/vev/internal/protocol"7 "github.com/bnema/vev/internal/protocol"
9 "github.com/bnema/vev/internal/usecase/command"8 "github.com/bnema/vev/internal/usecase/command"
10 "github.com/stretchr/testify/require"9 "github.com/stretchr/testify/require"
@@ -104,15 +103,6 @@ func TestFuzzyRanksExactSessionNameAheadOfPrefix(t *testing.T) {
104 wantFirst: "Resume session vev@arch",103 wantFirst: "Resume session vev@arch",
105 offset: 15,104 offset: 15,
106 },105 },
107- {
108- name: "remote catalog session",
109- results: []Result{
110- NewRemoteSessionResult(domain.RemoteSessionKey{Host: "arch", Name: "vev-vt", DisplayOrigin: "arch"}, domain.RemoteSessionTarget{}, ""),
111- NewRemoteSessionResult(domain.RemoteSessionKey{Host: "arch", Name: "vev", DisplayOrigin: "arch"}, domain.RemoteSessionTarget{}, ""),
112- },
113- wantFirst: "Switch to session vev@arch",
114- offset: 18,
115- },
116 {106 {
117 name: "recent route",107 name: "recent route",
118 results: []Result{108 results: []Result{
M internal/usecase/palette/model_test.go +7 -15
@@ -140,19 +140,11 @@ func TestCNSDestinationRefreshDoesNotPromoteCommandSelection(t *testing.T) {
140140 require.False(t, ok, "entering multi-destination mode requires fresh navigation")
141141 }
142142
143-func TestReplaceResultsPreservesExactRemoteSelection(t *testing.T) {
144- result := func(endpoint string, lifecycle byte) Result {
145- key := domain.RemoteSessionKey{
146- Host: endpoint, Name: "vev", LifecycleID: domain.SessionLifecycleID{lifecycle}, DisplayOrigin: "arch",
147- }
148- target := domain.RemoteSessionTarget{
149- Endpoint: endpoint, DisplayOrigin: "arch", LifecycleID: key.LifecycleID,
150- SessionName: "vev", LiveTabID: "tab-vev",
151- }
152- return NewRemoteSessionResult(key, target, "")
153- }
154- first := result("user@arch", 1)
155- selected := result("admin@arch", 2)
143+// TestReplaceResultsPreservesExactSelection proves ReplaceResults tracks the
144+// selected result by its exact target through a reorder, not by its position.
145+func TestReplaceResultsPreservesExactSelection(t *testing.T) {
146+ first := NewActiveSessionResultWithDisplayOrigin(testExactTarget("vev", 1), time.Time{}, "user@arch")
147+ selected := NewActiveSessionResultWithDisplayOrigin(testExactTarget("vev", 2), time.Time{}, "admin@arch")
156148 m := New([]Result{first, selected})
157149 m.Down()
158150
@@ -160,9 +152,9 @@ func TestReplaceResultsPreservesExactRemoteSelection(t *testing.T) {
160152
161153 got, ok := m.Selected()
162154 require.True(t, ok)
163- target, ok := got.RemoteSessionTarget()
155+ target, ok := got.SessionTarget()
164156 require.True(t, ok)
165- require.Equal(t, "admin@arch", target.Endpoint)
157+ require.Equal(t, domain.SessionLifecycleID{2}, target.LifecycleID)
166158 }
167159
168160 func TestModelInsertBackspaceAndSelectionClamp(t *testing.T) {
@@ -140,19 +140,11 @@ func TestCNSDestinationRefreshDoesNotPromoteCommandSelection(t *testing.T) {
140 require.False(t, ok, "entering multi-destination mode requires fresh navigation")140 require.False(t, ok, "entering multi-destination mode requires fresh navigation")
141 }141 }
142 142
143-func TestReplaceResultsPreservesExactRemoteSelection(t *testing.T) {143+// TestReplaceResultsPreservesExactSelection proves ReplaceResults tracks the
144- result := func(endpoint string, lifecycle byte) Result {144+// selected result by its exact target through a reorder, not by its position.
145- key := domain.RemoteSessionKey{145+func TestReplaceResultsPreservesExactSelection(t *testing.T) {
146- Host: endpoint, Name: "vev", LifecycleID: domain.SessionLifecycleID{lifecycle}, DisplayOrigin: "arch",146+ first := NewActiveSessionResultWithDisplayOrigin(testExactTarget("vev", 1), time.Time{}, "user@arch")
147- }147+ selected := NewActiveSessionResultWithDisplayOrigin(testExactTarget("vev", 2), time.Time{}, "admin@arch")
148- target := domain.RemoteSessionTarget{
149- Endpoint: endpoint, DisplayOrigin: "arch", LifecycleID: key.LifecycleID,
150- SessionName: "vev", LiveTabID: "tab-vev",
151- }
152- return NewRemoteSessionResult(key, target, "")
153- }
154- first := result("user@arch", 1)
155- selected := result("admin@arch", 2)
156 m := New([]Result{first, selected})148 m := New([]Result{first, selected})
157 m.Down()149 m.Down()
158 150
@@ -160,9 +152,9 @@ func TestReplaceResultsPreservesExactRemoteSelection(t *testing.T) {
160 152
161 got, ok := m.Selected()153 got, ok := m.Selected()
162 require.True(t, ok)154 require.True(t, ok)
163- target, ok := got.RemoteSessionTarget()155+ target, ok := got.SessionTarget()
164 require.True(t, ok)156 require.True(t, ok)
165- require.Equal(t, "admin@arch", target.Endpoint)157+ require.Equal(t, domain.SessionLifecycleID{2}, target.LifecycleID)
166 }158 }
167 159
168 func TestModelInsertBackspaceAndSelectionClamp(t *testing.T) {160 func TestModelInsertBackspaceAndSelectionClamp(t *testing.T) {
M internal/usecase/palette/result.go +0 -10
@@ -138,16 +138,6 @@ func newSessionPayload(target protocol.ExactSessionTarget, createdAt time.Time,
138138 return sessionPayload{display: SessionDisplay(target.SessionName, displayOrigin), createdAt: createdAt, target: target}
139139 }
140140
141-// NewRemoteSessionResult creates an immutable catalog-backed remote target.
142-func NewRemoteSessionResult(key domain.RemoteSessionKey, target domain.RemoteSessionTarget, unavailableReason string) Result {
143- return Result{
144- kind: ResultKindRemoteSession,
145- remoteSession: remoteSessionPayload{
146- key: key, target: target, unavailableReason: unavailableReason,
147- },
148- }
149-}
150-
151141 // NewImportedSessionResult creates an immutable inventory-relayed row.
152142 // Labels are never parsed back into selection authority: Enter resolves
153143 // through the opaque source/entry keys.
@@ -138,16 +138,6 @@ func newSessionPayload(target protocol.ExactSessionTarget, createdAt time.Time,
138 return sessionPayload{display: SessionDisplay(target.SessionName, displayOrigin), createdAt: createdAt, target: target}138 return sessionPayload{display: SessionDisplay(target.SessionName, displayOrigin), createdAt: createdAt, target: target}
139 }139 }
140 140
141-// NewRemoteSessionResult creates an immutable catalog-backed remote target.
142-func NewRemoteSessionResult(key domain.RemoteSessionKey, target domain.RemoteSessionTarget, unavailableReason string) Result {
143- return Result{
144- kind: ResultKindRemoteSession,
145- remoteSession: remoteSessionPayload{
146- key: key, target: target, unavailableReason: unavailableReason,
147- },
148- }
149-}
150-
151 // NewImportedSessionResult creates an immutable inventory-relayed row.141 // NewImportedSessionResult creates an immutable inventory-relayed row.
152 // Labels are never parsed back into selection authority: Enter resolves142 // Labels are never parsed back into selection authority: Enter resolves
153 // through the opaque source/entry keys.143 // through the opaque source/entry keys.
M internal/usecase/palette/result_origin_test.go +0 -2
@@ -4,7 +4,6 @@ import (
44 "testing"
55 "time"
66
7- "github.com/bnema/vev/internal/domain"
87 "github.com/stretchr/testify/require"
98 )
109
@@ -18,7 +17,6 @@ func TestSessionResultsAlwaysQualifyClientOrigin(t *testing.T) {
1817 {"hybrid local", NewActiveSessionResultWithDisplayOrigin(testExactTarget("sample", 1), time.Time{}, "local"), "Switch to session sample@local"},
1918 {"serving remote", NewActiveSessionResultWithDisplayOrigin(testExactTarget("sample", 1), time.Time{}, "host-a"), "Switch to session sample@host-a"},
2019 {"imported local", NewImportedSessionResult("local", "key", "sample", "local", "up", ""), "Switch to session sample@local"},
21- {"discovered remote", NewRemoteSessionResult(domain.RemoteSessionKey{Name: "sample", Host: "user@host-a", DisplayOrigin: "host-a"}, domain.RemoteSessionTarget{}, ""), "Switch to session sample@host-a"},
2220 } {
2321 t.Run(tc.name, func(t *testing.T) { require.Equal(t, tc.want, tc.result.DisplayText()) })
2422 }
@@ -4,7 +4,6 @@ import (
4 "testing"4 "testing"
5 "time"5 "time"
6 6
7- "github.com/bnema/vev/internal/domain"
8 "github.com/stretchr/testify/require"7 "github.com/stretchr/testify/require"
9 )8 )
10 9
@@ -18,7 +17,6 @@ func TestSessionResultsAlwaysQualifyClientOrigin(t *testing.T) {
18 {"hybrid local", NewActiveSessionResultWithDisplayOrigin(testExactTarget("sample", 1), time.Time{}, "local"), "Switch to session sample@local"},17 {"hybrid local", NewActiveSessionResultWithDisplayOrigin(testExactTarget("sample", 1), time.Time{}, "local"), "Switch to session sample@local"},
19 {"serving remote", NewActiveSessionResultWithDisplayOrigin(testExactTarget("sample", 1), time.Time{}, "host-a"), "Switch to session sample@host-a"},18 {"serving remote", NewActiveSessionResultWithDisplayOrigin(testExactTarget("sample", 1), time.Time{}, "host-a"), "Switch to session sample@host-a"},
20 {"imported local", NewImportedSessionResult("local", "key", "sample", "local", "up", ""), "Switch to session sample@local"},19 {"imported local", NewImportedSessionResult("local", "key", "sample", "local", "up", ""), "Switch to session sample@local"},
21- {"discovered remote", NewRemoteSessionResult(domain.RemoteSessionKey{Name: "sample", Host: "user@host-a", DisplayOrigin: "host-a"}, domain.RemoteSessionTarget{}, ""), "Switch to session sample@host-a"},
22 } {20 } {
23 t.Run(tc.name, func(t *testing.T) { require.Equal(t, tc.want, tc.result.DisplayText()) })21 t.Run(tc.name, func(t *testing.T) { require.Equal(t, tc.want, tc.result.DisplayText()) })
24 }22 }
M internal/usecase/picker/modal.go +0 -8
@@ -28,11 +28,3 @@ func PreviewRect(terminal domain.Size) domain.Rect {
2828 func Size(rect domain.Rect) domain.Size {
2929 return domain.Size{Cols: rect.Width, Rows: rect.Height}
3030 }
31-
32-// PreviewSize returns the preview viewport for one terminal size: the preview
33-// pane inside the shared modal geometry. A zero size means this terminal has
34-// no room for a preview. The serving daemon and the presenting client both
35-// derive it from PreviewRect, so the captured viewport always fits its pane.
36-func PreviewSize(terminal domain.Size) domain.Size {
37- return Size(PreviewRect(terminal))
38-}
@@ -28,11 +28,3 @@ func PreviewRect(terminal domain.Size) domain.Rect {
28 func Size(rect domain.Rect) domain.Size {28 func Size(rect domain.Rect) domain.Size {
29 return domain.Size{Cols: rect.Width, Rows: rect.Height}29 return domain.Size{Cols: rect.Width, Rows: rect.Height}
30 }30 }
31-
32-// PreviewSize returns the preview viewport for one terminal size: the preview
33-// pane inside the shared modal geometry. A zero size means this terminal has
34-// no room for a preview. The serving daemon and the presenting client both
35-// derive it from PreviewRect, so the captured viewport always fits its pane.
36-func PreviewSize(terminal domain.Size) domain.Size {
37- return Size(PreviewRect(terminal))
38-}

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