AX Principle 1 — predictable names over short names.
`resp` is an abbreviation that requires context to interpret;
`response` is self-describing at any reading distance.
Co-Authored-By: Charon <charon@lethean.io>
'Chan' is an abbreviation; AX Principle 1 requires predictable names
over short names. stopChannel is unambiguous without a comment.
Co-Authored-By: Charon <charon@lethean.io>
Single-letter receiver `t` violates AX Principle 1 (predictable names
over short names). All 15 Transport methods now use `transport` as the
receiver name for unambiguous semantic navigation.
Co-Authored-By: Charon <charon@lethean.io>
AX principle: all three categories (Good, Bad, Ugly) are mandatory per
TestFilename_Function_{Good,Bad,Ugly} convention. Three handler functions
had only _Bad coverage; this pass fills the gap.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. The field `path` on
PeerRegistry is ambiguous — it could be any path. `peersFilePath` is
self-describing and removes the need for a comment to explain its purpose.
Co-Authored-By: Charon <charon@lethean.io>
worker.go imported path/filepath (banned import) solely for two
filepath.Join calls building the miner install directory path.
Replaced with path.Join from the stdlib path package which is
not banned and behaves identically on Linux for absolute paths.
Co-Authored-By: Charon <charon@lethean.io>
Principle 2 (Comments as Usage Examples): the ProfileManager interface
comment described what the interface was rather than showing how to use it.
Replaced with concrete call examples for GetProfile and SaveProfile.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments as usage examples, not prose descriptions.
The previous comment restated what the function name already conveyed.
Co-Authored-By: Charon <charon@lethean.io>
The strings package is banned per AX conventions. Both HasPrefix calls in
extractTarball now use bytes.HasPrefix with the bytes package already imported.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names.
The receiver `r` on PeerRegistry is a single-letter abbreviation;
all 29 methods now use `registry` for consistency with the rest of
the node package (controller, worker, transport all use full names).
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 function
signature in prose; replaced with a concrete call showing filename/
content pairs.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments show HOW, not WHAT. The prose description
"controls how unknown peers are handled" restates the type name.
Replaced with concrete SetAuthMode call examples showing both modes.
Co-Authored-By: Charon <charon@lethean.io>
Single-letter receiver names are banned by AX Principle 1 except for
i (range loops), _ (discards), t (tests), and c (*core.Core).
Co-Authored-By: Charon <charon@lethean.io>
Single-letter receiver `h` requires mental mapping to understand it refers to
*ResponseHandler. Renamed to `handler` for self-documenting, predictable naming.
Co-Authored-By: Charon <charon@lethean.io>
Abbreviated field name `conns` violates predictable-names-over-short-names.
Renamed to `connections` throughout transport.go — 14 call sites updated.
Co-Authored-By: Charon <charon@lethean.io>
Replace fmt.Sprintf endpoint construction with string concatenation
and return errors directly, eliminating the banned fmt import.
Co-Authored-By: Charon <charon@lethean.io>
TestWorker_HandleGetStats_Bad and TestWorker_HandleGetStats_Ugly were
missing; AX requires all three categories mandatory per function.
Bad covers uninitialised identity, Ugly covers failed miner stat collection.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show usage, not restate the signature.
Both internal methods had descriptions that duplicated the function name.
Co-Authored-By: Charon <charon@lethean.io>
Abbreviation writeMu requires a reader to infer "mutex" — violates AX
Principle 1 (predictable names over short names). writeMutex is
self-describing with no mapping overhead.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. `nm` requires a
comment to explain; `nodeManager` is self-documenting.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. errMsg is an
abbreviation that requires a comment to explain; errorMessage is
self-documenting.
Co-Authored-By: Charon <charon@lethean.io>
Comment used `gw` (AX-1: predictable names over short names).
Expanded to `gateway` so the usage example matches what code should look like.
Co-Authored-By: Charon <charon@lethean.io>
NodeManager's type comment restated the name in prose ("handles node
identity operations") rather than showing concrete usage. Replaced with
a three-line example demonstrating construction, identity check, and
retrieval — per AX Principle 2 (Comments as Usage Examples).
Co-Authored-By: Charon <charon@lethean.io>
Replace fmt.Sprintf/fmt.Errorf with strconv.Itoa and string
concatenation; surface fmt.Errorf error paths as typed
*ProtocolError values for consistent protocol error handling.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names.
The single-letter receiver `w` is ambiguous; `worker` is self-describing.
Co-Authored-By: Charon <charon@lethean.io>
All test functions now follow the mandatory AX test naming convention.
TestResponseHandler_ValidateResponse, TestResponseHandler_ParseResponse,
TestProtocolError, and TestGetProtocolErrorCode_NonProtocolError renamed
and restructured into Good/Bad/Ugly triplets.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. `ctrl` is an
abbreviation that requires a comment to explain; `controller` is
self-documenting and consistent with the `manager` pattern used in
NodeManager and PeerRegistry receivers.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. The variable
`channel` in handleResponse required context to understand its role;
`responseChannel` is self-describing on first read.
Co-Authored-By: Charon <charon@lethean.io>
The field name `pending` required an inline comment to explain its
purpose ("message ID -> response channel"). Per AX Principle 1,
names that require a comment to explain are too short — rename to
`pendingRequests` so the field is self-describing without annotation.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show HOW with real values, not restate what
the function name already says. Five prose descriptions replaced with
concrete call-site examples.
Co-Authored-By: Charon <charon@lethean.io>
Comments on saveNow, save, load, Close, and DefaultResponseHandler
restated what the signature already said. Replace with concrete call
examples showing how each is actually invoked.
Co-Authored-By: Charon <charon@lethean.io>
Test names must follow TestFilename_Function_{Good,Bad,Ugly}.
The extra _WrongURL qualifier broke the AX naming convention
(RFC-CORE-008 §10 — CLI tests as artifact validation).
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show HOW with real values, not restate
what the type signature already says. All payload struct comments in
message.go were prose descriptions ("HandshakePayload is sent during
connection establishment") — replaced with concrete construction
examples showing field usage.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 10 requires all three categories (Good, Bad, Ugly) per test
group. identity_test.go had TestIdentity_NodeManager_Good with no Bad or
Ugly counterparts. Adds error-path tests for non-writable paths and
uninitialised identity, plus edge cases for double-generation and
delete-before-generate.
Co-Authored-By: Charon <charon@lethean.io>
ChallengeSize comment restated the name ("is the size of the challenge
in bytes") — violating AX Principle 2. Replace with a concrete usage
example showing how the constant is used at call sites.
Co-Authored-By: Charon <charon@lethean.io>
saveDebounceInterval had a description comment ("the minimum time between
disk writes") which restates what the name already says. Replaced with a
usage example showing the call site, per AX Principle 2.
Co-Authored-By: Charon <charon@lethean.io>
Single-letter variable f is not in the permitted set (i, _, t, c).
outputFile names the handle by what it contains.
Co-Authored-By: Charon <charon@lethean.io>
AX-1: names that require a comment to explain are too short.
'dirs', 'dir', and 'mode' all needed the surrounding comment
to clarify their meaning; full names are self-documenting.
Co-Authored-By: Charon <charon@lethean.io>