AX Principle 2: comments must show usage, not describe intent in prose.
The default switch branch comment was prose-first; rewritten as a
concrete call-site example that shows what the code does and why.
Co-Authored-By: Charon <charon@lethean.io>
AX-1 violation: receiver name `sm` is an abbreviation that requires
context to decode. Renamed to `settingsManager` throughout, matching
the predictable-names-over-short-names principle from RFC-CORE-008.
Also corrects a comment that referenced the banned `log.Fatal` call.
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>
// TLV Types restated what Tag* names already made obvious (AX §2 violation).
Replace with a concrete usage example showing the three-tag write sequence.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show concrete usage, not restate the signature.
Four functions (NewSimulatedMiner, Stop, GetStats, SimulatedMinerPresets) had
"X does Y" prose descriptions replaced with call-site examples.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments must show usage, not restate the signature.
MinerConstructor, MinerFactory, and NewMinerFactory had prose descriptions
that added no information beyond what the type already states.
Co-Authored-By: Charon <charon@lethean.io>
CurrentLayer and TargetLayer had prose descriptions restating the field
names. AX Principle 2 requires comments to show concrete usage with real
values, not restate what the type signature already says.
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>
Five comments in Manager were restating what the function signature
already showed ("returns X for Y"). Replace with concrete call
examples per AX principle 2 (Comments as Usage Examples).
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments show HOW with real values, not prose describing
what the code does. "Verify each expected tag is present in the frame"
restated intent with zero new information; replaced with a concrete call
showing the bytes.Contains check and the expected result.
Co-Authored-By: Charon <charon@lethean.io>
Generic name "buffer" violates predictable-names-over-short-names.
"frameBuffer" names the thing by what it holds.
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>
AX Principle 2: comments show HOW with real values, not WHAT the type does.
The FileRepository struct comment described implementation details instead
of demonstrating how to construct and use the type.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments as usage examples. The default switch case in
ReadAndVerify silently included unknown extension tags in signedData with
no explanation of why; added a concrete comment showing the pattern and
the security rationale (tag-injection prevention).
Co-Authored-By: Charon <charon@lethean.io>
GetHashrateHistory and AddHashratePoint had comments that restated the
function name in different words (AX principle 2 violation). Replaced
with concrete call-site examples showing realistic values and return
shape.
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>
AX principle 2 requires comments to show HOW via concrete examples,
not describe WHAT the code does in prose.
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>
AX Principle 2: comments show HOW with real values, not WHAT the
function name already says. All other constructors in the file already
use usage-example comments; NewTaskSupervisor was the outlier.
Co-Authored-By: Charon <charon@lethean.io>
GetPath, GetBinaryPath, and Stop had comments that restated what the
signature already said. AX Principle 2: comments show HOW with real
values, not WHAT the type signature already declares.
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>
MarshalAndSign had a prose comment "We write these first because they
are part of what we sign." — deleted per AX Principle 2 (comments as
usage examples, not prose descriptions). Replaced with a concrete
writeTLV call showing the wire encoding output.
Co-Authored-By: Charon <charon@lethean.io>
Three comments restated the function/type name in prose (AX principle 2
violation). Replaced with concrete call-site examples showing real usage.
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 usage with realistic values, not
restate what the type signature already says.
Co-Authored-By: Charon <charon@lethean.io>
Test names must match the exact function name (NewPacketBuilder), not an
abbreviated form (NewBuilder). AX principle 1: predictable names over short names.
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>
Misaligned const tag values and trailing comment spacing violated
gofmt canonical formatting, reducing readability for agents scanning
the TLV tag table.
Co-Authored-By: Charon <charon@lethean.io>
Stop() and WriteStdin() used errors.New() (banned import) instead of the
package's own MiningError constructors. Replaced with ErrMinerNotRunning()
and ErrTimeout() which carry structured codes, HTTP status, and retry hints.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments show HOW with real values, not WHAT the
signature already says. Converted all exported function/method prose
descriptions to concrete call-site examples.
Co-Authored-By: Charon <charon@lethean.io>
Internal numbered step comments (1. Read Tag, 2. Handle Payload Tag, etc.)
restate what the code does rather than showing concrete usage examples.
Per RFC-CORE-008 Principle 2: delete comments that restate what the code
already expresses; keep only usage examples with realistic values.
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>
AX Principle 1 — predictable names over short names. Single-letter variables
b (random byte buffer) and h (MD5 digest array) require mental mapping; full
names make intent self-evident without comments.
Co-Authored-By: Charon <charon@lethean.io>
Ambiguous constructor name required reading the return type to know what
it builds. NewPacketBuilder is self-documenting without context.
Co-Authored-By: Charon <charon@lethean.io>
Add UnmarshalJSON wrapper to bufpool.go and route the json.Unmarshal
call in events.go readPump through the package-local wrapper, removing
the direct "encoding/json" import which is banned under AX RFC-025.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. Test functions must
follow TestFilename_Function_{Good,Bad,Ugly} with all three categories.
Middleware coverage split across Good/Bad/Ugly; token-refill and stop tests
receive the mandatory suffixes. Comments updated to usage-example form (AX §2).
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>
TestReader_ReadAndVerify_Ugly previously tested wrong-secret (errIntegrityViolation),
duplicating the Bad case. Replaced with a hand-crafted frame that omits the HMAC TLV,
exercising the errMissingHMAC sentinel that was entirely untested.
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>
AX Principle 2 — comments show HOW with real values, not WHAT the signature already says.
GetHighResHistoryLength, GetLowResHistoryLength, and GetLogs all had comments that
restated the function name. Replaced with concrete call-site examples showing expected
return ranges and usage patterns.
Co-Authored-By: Charon <charon@lethean.io>