detached 357815c

refactor(app): drop the no-op broker ready reconnect flag

commit
357815cd16faba89c27d0653a5c6212d541966e4
author
brice · · 2026-09-23 14:45 UTC
committer
brice · · 2026-09-23 14:49 UTC
parent
d98363f
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +9 -14
M internal/app/broker_ready.go +8 -11
@@ -143,22 +143,19 @@ func runBrokerReady(ctx context.Context, o brokerReadyOptions, out io.Writer) er
143143 }
144144 continue
145145 }
146- result, reconnect := observeBrokerReady(deadline, o, service)
146+ result := observeBrokerReady(deadline, o, service)
147147 _ = service.Close()
148148 if result != nil {
149149 return emitReady(out, *result)
150150 }
151- if !reconnect {
152- continue
153- }
154151 }
155152 }
156153
157-func observeBrokerReady(ctx context.Context, o brokerReadyOptions, service ports.BrokerService) (*brokerReadyResult, bool) {
154+func observeBrokerReady(ctx context.Context, o brokerReadyOptions, service ports.BrokerService) *brokerReadyResult {
158155 sub, err := service.Subscribe()
159156 if err != nil {
160157 r := readyResult(o, "terminal", "protocol", nil)
161- return &r, false
158+ return &r
162159 }
163160 defer sub.Close()
164161 for {
@@ -166,7 +163,7 @@ func observeBrokerReady(ctx context.Context, o brokerReadyOptions, service ports
166163 if snapshot.Epoch != 0 {
167164 if snapshot.Validate() != nil {
168165 r := readyResult(o, "terminal", "protocol", nil)
169- return &r, false
166+ return &r
170167 }
171168 locals := make([]ports.BrokerDaemonObservation, 0, 1)
172169 for _, d := range snapshot.Daemons {
@@ -176,20 +173,20 @@ func observeBrokerReady(ctx context.Context, o brokerReadyOptions, service ports
176173 }
177174 if len(locals) > 1 {
178175 r := readyResult(o, "terminal", "protocol", nil)
179- return &r, false
176+ return &r
180177 }
181178 if len(locals) == 1 {
182179 r := evaluateReady(o, snapshot, locals[0])
183180 if r.Status == "ready" || r.Status == "terminal" {
184- return &r, false
181+ return &r
185182 }
186183 }
187184 }
188185 select {
189186 case <-ctx.Done():
190- return nil, false
187+ return nil
191188 case <-service.Done():
192- return nil, true
189+ return nil
193190 case <-sub.Changed():
194191 }
195192 }
@@ -143,22 +143,19 @@ func runBrokerReady(ctx context.Context, o brokerReadyOptions, out io.Writer) er
143 }143 }
144 continue144 continue
145 }145 }
146- result, reconnect := observeBrokerReady(deadline, o, service)146+ result := observeBrokerReady(deadline, o, service)
147 _ = service.Close()147 _ = service.Close()
148 if result != nil {148 if result != nil {
149 return emitReady(out, *result)149 return emitReady(out, *result)
150 }150 }
151- if !reconnect {
152- continue
153- }
154 }151 }
155 }152 }
156 153
157-func observeBrokerReady(ctx context.Context, o brokerReadyOptions, service ports.BrokerService) (*brokerReadyResult, bool) {154+func observeBrokerReady(ctx context.Context, o brokerReadyOptions, service ports.BrokerService) *brokerReadyResult {
158 sub, err := service.Subscribe()155 sub, err := service.Subscribe()
159 if err != nil {156 if err != nil {
160 r := readyResult(o, "terminal", "protocol", nil)157 r := readyResult(o, "terminal", "protocol", nil)
161- return &r, false158+ return &r
162 }159 }
163 defer sub.Close()160 defer sub.Close()
164 for {161 for {
@@ -166,7 +163,7 @@ func observeBrokerReady(ctx context.Context, o brokerReadyOptions, service ports
166 if snapshot.Epoch != 0 {163 if snapshot.Epoch != 0 {
167 if snapshot.Validate() != nil {164 if snapshot.Validate() != nil {
168 r := readyResult(o, "terminal", "protocol", nil)165 r := readyResult(o, "terminal", "protocol", nil)
169- return &r, false166+ return &r
170 }167 }
171 locals := make([]ports.BrokerDaemonObservation, 0, 1)168 locals := make([]ports.BrokerDaemonObservation, 0, 1)
172 for _, d := range snapshot.Daemons {169 for _, d := range snapshot.Daemons {
@@ -176,20 +173,20 @@ func observeBrokerReady(ctx context.Context, o brokerReadyOptions, service ports
176 }173 }
177 if len(locals) > 1 {174 if len(locals) > 1 {
178 r := readyResult(o, "terminal", "protocol", nil)175 r := readyResult(o, "terminal", "protocol", nil)
179- return &r, false176+ return &r
180 }177 }
181 if len(locals) == 1 {178 if len(locals) == 1 {
182 r := evaluateReady(o, snapshot, locals[0])179 r := evaluateReady(o, snapshot, locals[0])
183 if r.Status == "ready" || r.Status == "terminal" {180 if r.Status == "ready" || r.Status == "terminal" {
184- return &r, false181+ return &r
185 }182 }
186 }183 }
187 }184 }
188 select {185 select {
189 case <-ctx.Done():186 case <-ctx.Done():
190- return nil, false187+ return nil
191 case <-service.Done():188 case <-service.Done():
192- return nil, true189+ return nil
193 case <-sub.Changed():190 case <-sub.Changed():
194 }191 }
195 }192 }
M internal/app/broker_ready_test.go +1 -3
@@ -590,9 +590,7 @@ func TestBrokerReadyObservationTable(t *testing.T) {
590590 ctx, cancel := context.WithTimeout(context.Background(), readyTestObserveMax)
591591 defer cancel()
592592
593- result, reconnect := observeBrokerReady(ctx, brokerReadyOptions{require: tt.require, timeout: time.Second, maxAge: time.Second}, service)
594-
595- require.False(t, reconnect, "a terminal or satisfied observation never reconnects")
593+ result := observeBrokerReady(ctx, brokerReadyOptions{require: tt.require, timeout: time.Second, maxAge: time.Second}, service)
596594 require.Empty(t, service.mutationNames(), "readiness must never open a stream, reconcile, or mutate membership")
597595 if tt.subErr != nil {
598596 require.Zero(t, service.subscriptionCloses(), "a refused subscription is never closed as if it existed")
@@ -590,9 +590,7 @@ func TestBrokerReadyObservationTable(t *testing.T) {
590 ctx, cancel := context.WithTimeout(context.Background(), readyTestObserveMax)590 ctx, cancel := context.WithTimeout(context.Background(), readyTestObserveMax)
591 defer cancel()591 defer cancel()
592 592
593- result, reconnect := observeBrokerReady(ctx, brokerReadyOptions{require: tt.require, timeout: time.Second, maxAge: time.Second}, service)593+ result := observeBrokerReady(ctx, brokerReadyOptions{require: tt.require, timeout: time.Second, maxAge: time.Second}, service)
594-
595- require.False(t, reconnect, "a terminal or satisfied observation never reconnects")
596 require.Empty(t, service.mutationNames(), "readiness must never open a stream, reconcile, or mutate membership")594 require.Empty(t, service.mutationNames(), "readiness must never open a stream, reconcile, or mutate membership")
597 if tt.subErr != nil {595 if tt.subErr != nil {
598 require.Zero(t, service.subscriptionCloses(), "a refused subscription is never closed as if it existed")596 require.Zero(t, service.subscriptionCloses(), "a refused subscription is never closed as if it existed")

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