detached 5a12f4f

refactor(protocol): delete dead route origin, target validation, and catalogue helpers

RouteOrigin/valid/Validate and RemoteInventorySourceKey belonged to the old
route model with zero remaining callers or tests. validateRemoteTarget and
catalogue.CatalogTabs likewise have no caller anywhere in the tree.
commit
5a12f4fd2661de6d03d318fbaff3337dcb289d48
author
brice · · 2026-09-23 01:54 UTC
parent
a54aa39
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +1 -44
M internal/protocol/catalogue/catalogue.go +1 -3
@@ -6,7 +6,6 @@ import (
66 "errors"
77 "fmt"
88 "math"
9- "slices"
109 "time"
1110 "unicode"
1211 "unicode/utf8"
@@ -78,8 +77,7 @@ type RemoteCatalogSession struct {
7877 Reason string `json:"reason,omitempty"`
7978 }
8079
81-func CatalogTabs(session RemoteCatalogSession) []RemoteCatalogTab { return slices.Clone(session.Tabs) }
82-func CatalogTabCount(session RemoteCatalogSession) int { return len(session.Tabs) }
80+func CatalogTabCount(session RemoteCatalogSession) int { return len(session.Tabs) }
8381
8482 func SaturateUint16(n int) uint16 {
8583 if n <= 0 {
@@ -6,7 +6,6 @@ import (
6 "errors"6 "errors"
7 "fmt"7 "fmt"
8 "math"8 "math"
9- "slices"
10 "time"9 "time"
11 "unicode"10 "unicode"
12 "unicode/utf8"11 "unicode/utf8"
@@ -78,8 +77,7 @@ type RemoteCatalogSession struct {
78 Reason string `json:"reason,omitempty"`77 Reason string `json:"reason,omitempty"`
79 }78 }
80 79
81-func CatalogTabs(session RemoteCatalogSession) []RemoteCatalogTab { return slices.Clone(session.Tabs) }80+func CatalogTabCount(session RemoteCatalogSession) int { return len(session.Tabs) }
82-func CatalogTabCount(session RemoteCatalogSession) int { return len(session.Tabs) }
83 81
84 func SaturateUint16(n int) uint16 {82 func SaturateUint16(n int) uint16 {
85 if n <= 0 {83 if n <= 0 {
M internal/protocol/routes.go +0 -34
@@ -1,8 +1,6 @@
11 package protocol
22
33 import (
4- "crypto/sha256"
5- "encoding/hex"
64 "errors"
75 "fmt"
86 "unicode"
@@ -15,32 +13,6 @@ import (
1513 // strict route codecs while route values live in the semantic protocol.
1614 var ErrInvalidRouteWire = errors.New("invalid route wire message")
1715
18-// RouteOrigin identifies how a client reached a daemon. The origin is client
19-// composition metadata, not an authority granted to the daemon.
20-type RouteOrigin uint8
21-
22-const (
23- RouteOriginLocal RouteOrigin = iota + 1
24- RouteOriginRemote
25- RouteOriginDiscovery
26-)
27-
28-func (o RouteOrigin) valid() bool {
29- switch o {
30- case RouteOriginLocal, RouteOriginRemote, RouteOriginDiscovery:
31- return true
32- default:
33- return false
34- }
35-}
36-
37-func (o RouteOrigin) Validate() error {
38- if !o.valid() {
39- return errors.New("invalid route origin")
40- }
41- return nil
42-}
43-
4416 // RouteKind identifies the kind of target represented by one display entry.
4517 type RouteKind uint8
4618
@@ -287,12 +259,6 @@ func (r RouteRetired) Validate() error {
287259 return nil
288260 }
289261
290-// RemoteInventorySourceKey identifies a configured endpoint without disclosing it.
291-func RemoteInventorySourceKey(endpoint string) string {
292- sum := sha256.Sum256([]byte("vev-inventory-remote\x00" + endpoint))
293- return NavigationInventoryRemoteSourcePrefix + hex.EncodeToString(sum[:12])
294-}
295-
296262 // RouteAttentionSubscription is the bounded, client-owned mapping a daemon
297263 // uses to resolve live attention and retire authoritatively absent lifecycles.
298264 type RouteAttentionSubscription struct {
@@ -1,8 +1,6 @@
1 package protocol1 package protocol
2 2
3 import (3 import (
4- "crypto/sha256"
5- "encoding/hex"
6 "errors"4 "errors"
7 "fmt"5 "fmt"
8 "unicode"6 "unicode"
@@ -15,32 +13,6 @@ import (
15 // strict route codecs while route values live in the semantic protocol.13 // strict route codecs while route values live in the semantic protocol.
16 var ErrInvalidRouteWire = errors.New("invalid route wire message")14 var ErrInvalidRouteWire = errors.New("invalid route wire message")
17 15
18-// RouteOrigin identifies how a client reached a daemon. The origin is client
19-// composition metadata, not an authority granted to the daemon.
20-type RouteOrigin uint8
21-
22-const (
23- RouteOriginLocal RouteOrigin = iota + 1
24- RouteOriginRemote
25- RouteOriginDiscovery
26-)
27-
28-func (o RouteOrigin) valid() bool {
29- switch o {
30- case RouteOriginLocal, RouteOriginRemote, RouteOriginDiscovery:
31- return true
32- default:
33- return false
34- }
35-}
36-
37-func (o RouteOrigin) Validate() error {
38- if !o.valid() {
39- return errors.New("invalid route origin")
40- }
41- return nil
42-}
43-
44 // RouteKind identifies the kind of target represented by one display entry.16 // RouteKind identifies the kind of target represented by one display entry.
45 type RouteKind uint817 type RouteKind uint8
46 18
@@ -287,12 +259,6 @@ func (r RouteRetired) Validate() error {
287 return nil259 return nil
288 }260 }
289 261
290-// RemoteInventorySourceKey identifies a configured endpoint without disclosing it.
291-func RemoteInventorySourceKey(endpoint string) string {
292- sum := sha256.Sum256([]byte("vev-inventory-remote\x00" + endpoint))
293- return NavigationInventoryRemoteSourcePrefix + hex.EncodeToString(sum[:12])
294-}
295-
296 // RouteAttentionSubscription is the bounded, client-owned mapping a daemon262 // RouteAttentionSubscription is the bounded, client-owned mapping a daemon
297 // uses to resolve live attention and retire authoritatively absent lifecycles.263 // uses to resolve live attention and retire authoritatively absent lifecycles.
298 type RouteAttentionSubscription struct {264 type RouteAttentionSubscription struct {
M internal/protocol/session.go +0 -7
@@ -529,10 +529,3 @@ func ValidateAttachTarget(m AttachTarget) error {
529529 }
530530 return nil
531531 }
532-
533-func validateRemoteTarget(target domain.RemoteSessionTarget) error {
534- if len(target.Endpoint) > math.MaxUint16 || len(target.DisplayOrigin) > math.MaxUint16 || len(target.SessionName) > math.MaxUint16 || len(target.LiveTabID) > math.MaxUint16 || len(target.StoppedTab.RawName) > math.MaxUint16 {
535- return errors.New("remote target string too long")
536- }
537- return target.Validate()
538-}
@@ -529,10 +529,3 @@ func ValidateAttachTarget(m AttachTarget) error {
529 }529 }
530 return nil530 return nil
531 }531 }
532-
533-func validateRemoteTarget(target domain.RemoteSessionTarget) error {
534- if len(target.Endpoint) > math.MaxUint16 || len(target.DisplayOrigin) > math.MaxUint16 || len(target.SessionName) > math.MaxUint16 || len(target.LiveTabID) > math.MaxUint16 || len(target.StoppedTab.RawName) > math.MaxUint16 {
535- return errors.New("remote target string too long")
536- }
537- return target.Validate()
538-}

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