`pr` abbreviates PeerRegistry — violates AX Principle 1
(predictable names over short names). Renamed to `registry`
so the variable is self-describing without context.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments show HOW with real values, not what the
signature already says. The previous comment restated the method name
as prose; replaced with a concrete call pattern.
Co-Authored-By: Charon <charon@lethean.io>
Abbreviated field name `mu` is ambiguous — rename to `mutex` to satisfy
AX-025 §1 (predictable names over short names).
Co-Authored-By: Charon <charon@lethean.io>
TestConvertMinerStats did not follow the AX Principle 10 test naming
convention (TestFilename_Function_{Good,Bad,Ugly}). Renamed to
TestWorker_ConvertMinerStats_Good to match the required pattern.
Co-Authored-By: Charon <charon@lethean.io>
Controller type and sendRequest had comments that restated the type
signature in prose. RFC-025 §2: if a comment restates what the type
signature says, delete it; show a concrete call instead.
Co-Authored-By: Charon <charon@lethean.io>
AX-1 (Predictable Names): abbreviated field names require mental mapping.
mutex and saveMutex are self-describing; mu and saveMu are not.
Co-Authored-By: Charon <charon@lethean.io>
Abbreviated field name `mu` violated AX Principle 1 (predictable names over
short names). Renamed to `mutex` to match the convention already used in the
sibling `PeerRateLimiter` struct in the same file.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments that restate the type signature add zero
information. Replaced all prose-description comments on PeerRegistry
methods with concrete call-site examples that show real usage.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments must show HOW with real values, not restate
the signature in prose. "GetRemoteLogs requests console logs from a
remote miner" added zero information; replaced with a concrete call
showing peerID, minerName, lines, and result handling.
Co-Authored-By: Charon <charon@lethean.io>
AX-2: comments must show HOW with real values, not restate the signature.
"ParsePayload unmarshals the payload into the given struct" adds zero
information. Replaced with a concrete call showing the pattern callers
actually use throughout this package.
Co-Authored-By: Charon <charon@lethean.io>
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>