detached 26fe86a

refactor(broker): carry NoDaemon on the wire without compatibility shims

commit
26fe86a4807909dfd76556815335b7eee34779bb
author
brice · · 2026-09-23 08:21 UTC
parent
1d7fc8e
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +12 -1
M internal/adapters/brokeripc/limits_test.go +1 -0
@@ -223,6 +223,7 @@ func TestErrorDetailMapping(t *testing.T) {
223223 admission uint32
224224 }{
225225 {"typed", ports.BrokerError{Code: ports.BrokerErrorIncompatible, Text: "no"}, ports.BrokerErrorIncompatible, 0},
226+ {"no daemon", ports.BrokerError{Code: ports.BrokerErrorNoDaemon, Text: "remote daemon is absent"}, ports.BrokerErrorNoDaemon, 0},
226227 {"limit", ports.BrokerAdmissionLimit, ports.BrokerErrorUnavailable, 1},
227228 {"closed", ports.BrokerAdmissionClosed, ports.BrokerErrorUnavailable, 2},
228229 {"stale", ports.BrokerAdmissionStale, ports.BrokerErrorUnavailable, 3},
@@ -223,6 +223,7 @@ func TestErrorDetailMapping(t *testing.T) {
223 admission uint32223 admission uint32
224 }{224 }{
225 {"typed", ports.BrokerError{Code: ports.BrokerErrorIncompatible, Text: "no"}, ports.BrokerErrorIncompatible, 0},225 {"typed", ports.BrokerError{Code: ports.BrokerErrorIncompatible, Text: "no"}, ports.BrokerErrorIncompatible, 0},
226+ {"no daemon", ports.BrokerError{Code: ports.BrokerErrorNoDaemon, Text: "remote daemon is absent"}, ports.BrokerErrorNoDaemon, 0},
226 {"limit", ports.BrokerAdmissionLimit, ports.BrokerErrorUnavailable, 1},227 {"limit", ports.BrokerAdmissionLimit, ports.BrokerErrorUnavailable, 1},
227 {"closed", ports.BrokerAdmissionClosed, ports.BrokerErrorUnavailable, 2},228 {"closed", ports.BrokerAdmissionClosed, ports.BrokerErrorUnavailable, 2},
228 {"stale", ports.BrokerAdmissionStale, ports.BrokerErrorUnavailable, 3},229 {"stale", ports.BrokerAdmissionStale, ports.BrokerErrorUnavailable, 3},
M internal/adapters/brokerwire/codec.go +1 -1
@@ -1239,7 +1239,7 @@ func snapshotDaemonFromWire(message *wire.SnapshotDaemon) (ports.BrokerDaemonObs
12391239 if err != nil {
12401240 return daemon, 0, 0, ErrInvalidMessage
12411241 }
1242- if availability < domain.RemoteAvailabilityUnknown || availability > domain.RemoteAvailabilityInvalidResponse {
1242+ if availability < domain.RemoteAvailabilityUnknown || availability > domain.RemoteAvailabilityNoDaemon {
12431243 return daemon, 0, 0, ErrInvalidMessage
12441244 }
12451245 failureKind, err := brokerEnum8[domain.RemoteFailureKind](message.GetFailureKind())
@@ -1239,7 +1239,7 @@ func snapshotDaemonFromWire(message *wire.SnapshotDaemon) (ports.BrokerDaemonObs
1239 if err != nil {1239 if err != nil {
1240 return daemon, 0, 0, ErrInvalidMessage1240 return daemon, 0, 0, ErrInvalidMessage
1241 }1241 }
1242- if availability < domain.RemoteAvailabilityUnknown || availability > domain.RemoteAvailabilityInvalidResponse {1242+ if availability < domain.RemoteAvailabilityUnknown || availability > domain.RemoteAvailabilityNoDaemon {
1243 return daemon, 0, 0, ErrInvalidMessage1243 return daemon, 0, 0, ErrInvalidMessage
1244 }1244 }
1245 failureKind, err := brokerEnum8[domain.RemoteFailureKind](message.GetFailureKind())1245 failureKind, err := brokerEnum8[domain.RemoteFailureKind](message.GetFailureKind())
M internal/adapters/sessionwire/picker_interaction_test.go +10 -0
@@ -106,6 +106,16 @@ func TestPickerServerMessagesEncodeWithTypes(t *testing.T) {
106106 }
107107 }
108108
109+func TestPickerSnapshotNoDaemonStatusRoundTrips(t *testing.T) {
110+ line := protocol.PickerLine{Status: protocol.PickerLineStatusNoDaemon, StatusDetail: "no daemon — Enter to create a session"}
111+ encoded := pickerLineToWire(line)
112+ require.Equal(t, uint32(protocol.PickerLineStatusNoDaemon), encoded.GetStatus())
113+ require.Equal(t, line.StatusDetail, encoded.GetStatusDetail())
114+ decoded, err := pickerLineFromWire(encoded)
115+ require.NoError(t, err)
116+ require.Equal(t, line, decoded)
117+}
118+
109119 func TestPickerSnapshotNormalizesIntoProjections(t *testing.T) {
110120 snapshot := pickerWireSnapshot()
111121 raw := &scriptedTransport{}
@@ -106,6 +106,16 @@ func TestPickerServerMessagesEncodeWithTypes(t *testing.T) {
106 }106 }
107 }107 }
108 108
109+func TestPickerSnapshotNoDaemonStatusRoundTrips(t *testing.T) {
110+ line := protocol.PickerLine{Status: protocol.PickerLineStatusNoDaemon, StatusDetail: "no daemon — Enter to create a session"}
111+ encoded := pickerLineToWire(line)
112+ require.Equal(t, uint32(protocol.PickerLineStatusNoDaemon), encoded.GetStatus())
113+ require.Equal(t, line.StatusDetail, encoded.GetStatusDetail())
114+ decoded, err := pickerLineFromWire(encoded)
115+ require.NoError(t, err)
116+ require.Equal(t, line, decoded)
117+}
118+
109 func TestPickerSnapshotNormalizesIntoProjections(t *testing.T) {119 func TestPickerSnapshotNormalizesIntoProjections(t *testing.T) {
110 snapshot := pickerWireSnapshot()120 snapshot := pickerWireSnapshot()
111 raw := &scriptedTransport{}121 raw := &scriptedTransport{}

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