AX Principle 2: comments restate the signature — replace with a concrete
call showing realistic values and the debounce behaviour as a note.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show HOW with real values, not WHAT the function does.
"checks if a public key is in the allowlist" restates the signature — replaced
with a concrete call example.
Co-Authored-By: Charon <charon@lethean.io>
GenerateChallenge, SignChallenge, and VerifyChallenge had comments that
restated what the type signature already says. Replaced with concrete call
examples showing how each function is used in the handshake flow (AX §2).
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show HOW with real values, not WHAT the signature
already says. The prose "creates an encrypted bundle containing a mining
profile" restates the type signature — deleted in favour of a concrete call.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show HOW with real values, not restate the
type signature in prose. The previous comments added zero information.
Co-Authored-By: Charon <charon@lethean.io>
SetAuthMode, GetAuthMode, AllowPublicKey, and RevokePublicKey all had
comments that restated the function signature rather than showing concrete
usage. Replaced with call-site examples per AX Principle 2.
Co-Authored-By: Charon <charon@lethean.io>
Line 715 contained "// Example usage inside a connection handler" with no
code following it — a prose description stub with no usage example. This
violates AX Principle 2 (comments must show concrete usage with real values,
not describe intent in prose).
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments that restate the type signature add zero information.
Replace with a concrete usage example showing how the return value is used.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show HOW with real values, not WHAT the
signature already states. "GetPeer returns a peer by ID" restates
the function name — replaced with a concrete call pattern.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments show HOW with real values, not what the
signature already says. "returns true if the error is a ProtocolError"
restates the type; a concrete call pattern teaches agents how to use it.
Co-Authored-By: Charon <charon@lethean.io>
TestConvenienceFunctions violated AX Principle 1 (predictable names — "ConvenienceFunctions"
is a vague label, not a description of what is tested) and Principle 10 (test naming must
follow TestFilename_Function_{Good,Bad,Ugly}).
Renamed to TestProtocol_DefaultHandler_Good, added a usage-example doc comment per
Principle 2.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: ch is an opaque abbreviation for a response channel — rename
to channel so the variable's role is predictable without tracing the map type.
AX Principle 2: "handleResponse processes incoming messages…" restates the
signature. Replaced with a concrete usage example showing how it is wired.
Co-Authored-By: Charon <charon@lethean.io>
Package-level regexp.MustCompile panics at startup on invalid pattern —
the Must* form explicitly banned by AX RFC-025 §6 (no hidden panics).
Move pattern to a const and compile via regexp.Compile inside the function.
Co-Authored-By: Charon <charon@lethean.io>
HasIdentity, GetIdentity, and GenerateIdentity had comments that
restated the type signature rather than showing concrete call patterns.
Replaced with AX-compliant usage examples per RFC-025 Principle 2.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show HOW with real values, not WHAT the type
signature already says. "Send sends an encrypted message over the
connection." adds zero information.
Co-Authored-By: Charon <charon@lethean.io>
All private handler function comments restated what the function name
already said (AX Principle 2 violation). Replaced with concrete call
examples showing how each handler is invoked.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show HOW with real values, not WHAT the
signature already says. "processes incoming messages and returns a
response" restates the signature; the usage example shows how
HandleMessage is wired up via RegisterWithTransport.
Co-Authored-By: Charon <charon@lethean.io>
Replace fmt.Errorf with a local testErr type to eliminate the banned
fmt import. The type carries its own usage example comment per AX
Principle 2.
Co-Authored-By: Charon <charon@lethean.io>
ProtocolError and ResponseHandler had prose descriptions restating
their names — AX Principle 2 violation. Replaced with concrete call
examples showing how callers use each type.
Co-Authored-By: Charon <charon@lethean.io>
ConnectedPeers() had a comment that restated the function name ("returns
the number of connected peers"), violating AX Principle 2. Replaced with
a concrete usage example showing the guard pattern.
Co-Authored-By: Charon <charon@lethean.io>
Dimension weights are never reassigned — declaring them as mutable vars
implies changeability that does not exist. Const declares what IS (AX §5).
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments show HOW with real values, not WHAT the
signature already says. The old comment restated the method name;
the new comment shows the exact call pattern used in transport.go.
Co-Authored-By: Charon <charon@lethean.io>
AX principle 10 requires all three categories (Good, Bad, Ugly) per
function. lethean_test.go had only Good for parseComment; Bad (invalid
input, missing keys, empty values) and Ugly (empty string, semicolons
only, duplicate keys, value-with-equals) are now present.
Co-Authored-By: Charon <charon@lethean.io>
Renamed `allowedPublicKeyMu` to `allowedPublicKeyMutex` in PeerRegistry.
`Mu` is an abbreviation that violates AX Principle 1 (predictable names
over short names) — the full word `Mutex` removes any ambiguity about
what the field represents.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. `resp` and `raw`
require mental mapping; `response` and `responseBody` are self-describing.
Co-Authored-By: Charon <charon@lethean.io>
'wg' is an abbreviation requiring mental mapping; 'waitGroup' names what
it IS — an explicit sync.WaitGroup, predictable across all call sites.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments must show HOW with real values, not describe
WHAT the signature already says. Replaced three prose descriptions on
getBuffer, putBuffer, and MarshalJSON with concrete call-site examples.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments that restate the type signature add zero
information. Replaced "Send sends a message to a specific peer." with a
concrete call-site example showing error handling.
Co-Authored-By: Charon <charon@lethean.io>
PingPeer, ConnectToPeer, and DisconnectFromPeer had comments that
restated the signature in prose. AX-2 requires concrete call examples,
not descriptions. Replaced all three with usage-example comments.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments as usage examples, not restatements of the
signature. "Count returns the number of registered peers." says nothing
the signature does not already say. Replaced with a concrete call site.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments that restate the function name add zero
information. Replace with a concrete call pattern showing iteration
over the returned map.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. `mu` and `wg` require
mental mapping; `resultsMutex` and `waitGroup` state their purpose directly.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names.
`respCh` is an abbreviated compound; `responseChannel` is
unambiguous without context.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle #1: names must not require a comment to explain.
The comment "Calculate round-trip time" existed solely to decode
the abbreviation rtt — proof the name was too short.
Co-Authored-By: Charon <charon@lethean.io>
geo is an abbreviation that requires domain knowledge to parse;
geographicWeight makes the dimension self-describing.
Co-Authored-By: Charon <charon@lethean.io>