detached 05bb4e9

refactor(ports): delete dead broker completion staleness and job kind stringer

BrokerCompletionIsStale and its dedicated test had no production caller and
no other test exercising the same behavior through a live path.
RemoteJobKind.String is never invoked, directly or through %v formatting, in
production or tests.
commit
05bb4e9b6439a6196882c14e98b001338c51e037
author
brice · · 2026-09-23 01:54 UTC
parent
5a12f4f
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +0 -55
M internal/ports/broker.go +0 -14
@@ -336,20 +336,6 @@ func (s BrokerSnapshot) Supersedes(other BrokerSnapshot) bool {
336336 return s.Revision > other.Revision
337337 }
338338
339-// BrokerCompletionIsStale reports whether a probe or operation completion
340-// must be rejected: a different broker epoch, or a registration that no
341-// longer exactly matches current authority (endpoint, incarnation, and
342-// generation must all match).
343-func BrokerCompletionIsStale(currentRegistration domain.RemoteRegistration, currentEpoch BrokerEpoch, completionRegistration domain.RemoteRegistration, completionEpoch BrokerEpoch) bool {
344- if currentEpoch == 0 || completionEpoch == 0 {
345- return true
346- }
347- if currentEpoch != completionEpoch {
348- return true
349- }
350- return !currentRegistration.Equal(completionRegistration)
351-}
352-
353339 // BrokerStreamAdmission is the closed attachment-admission taxonomy
354340 // (Plan 001 P5.3a, contract-only until the admission slice wires it):
355341 // an attachment stream names exactly how the daemon must admit it.
@@ -336,20 +336,6 @@ func (s BrokerSnapshot) Supersedes(other BrokerSnapshot) bool {
336 return s.Revision > other.Revision336 return s.Revision > other.Revision
337 }337 }
338 338
339-// BrokerCompletionIsStale reports whether a probe or operation completion
340-// must be rejected: a different broker epoch, or a registration that no
341-// longer exactly matches current authority (endpoint, incarnation, and
342-// generation must all match).
343-func BrokerCompletionIsStale(currentRegistration domain.RemoteRegistration, currentEpoch BrokerEpoch, completionRegistration domain.RemoteRegistration, completionEpoch BrokerEpoch) bool {
344- if currentEpoch == 0 || completionEpoch == 0 {
345- return true
346- }
347- if currentEpoch != completionEpoch {
348- return true
349- }
350- return !currentRegistration.Equal(completionRegistration)
351-}
352-
353 // BrokerStreamAdmission is the closed attachment-admission taxonomy339 // BrokerStreamAdmission is the closed attachment-admission taxonomy
354 // (Plan 001 P5.3a, contract-only until the admission slice wires it):340 // (Plan 001 P5.3a, contract-only until the admission slice wires it):
355 // an attachment stream names exactly how the daemon must admit it.341 // an attachment stream names exactly how the daemon must admit it.
M internal/ports/broker_test.go +0 -25
@@ -326,31 +326,6 @@ func TestBrokerTombstoneFencing(t *testing.T) {
326326 }
327327 }
328328
329-func TestBrokerCompletionStaleRejection(t *testing.T) {
330- current := testBrokerRegistration("user@arch", 4, 2)
331- tests := []struct {
332- name string
333- currentEpoch BrokerEpoch
334- completion domain.RemoteRegistration
335- completionEp BrokerEpoch
336- wantStale bool
337- }{
338- {name: "exact match applies", currentEpoch: 3, completion: current, completionEp: 3, wantStale: false},
339- {name: "epoch change stale", currentEpoch: 4, completion: current, completionEp: 3, wantStale: true},
340- {name: "generation bump stalls old", currentEpoch: 3, completion: testBrokerRegistration("user@arch", 4, 1), completionEp: 3, wantStale: true},
341- {name: "re-add incarnation stalls old", currentEpoch: 3, completion: testBrokerRegistration("user@arch", 5, 1), completionEp: 3, wantStale: true},
342- {name: "zero epoch stale", currentEpoch: 0, completion: current, completionEp: 3, wantStale: true},
343- {name: "zero completion epoch stale", currentEpoch: 3, completion: current, completionEp: 0, wantStale: true},
344- }
345- for _, tt := range tests {
346- t.Run(tt.name, func(t *testing.T) {
347- if got := BrokerCompletionIsStale(current, tt.currentEpoch, tt.completion, tt.completionEp); got != tt.wantStale {
348- t.Fatalf("BrokerCompletionIsStale() = %t, want %t", got, tt.wantStale)
349- }
350- })
351- }
352-}
353-
354329 func TestBrokerPolicyCompatibility(t *testing.T) {
355330 base := testBrokerPolicy()
356331 if err := base.Validate(); err != nil {
@@ -326,31 +326,6 @@ func TestBrokerTombstoneFencing(t *testing.T) {
326 }326 }
327 }327 }
328 328
329-func TestBrokerCompletionStaleRejection(t *testing.T) {
330- current := testBrokerRegistration("user@arch", 4, 2)
331- tests := []struct {
332- name string
333- currentEpoch BrokerEpoch
334- completion domain.RemoteRegistration
335- completionEp BrokerEpoch
336- wantStale bool
337- }{
338- {name: "exact match applies", currentEpoch: 3, completion: current, completionEp: 3, wantStale: false},
339- {name: "epoch change stale", currentEpoch: 4, completion: current, completionEp: 3, wantStale: true},
340- {name: "generation bump stalls old", currentEpoch: 3, completion: testBrokerRegistration("user@arch", 4, 1), completionEp: 3, wantStale: true},
341- {name: "re-add incarnation stalls old", currentEpoch: 3, completion: testBrokerRegistration("user@arch", 5, 1), completionEp: 3, wantStale: true},
342- {name: "zero epoch stale", currentEpoch: 0, completion: current, completionEp: 3, wantStale: true},
343- {name: "zero completion epoch stale", currentEpoch: 3, completion: current, completionEp: 0, wantStale: true},
344- }
345- for _, tt := range tests {
346- t.Run(tt.name, func(t *testing.T) {
347- if got := BrokerCompletionIsStale(current, tt.currentEpoch, tt.completion, tt.completionEp); got != tt.wantStale {
348- t.Fatalf("BrokerCompletionIsStale() = %t, want %t", got, tt.wantStale)
349- }
350- })
351- }
352-}
353-
354 func TestBrokerPolicyCompatibility(t *testing.T) {329 func TestBrokerPolicyCompatibility(t *testing.T) {
355 base := testBrokerPolicy()330 base := testBrokerPolicy()
356 if err := base.Validate(); err != nil {331 if err := base.Validate(); err != nil {
M internal/ports/remote_runtime.go +0 -16
@@ -20,22 +20,6 @@ const (
2020 RemoteJobCacheStore
2121 )
2222
23-// String returns the stable lowercase token for a job kind.
24-func (k RemoteJobKind) String() string {
25- switch k {
26- case RemoteJobRegistryRead:
27- return "registry_read"
28- case RemoteJobCacheLoad:
29- return "cache_load"
30- case RemoteJobCatalogObserve:
31- return "catalog_observe"
32- case RemoteJobCacheStore:
33- return "cache_store"
34- default:
35- return "unknown"
36- }
37-}
38-
3923 // RemoteJob is one admitted unit of remote work. Registration and Generation
4024 // fence the job: results bound to a superseded registration never apply.
4125 // Deadline bounds catalogue observation; Entries carries cache-store payload.
@@ -20,22 +20,6 @@ const (
20 RemoteJobCacheStore20 RemoteJobCacheStore
21 )21 )
22 22
23-// String returns the stable lowercase token for a job kind.
24-func (k RemoteJobKind) String() string {
25- switch k {
26- case RemoteJobRegistryRead:
27- return "registry_read"
28- case RemoteJobCacheLoad:
29- return "cache_load"
30- case RemoteJobCatalogObserve:
31- return "catalog_observe"
32- case RemoteJobCacheStore:
33- return "cache_store"
34- default:
35- return "unknown"
36- }
37-}
38-
39 // RemoteJob is one admitted unit of remote work. Registration and Generation23 // RemoteJob is one admitted unit of remote work. Registration and Generation
40 // fence the job: results bound to a superseded registration never apply.24 // fence the job: results bound to a superseded registration never apply.
41 // Deadline bounds catalogue observation; Entries carries cache-store payload.25 // Deadline bounds catalogue observation; Entries carries cache-store payload.

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