ax(node): remove prose description lines from PeerRegistry method comments
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

AX Principle 2: comments show usage examples, not prose descriptions.
Five methods (AddPeer, UpdatePeer, RemovePeer, UpdateMetrics, UpdateScore)
had a redundant "Note: Persistence is debounced..." prose line appended
after the usage example. The usage example already communicates intent;
the prose line restated implementation detail without adding value.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 16:33:20 +01:00
parent 9933c8e5aa
commit 676d7b13a9
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -236,7 +236,6 @@ func (registry *PeerRegistry) ListAllowedPublicKeys() []string {
}
// registry.AddPeer(&Peer{ID: "abc123", Name: "worker-1", Address: "10.0.0.2:9090", Role: RoleWorker})
// Persistence is debounced — call Close() before shutdown to flush all pending writes.
func (registry *PeerRegistry) AddPeer(peer *Peer) error {
registry.mutex.Lock()
@ -272,7 +271,6 @@ func (registry *PeerRegistry) AddPeer(peer *Peer) error {
}
// registry.UpdatePeer(peer) // after handshake completes and real ID is known
// Note: Persistence is debounced. Call Close() to flush before shutdown.
func (registry *PeerRegistry) UpdatePeer(peer *Peer) error {
registry.mutex.Lock()
@ -289,7 +287,6 @@ func (registry *PeerRegistry) UpdatePeer(peer *Peer) error {
}
// registry.RemovePeer(peer.ID) // on manual disconnect or ban
// Note: Persistence is debounced. Call Close() to flush before shutdown.
func (registry *PeerRegistry) RemovePeer(id string) error {
registry.mutex.Lock()
@ -335,7 +332,6 @@ func (registry *PeerRegistry) ListPeers() []*Peer {
}
// registry.UpdateMetrics(peer.ID, rtt, peer.GeoKM, peer.Hops) // after PingPeer
// Note: Persistence is debounced. Call Close() to flush before shutdown.
func (registry *PeerRegistry) UpdateMetrics(id string, pingMS, geoKM float64, hops int) error {
registry.mutex.Lock()
@ -357,7 +353,6 @@ func (registry *PeerRegistry) UpdateMetrics(id string, pingMS, geoKM float64, ho
}
// registry.UpdateScore(peer.ID, 75.0) // clamps to 0-100
// Note: Persistence is debounced. Call Close() to flush before shutdown.
func (registry *PeerRegistry) UpdateScore(id string, score float64) error {
registry.mutex.Lock()