AX Principle 1: predictable names over short names.
Usage-example comments inside DatabaseConfig used the abbreviation
cfg; renamed to configuration so the inline examples teach the full,
unambiguous name.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show HOW with real values, not what the code does.
The inline prose "All tags except TagHMAC contribute..." restated logic already
visible in the surrounding code. Replaced with a concrete call sequence showing
the exact buffer writes performed for each non-HMAC tag.
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>
The switch in ReadAndVerify duplicated the same three hmacInputBuffer.WriteByte/Write
calls across five cases plus default. Extracted to a single conditional after the switch:
all tags except TagHMAC feed the authenticated input buffer. Behaviour is identical;
declarative intent is now clear (AX principle 5 — declarative over imperative).
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show HOW with real values, not WHAT the
function does (which the signature already says).
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 2 — global convenience functions had comments restating the
signature ("logs a debug message using the global logger") rather than
showing concrete calls with realistic values.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. nm and pr require
mental mapping to understand their purpose; nodeManager and peerRegistry
are self-documenting at the call site.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show concrete usage, not restate the
function name. "New creates a new Logger with the given configuration"
restated the signature — replaced with a callable example.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show concrete usage, not restate the
function name. "Initialize opens the database connection and creates
tables" restated the signature — replaced with a callable example.
Co-Authored-By: Charon <charon@lethean.io>
TestPacket_NewPacketBuilder_Bad and _Ugly used inline []byte("secret")
literals; extracted to sharedSecret variable per AX Principle 1
(predictable names over magic literals).
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments that restate the signature add zero information.
Show a concrete call with realistic values instead.
Co-Authored-By: Charon <charon@lethean.io>
Abbreviated names `globalMu` and `sb` require a comment to understand
their purpose, violating AX Principle 1 (Predictable Names Over Short
Names). Renamed `globalMu` to `globalMutex` and `sb` to `builder`
throughout logger.go.
Co-Authored-By: Charon <charon@lethean.io>
Abbreviated names `db` and `dbMu` require a comment to understand their
scope and purpose, violating AX Principle 1 (Predictable Names Over Short
Names). Renamed to `globalDatabase` and `databaseMutex` throughout all
source and test files.
Co-Authored-By: Charon <charon@lethean.io>
Replace errors.New() with ErrInternal()/ErrTimeout() and errors.Unwrap(err)
with err.Unwrap() — the MiningError type provides both without the banned import.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names.
The variable reader is ambiguous; frameReader states
exactly what is being read.
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>
Use sharedSecret in doc-comment examples to match actual test body
variable names — resolves AX principle 1+2 violation where comment
examples used the abbreviated form secret while code used sharedSecret.
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>
AX Principle 2 — comments as usage examples, not prose descriptions.
The previous comment restated what the constant name already communicates.
Co-Authored-By: Charon <charon@lethean.io>
`mu` is an abbreviation that requires context to understand. AX Principle 1
mandates predictable names over short names — `mutex` is unambiguous.
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>
TestFilename_Function_{Good,Bad,Ugly} requires the function being
tested, not just the type name. sentinelError tests exercise the
.Error() method so names must be TestPacket_sentinelError_Error_*.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 (predictable names over short names): usage-example comments
in profile_manager.go used the abbreviated `pm` receiver throughout, while all
production code uses the full `profileManager` name. Comments are teaching
material — agents and readers learn from them. Aligning examples with the actual
variable name removes the abbreviation mapping overhead.
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>
Generic name `header` replaced with `packetHeader` throughout ReadAndVerify
to satisfy AX predictable-names-over-short-names; the name now conveys what
is being built without requiring context from the surrounding function.
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>
xmrig_stats.go and ttminer_stats.go used errors.New() despite the
package providing ErrMinerNotRunning() and ErrInternal() for exactly
these cases. Removes banned errors import from both files.
Co-Authored-By: Charon <charon@lethean.io>
Variable name tagLengthByte encoded its type (byte) rather than its role
(the length field of a TLV record). AX Principle 1: names must be semantic,
not type-annotated. tagLength is unambiguous without the redundant Byte suffix.
Co-Authored-By: Charon <charon@lethean.io>
TestReader_ReadAndVerify_Bad referenced `frame` without defining it in
the comment block, leaving an agent without enough context to understand
the setup. Replace with a complete, standalone snippet showing frame
construction, corruption, and the expected error outcome.
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>
Abbreviated field name `mu` replaced with `mutex` throughout EventHub
to satisfy the predictable-names-over-short-names rule (RFC-025 §1).
Co-Authored-By: Charon <charon@lethean.io>
Variable named tagValueLength implied int semantics but held a byte
value from ReadByte(); AX Principle 1 requires names that are
unambiguous without comments — tagLengthByte makes the type explicit
and the int(tagLengthByte) cast at make() call site clarifies the
byte→int conversion for agent readers.
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 with real values, not WHAT the
signature already says. "Stop gracefully stops the service" restates
the name; replaced with a concrete call-site example.
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>
AX Principle 2: comments must show HOW with real values, not restate
the function name. Four prose comments replaced with concrete call
examples showing inputs and expected outcomes.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show concrete usage with realistic values, not
minimal call-site only. Single-line comment omitted error handling and
downstream use — now shows the complete call pattern.
Co-Authored-By: Charon <charon@lethean.io>