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>
AX Principle 2 — comments must show usage examples, not restate what
the code already says. The inline comment in the default branch of
ReadAndVerify's tag-switch duplicated the three lines beneath it verbatim,
adding zero information.
Co-Authored-By: Charon <charon@lethean.io>
Comments on GitHubRelease and fetchGitHubVersionDirect restated what
the type names already said. Replaced with concrete call examples
per AX Principle 2 (comments as usage 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>
AX Principle 2: comments must show usage examples, not restate what the
type signature already says. The line "ErrCircuitOpen is returned when
the circuit is open" adds zero information over the var declaration
itself. The usage example below it is kept.
Co-Authored-By: Charon <charon@lethean.io>
Test doc-comments used `// //` to prefix expected-result lines, producing
comments-within-comments rather than clean usage examples. Strip the
redundant inner `//` so all lines read as plain code-example comments.
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>
signedData was ambiguous — it did not convey that the buffer holds
accumulated header TLVs fed as input to HMAC, nor whether data was
already signed or pending signing. hmacInputBuffer makes the purpose
unambiguous on first read (AX Principle 1: predictable names over
short names).
Co-Authored-By: Charon <charon@lethean.io>
All test functions in circuit_breaker_test.go now follow the AX-required
naming pattern. Added missing _Bad and _Ugly variants and usage-example
comments on each test function.
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>
TagCurrentLayer, TagTargetLayer, TagIntent, and TagThreatScore were
exported constants with no comment, violating AX Principle 2 (comments
as usage examples). Each now has a concrete writeTLV call showing the
tag, value encoding, and valid range where relevant.
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>
initDatabase and startDBCleanup had comments that restated the function
name in prose — violating AX Principle 2 (comments as usage examples).
Replaced with concrete call-site examples showing caller context.
Co-Authored-By: Charon <charon@lethean.io>
Comment promised errTLVValueTooLarge but test only checked err != nil.
AX Principle 2 requires comments to be accurate usage examples —
the comment implied sentinel identity so the assertion must verify it.
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>
`mu` is an abbreviation requiring context to interpret; `mutex` is
self-describing and matches the AX rule that names must not require
a comment to explain.
Co-Authored-By: Charon <charon@lethean.io>
AX principle 2 requires comments to show usage with real values. The
MarshalAndSign call in the NewPacketBuilder doc comment used a variable
name (sharedSecret) instead of a concrete literal.
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>
The comment said "threat score incremented" and the error string said
"(ThreatScore +100)" but ReadAndVerify never mutates ThreatScore — it
only returns an error. Updated the comment to show the caller's
responsibility (header.ThreatScore += 100) and removed the parenthetical
from the error string.
Co-Authored-By: Charon <charon@lethean.io>
AX principle 2: comments show HOW with real values, not WHAT the
function name already says. "verifies if the miner is installed
correctly" restated the signature; replaced with a concrete call site.
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 Principle 2 requires comments to show concrete usage, not describe
behaviour. The old comment restated when fields are populated; the new
comment shows the dispatch call an agent would make after ReadAndVerify.
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>
AX Principle 2 — comments as usage examples, not restatements.
ParsedPacket carried the identical dispatch example twice: once above
the type and again above ReadAndVerify. The type-level copy added no
new information; replaced with a field-reference note that describes
what the struct exposes without duplicating the call-site example.
Co-Authored-By: Charon <charon@lethean.io>
All 7 handler tests in service_test.go were missing the required
TestFilename_Function_{Good,Bad,Ugly} suffix mandated by AX Principle §Test Naming.
Co-Authored-By: Charon <charon@lethean.io>
ParsedPacket comment used `_ = packet.Header.IntentID` — a discard
pattern that is not a realistic usage example (AX-2 violation). Replaced
with `dispatch(packet.Header.IntentID, packet.Header.ThreatScore, packet.Payload)`
to show how callers actually consume the parsed packet fields.
Co-Authored-By: Charon <charon@lethean.io>
Receiver name `packetError` shadowed the type name and violated AX
Principle 1 — names must be predictable and not require a comment
to explain. `packetErrorValue` is unambiguous as the bound value.
Co-Authored-By: Charon <charon@lethean.io>
Short name `mu` requires knowledge of Go convention to decode; `mutex`
is unambiguous and self-describing per predictable-names-over-short-names.
Co-Authored-By: Charon <charon@lethean.io>
`packetErr` is an abbreviation of the full type name `packetError`.
AX Principle 1 requires predictable names over short names — receiver
renamed to the full type name to eliminate mapping overhead.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. The wire format
field "ts" requires a reader to guess its meaning; "timestamp" is
self-documenting and consistent with every other field on the struct.
Co-Authored-By: Charon <charon@lethean.io>
Single-letter receiver `f` on *MinerFactory violates AX-025 § "Predictable
Names Over Short Names". Renamed to `factory` across all methods so the
receiver is self-describing at every call site.
Co-Authored-By: Charon <charon@lethean.io>
Single-letter receiver `e` is not in the AX-permitted list
(i, _, t, c). Renamed to `packetErr` for predictable naming.
Co-Authored-By: Charon <charon@lethean.io>
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>