detached f519cfa

fix(palette): retain distinct local routes remotely

commit
f519cfa514351350c151db564e451e543671159a
author
brice · · 2026-08-11 09:46 UTC
committer
brice · · 2026-08-11 09:47 UTC
parent
5ed306e
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +17 -5
M internal/usecase/daemon/palette.go +10 -3
@@ -107,11 +107,18 @@ func (d *Daemon) paletteResults(current *session, commands []command.Command, ro
107107 continue
108108 }
109109 if _, represented := localNames[entry.Name]; represented {
110- localRoute := entry.Kind == ports.RouteKindLocal
111- currentRemoteRoute := entry.Kind == ports.RouteKindRemote && currentRemoteOrigin != "" && entry.HostLabel == currentRemoteOrigin
112- if localRoute || currentRemoteRoute {
110+ sameOrigin := (entry.Kind == ports.RouteKindLocal && currentRemoteOrigin == "") ||
111+ (entry.Kind == ports.RouteKindRemote && currentRemoteOrigin != "" && entry.HostLabel == currentRemoteOrigin)
112+ if sameOrigin {
113113 continue
114114 }
115+ if entry.Kind == ports.RouteKindLocal && currentRemoteOrigin != "" {
116+ label = formatRecentRouteName(recentRoutePresentation{
117+ name: entry.Name,
118+ kind: recentRouteLocal,
119+ ephemeral: entry.Ephemeral,
120+ }, true)
121+ }
115122 }
116123 results = append(results, palette.NewRecentRouteResult(label, ports.RouteNavigationAction{
117124 SnapshotGeneration: routeSnapshot.Generation,
@@ -107,11 +107,18 @@ func (d *Daemon) paletteResults(current *session, commands []command.Command, ro
107 continue107 continue
108 }108 }
109 if _, represented := localNames[entry.Name]; represented {109 if _, represented := localNames[entry.Name]; represented {
110- localRoute := entry.Kind == ports.RouteKindLocal110+ sameOrigin := (entry.Kind == ports.RouteKindLocal && currentRemoteOrigin == "") ||
111- currentRemoteRoute := entry.Kind == ports.RouteKindRemote && currentRemoteOrigin != "" && entry.HostLabel == currentRemoteOrigin111+ (entry.Kind == ports.RouteKindRemote && currentRemoteOrigin != "" && entry.HostLabel == currentRemoteOrigin)
112- if localRoute || currentRemoteRoute {112+ if sameOrigin {
113 continue113 continue
114 }114 }
115+ if entry.Kind == ports.RouteKindLocal && currentRemoteOrigin != "" {
116+ label = formatRecentRouteName(recentRoutePresentation{
117+ name: entry.Name,
118+ kind: recentRouteLocal,
119+ ephemeral: entry.Ephemeral,
120+ }, true)
121+ }
115 }122 }
116 results = append(results, palette.NewRecentRouteResult(label, ports.RouteNavigationAction{123 results = append(results, palette.NewRecentRouteResult(label, ports.RouteNavigationAction{
117 SnapshotGeneration: routeSnapshot.Generation,124 SnapshotGeneration: routeSnapshot.Generation,
M internal/usecase/daemon/palette_test.go +7 -2
@@ -438,13 +438,18 @@ func TestPaletteResultsDeduplicateRoutesLocalToCurrentRemoteDaemon(t *testing.T)
438438 want []string
439439 }{
440440 {name: "remote daemon", currentOrigin: "remote", want: []string{"Switch to session remote-manual"}},
441+ {name: "remote daemon keeps distinct local route", currentOrigin: "remote", want: []string{"Switch to session remote-manual", "Switch to session remote-manual@local"}},
441442 {name: "home daemon keeps distinct remote", want: []string{"Switch to session remote-manual", "Switch to session remote-manual@remote"}},
442443 } {
443444 t.Run(test.name, func(t *testing.T) {
444- results := d.paletteResults(current, nil, snapshot, test.currentOrigin)
445+ testSnapshot := snapshot
446+ if test.name == "remote daemon keeps distinct local route" {
447+ testSnapshot.Entries = append(testSnapshot.Entries, ports.RecentRouteEntry{Key: 3, Generation: 1, Name: "remote-manual", Kind: ports.RouteKindLocal})
448+ }
449+ results := d.paletteResults(current, nil, testSnapshot, test.currentOrigin)
445450 var matching []string
446451 for _, result := range results {
447- if result.DisplayText() == "Switch to session remote-manual" || result.DisplayText() == "Switch to session remote-manual@remote" {
452+ if result.DisplayText() == "Switch to session remote-manual" || result.DisplayText() == "Switch to session remote-manual@local" || result.DisplayText() == "Switch to session remote-manual@remote" {
448453 matching = append(matching, result.DisplayText())
449454 }
450455 }
@@ -438,13 +438,18 @@ func TestPaletteResultsDeduplicateRoutesLocalToCurrentRemoteDaemon(t *testing.T)
438 want []string438 want []string
439 }{439 }{
440 {name: "remote daemon", currentOrigin: "remote", want: []string{"Switch to session remote-manual"}},440 {name: "remote daemon", currentOrigin: "remote", want: []string{"Switch to session remote-manual"}},
441+ {name: "remote daemon keeps distinct local route", currentOrigin: "remote", want: []string{"Switch to session remote-manual", "Switch to session remote-manual@local"}},
441 {name: "home daemon keeps distinct remote", want: []string{"Switch to session remote-manual", "Switch to session remote-manual@remote"}},442 {name: "home daemon keeps distinct remote", want: []string{"Switch to session remote-manual", "Switch to session remote-manual@remote"}},
442 } {443 } {
443 t.Run(test.name, func(t *testing.T) {444 t.Run(test.name, func(t *testing.T) {
444- results := d.paletteResults(current, nil, snapshot, test.currentOrigin)445+ testSnapshot := snapshot
446+ if test.name == "remote daemon keeps distinct local route" {
447+ testSnapshot.Entries = append(testSnapshot.Entries, ports.RecentRouteEntry{Key: 3, Generation: 1, Name: "remote-manual", Kind: ports.RouteKindLocal})
448+ }
449+ results := d.paletteResults(current, nil, testSnapshot, test.currentOrigin)
445 var matching []string450 var matching []string
446 for _, result := range results {451 for _, result := range results {
447- if result.DisplayText() == "Switch to session remote-manual" || result.DisplayText() == "Switch to session remote-manual@remote" {452+ if result.DisplayText() == "Switch to session remote-manual" || result.DisplayText() == "Switch to session remote-manual@local" || result.DisplayText() == "Switch to session remote-manual@remote" {
448 matching = append(matching, result.DisplayText())453 matching = append(matching, result.DisplayText())
449 }454 }
450 }455 }

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