The comment "handleWSUpgrade handles incoming WebSocket connections" restated
the function signature without adding information. Replaced with a concrete
call-site example showing how the method is wired in via Start().
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names.
`Caps` is an abbreviation that requires context to understand;
`Capabilities` is self-documenting.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show how to call the function with real
values, not restate what the type signature already says.
Co-Authored-By: Charon <charon@lethean.io>
Principle 2: comments show HOW with real values, not WHAT the type is.
The old comment restated the struct name; the new block demonstrates the
full setup sequence an agent needs to wire a Worker.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. The abbreviated
struct field `dedup` requires a reader to mentally expand it; the
full name `deduplicator` is self-describing.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. `dn` is an
opaque abbreviation for a *datanode.DataNode; `dataNode` conveys
the type at a glance without requiring context lookup.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments that restate what the surrounding code already
says are noise. The inline comment inside TestReader_ReadAndVerify_Ugly
duplicated the usage example already present in the function docstring.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 10 requires all three categories (Good, Bad, Ugly) for
every test function. TestWorker_HandlePing had only Good; add Bad
(invalid payload) and Ugly (zero SentAt edge case).
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. "returns sensible defaults" adds zero
information — the concrete call pattern teaches agents exactly how to use it.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. The comment example
used `n` which requires context to understand; `connectionCount` is
self-documenting.
Co-Authored-By: Charon <charon@lethean.io>
strings is a banned import per AX conventions. Replace strings.NewReader,
strings.Contains, strings.Split, and strings.IndexByte with bytes equivalents.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. The receiver `n`
for *NodeManager is a non-standard abbreviation; only `i`, `_`, `t`,
and `c` are permitted single-letter receivers per RFC-CORE-008.
Co-Authored-By: Charon <charon@lethean.io>
All peer registry test functions lacked the mandatory category suffix
required by AX-10 (CLI tests as artifact validation / test naming
convention). Renamed every test to carry _Good, _Bad, or _Ugly and
split the former monolithic AddPeer test into three focused cases.
Co-Authored-By: Charon <charon@lethean.io>
Replace `tw`, `tr`, `buf`, `hdr` with `tarWriter`, `tarReader`,
`buffer`, `header` in createTarball and extractTarball per AX
Principle 1 (predictable names over short names).
Co-Authored-By: Charon <charon@lethean.io>
Single-letter variable `d` requires a reader to infer its type from
context. Rename to `deduplicator` — predictable names over short names
(RFC-CORE-008 §1).
Co-Authored-By: Charon <charon@lethean.io>
RFC-CORE-008 Principle 2: comments show HOW with real values, not WHAT the
function does in prose. Removed GoDoc-style blank-line indented blocks and
replaced with inline concrete call examples on every type and function.
Co-Authored-By: Charon <charon@lethean.io>
Single-letter c is reserved for *core.Core (AX Principle 1 — predictable
names over short names). Using c for a *Controller introduces semantic
ambiguity; controller makes the type intent self-evident.
Co-Authored-By: Charon <charon@lethean.io>
AX-1: c is reserved for *core.Core receivers per RFC-CORE-008.
Controller methods used c as the receiver name which creates
semantic ambiguity. Renamed to ctrl to match the usage examples
already present in the comment blocks.
Co-Authored-By: Charon <charon@lethean.io>
ValidateResponse, ParseResponse, and GetProtocolErrorCode had comments
that restated the function signature in prose — violating AX Principle 2
which requires comments to show concrete call-site usage, not descriptions.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. Single-letter
variable p in GetPeersByScore replaced with peer, matching the type
it holds and the usage in surrounding code.
Co-Authored-By: Charon <charon@lethean.io>
AX-2: comments that restate the function name add zero information.
savePrivateKey, saveIdentity, and loadIdentity now show a concrete
call-site with context on when each is invoked.
Co-Authored-By: Charon <charon@lethean.io>
AX-2: every function must show a concrete call with real values, not
prose. parseComment had no comment at all — added three-line example
showing input string, key lookup, and expected return values.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names.
`tmp` is an abbreviation requiring mental mapping; `temporaryPath`
is unambiguous and self-describing.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show HOW with real values, not restate what
the signature already says. "Close closes the connection." adds zero
information; a usage example shows call site and error handling pattern.
Co-Authored-By: Charon <charon@lethean.io>
All 10 test functions in bundle_test.go lacked the AX Principle 10 naming
convention. Renamed to TestBundle_* with _Good/_Bad/_Ugly suffixes and
converted inlined Bad/Ugly subtests into top-level functions where needed.
Added usage-example comments per AX Principle 2.
Co-Authored-By: Charon <charon@lethean.io>
Single-letter parameter n violates AX Principle 1 — names must be
predictable without a comment to explain them. count is unambiguous.
Co-Authored-By: Charon <charon@lethean.io>
Test function names lacked the required {Good,Bad,Ugly} suffix mandated
by AX Principle 10. Renamed HandlePing and HandleGetStats (missing suffix),
and _NoManager/_Profile/_UnknownType variants to _Bad/_Bad/_Ugly.
Co-Authored-By: Charon <charon@lethean.io>
AX-1 (Predictable Names): the local variable `pr` is an abbreviation
that requires context to decode. Renamed to `peerRegistry` across all
test functions so the type is self-evident at the point of use.
Co-Authored-By: Charon <charon@lethean.io>
Renames `buf` to `buffer` and `enc` to `encoder` throughout bufpool.go.
AX Principle 1 — predictable names over short names: abbreviations increase
semantic ambiguity for agents pattern-matching across the codebase.
Co-Authored-By: Charon <charon@lethean.io>
TestPeerRegistry_NewPeerRegistry violated AX-10 (test naming must follow
TestFilename_Function_{Good,Bad,Ugly}). Renamed to TestPeer_NewPeerRegistry_Good
and added Bad (unwritable path) and Ugly (corrupted JSON) cases.
Co-Authored-By: Charon <charon@lethean.io>
Four functions in Transport had comments that restated the signature
("sets the handler", "establishes a connection", "sends a message to all
connected peers") rather than showing concrete call examples. Converted
to AX Principle 2 style — usage examples with realistic values.
Co-Authored-By: Charon <charon@lethean.io>
AX-10 requires test functions follow TestFilename_Function_{Good,Bad,Ugly}.
TestWorker_SetMinerManager tested only the happy path with no suffix.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show how to call the function, not
restate what the type signature already says.
Co-Authored-By: Charon <charon@lethean.io>
Transport.Start and Transport.Stop had prose comments that restated
the function name — the pattern AX Principle 2 explicitly bans.
Replaced with concrete call-site examples showing how callers use them.
Co-Authored-By: Charon <charon@lethean.io>
CreateProfileBundleUnencrypted and CreateMinerBundle had comments that
restated the signature in prose. AX Principle 2 requires comments to
show a concrete call with realistic values, not describe what the type
signature already says.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. The goroutine
parameter in GetAllStats used `p *Peer` — a single-letter abbreviation
with no justification under the AX exception list (i, _, t, c only).
Renamed to `connectedPeer` to match the variable's semantic role.
Co-Authored-By: Charon <charon@lethean.io>
`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>