AX Principle 2 — comments must show HOW with real values, not restate
what the signature already says. The old comment described the return
value in prose; replaced with a concrete call-site example.
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. The four prose comments on
CircuitState and its constants are replaced with a single usage-example
block that shows all three states in context.
Co-Authored-By: Charon <charon@lethean.io>
Short variable name `dir` violated predictable-names-over-short-names.
Renamed to `directoryPath` in savePrivateKey, saveIdentity, and saveNow.
Co-Authored-By: Charon <charon@lethean.io>
Commented-out var declarations are not usage examples — they are dead
code that adds noise. AX Principle 2 requires comments to show concrete
usage, not linger as disabled code.
Co-Authored-By: Charon <charon@lethean.io>
Single-letter variable name violates AX Principle 1 (predictable names
over short names). peerURL is self-describing without requiring context.
Co-Authored-By: Charon <charon@lethean.io>
packetErr is a shortened form of packetError, violating AX Principle 1
(predictable names over short names). Single-letter e is explicitly
permitted for value receivers per RFC-CORE-008-AGENT-EXPERIENCE.md.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 10 requires test names to follow TestFilename_Function_{Good,Bad,Ugly}.
message_test.go used bare names (TestNewMessage, TestMessageReply, etc.) with no
suffix. Added Bad/Ugly cases for ParsePayload (nil payload, malformed JSON).
Co-Authored-By: Charon <charon@lethean.io>
RFC-025 Principle 1: single-letter names are only permitted for i (range),
_ (discards), t (tests), and c (*core.Core). The receiver variable e is
not in the allowed list — packetErr is predictable and removes the mapping
overhead.
Co-Authored-By: Charon <charon@lethean.io>
MiningError had "is a structured error type" — restates the declaration.
AX principle 2: comments show HOW with real values, not WHAT the signature says.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show HOW with real values, not prose descriptions.
`// 0x09 = IPv9` described the constant; `// header.Version = 0x09 // IPv9`
shows the assignment as used, matching all other UEPSHeader field comments.
Co-Authored-By: Charon <charon@lethean.io>
loadProfiles and saveProfiles had comments that restated their function
names in prose form. AX Principle 2 requires comments to show concrete
usage examples, not descriptions. Replace both with call-site examples.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show HOW with real values, not WHAT in prose.
The emitEvent comment restated the function name rather than demonstrating
a concrete call.
Co-Authored-By: Charon <charon@lethean.io>
RFC-025 Principle 2 — comments must show a concrete call with realistic
values, not restate what the signature already says.
Co-Authored-By: Charon <charon@lethean.io>
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>
DatabaseConfig field comments restated the type signature in prose
(AX §2 violation). Replaced with concrete assignment examples showing
real values and edge-case behaviour (0 → defaults to 30).
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show HOW with real values, not variable
references. Replace builder.Header.Version with the concrete 0x09
literal so the comment matches what the output annotation shows.
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 that restate the function name add zero information.
Replace with a concrete call example showing what the method does at runtime.
Co-Authored-By: Charon <charon@lethean.io>
tlvError used an abbreviated subsystem name (tlv = Type-Length-Value),
requiring domain knowledge to decode. packetError is self-describing
from the path alone, matching the AX rule: predictable names over short names.
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>
Comment on line 126 showed `err` but implementation used `verifyError`,
violating AX Principle 2 (comment must match usage example) and Principle 1
(err is the RFC-sanctioned idiomatic name for local error variables).
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>
Comment example used log.Println (banned import) as a usage pattern.
Replaced with logging.Info to align with AX Principle 2 (comments
as valid usage examples that match ecosystem conventions).
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>
Per AX Principle 2, comments must show concrete usage, not describe intent.
The `default:` branch comment now demonstrates the write calls rather than
explaining what they protect against.
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>
Test names lacked the AX-required suffix pattern (RFC-025 §10 test naming).
Renamed all 8 functions to TestErrors_* with _Good, _Bad, and _Ugly suffixes.
Also renamed loop variables from tt to c (predictable name, AX principle 1).
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>
The default switch-case comment in ReadAndVerify restated the three
lines immediately following it verbatim, violating AX Principle 2
(comments as usage examples, not code descriptions). Replaced with a
single line explaining the security intent of the behaviour.
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>
dbCtx→databaseContext, dbCancel→databaseCancel, dbPoint→databasePoint
in collectSingleMinerStats per AX principle 1 (predictable names over short names).
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments must show concrete usage, not restate the
type name. TaskFunc, SupervisedTask, TaskSupervisor, and TaskStatus
all had prose descriptions that added zero information over the
signature. Replaced with call-site examples.
Co-Authored-By: Charon <charon@lethean.io>
tagByte described the storage type (a byte), not the purpose. All
constants in the package use Tag* naming (TagVersion, TagPayload, etc.)
so the loop variable should match: tagType aligns with the domain
vocabulary and satisfies AX Principle 1 (predictable names over short
names).
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 2: comments must be usage examples, not prose descriptions.
"Corrupt the last byte of the payload/frame" restates what the adjacent
code does rather than demonstrating a call with concrete values.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show concrete usage, not restate the type
signature in prose. StatsCollector and HTTPStatsConfig had three lines of
descriptive prose that added no information an agent couldn't infer from
the names alone.
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>
tagByte described the storage representation; tagType names the semantic
role (the T in TLV = Type-Length-Value), matching AX Principle 1.
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 2: comments show HOW with real values, not WHAT the type signature already says.
The 12-line prose block restated what the interface methods communicate directly.
Co-Authored-By: Charon <charon@lethean.io>
AX principle 2: comments that restate what the name already says add zero
information. LetheanMainnetPool, LetheanSoloTestnet and LetheanSoloMainnet
had "X is the Y for Z" comments replaced with concrete call-site examples.
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>