Removes the banned `fmt` import from profile_manager.go. All four
fmt.Errorf calls are replaced with ErrInternal/ErrProfileNotFound,
consistent with the error pattern used throughout the rest of the
mining package.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: pe is an abbreviation requiring a comment to explain.
Renamed to protocolError throughout, including the usage example comment.
Co-Authored-By: Charon <charon@lethean.io>
The field Aliases int was ambiguous — agents and readers expect Aliases
to be a slice, not a count. AliasCount makes the int type self-evident
without requiring a comment (AX Principle 1: predictable names).
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show HOW with real values, not restate
the type signature. "GetStats retrieves the performance statistics from
the running XMRig miner." added zero information beyond the name.
Co-Authored-By: Charon <charon@lethean.io>
Rename flat test functions to TestFilename_Function_{Good,Bad,Ugly} pattern
and replace prose description comments with usage-example comments per AX
principles 1 and 2.
Co-Authored-By: Charon <charon@lethean.io>
BundleType, Bundle, and BundleManifest had comments restating what the
type signature already says (AX Principle 2 violation). Replaced with
concrete usage examples showing how each type is constructed and used.
Co-Authored-By: Charon <charon@lethean.io>
Single-letter variables v, c, d in GetVersion/GetCommit/GetBuildDate
comments violated AX Principle 1 (predictable names over short names).
Replaced with versionString, commitHash, buildDate.
Co-Authored-By: Charon <charon@lethean.io>
Remove the banned `errors` import from ttminer.go. The single call
to errors.New is replaced with the existing ErrUnsupportedMiner
constructor from errors.go, which carries the OS name, HTTP status,
and a details note about CUDA requirements.
Co-Authored-By: Charon <charon@lethean.io>
Remove the banned "strings" import from miner_factory.go. Replace all
strings.ToLower calls with a package-level toLowerASCII helper that uses
unicode.ToLower per rune, matching the pattern used in other files.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. mu → mutex
matches the same fix already applied to Manager and SettingsManager.
Co-Authored-By: Charon <charon@lethean.io>
path/filepath is a banned import per AX conventions; path is the
correct alternative when core.JoinPath is not available in this repo.
Co-Authored-By: Charon <charon@lethean.io>
Replace fmt.Errorf with ErrInternal().WithCause() and
fmt.Sprintf URL with string concatenation + strconv.Itoa.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. The local variable
`cb` requires mental mapping; `circuitBreaker` names the value directly.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names.
The field `ttl` requires context to decode; `timeToLive` is
self-describing without a comment.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments that restate the type signature add zero
information. Replaced with a concrete call site showing how to
obtain and inspect the struct.
Co-Authored-By: Charon <charon@lethean.io>
LetheanDefaults comment restated what the constant block name already says (AX
Principle 2). Replaced with concrete call examples showing GetChainInfo and
DiscoverPools usage against both daemon endpoints.
Co-Authored-By: Charon <charon@lethean.io>
AX principle 2 — comments must show HOW with real values, not restate
what the type declaration already says.
Co-Authored-By: Charon <charon@lethean.io>
container.go used fmt.Errorf for all error construction, violating the
AX banned-imports rule. Replaced with ErrInternal().WithCause() using
the package's own error primitives, consistent with the rest of pkg/mining.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. The variable `u`
in the WebSocket upgrader CheckOrigin closure required context to
understand; `parsedURL` is self-describing.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. `pr` requires mapping to
PeerRegistry; `registry` is self-documenting on first read.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names.
All Update() callback closures used `s *AppSettings`; renamed to
`settings *AppSettings` throughout, including the usage-example comment.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments must show HOW with real values, not restate what
the type name already says. Replace the description-style comment with a
concrete two-line call sequence showing construction and route registration.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments that restate the field name add no information
and should be deleted. Replace DefaultMaxConnections prose description
with a usage example showing the override pattern.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names.
`ctx` is an abbreviation that requires prior knowledge to decode;
renamed to describe intent at each call site.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. mu requires
knowledge of the convention to understand; mutex is self-describing.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show HOW with real values, not WHAT the
type signature already says. Converted 8 prose-style comments on
type declarations (Transport, TransportConfig, PeerConnection,
PeerRateLimiter, MessageDeduplicator, DisconnectPayload, NodeRole,
NodeIdentity, Peer) to concrete call-site examples.
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 old comment described return values;
the new comment shows a concrete call with realistic version strings.
Co-Authored-By: Charon <charon@lethean.io>
RFC-025 §2: comments that restate what the function name already says
are deleted and replaced with concrete call-site examples showing
goroutine launch context and behaviour.
Co-Authored-By: Charon <charon@lethean.io>
AX principle 1 — predictable names over short names. The usage example
comment in TestPacket_MarshalAndSign_Ugly used `secret` (abbreviated)
where all other examples in the package consistently use `sharedSecret`.
Co-Authored-By: Charon <charon@lethean.io>
Replace single-letter receivers (m *Message, e *ProtocolError) and
parameter (v interface{}) with full names (message, protocolError, target)
per 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 with real
values, not restate what the type signature already says. All six
HashrateStore interface methods now carry concrete call-site examples.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: abbreviated field names increase semantic ambiguity.
Logger.mu renamed to Logger.mutex — no comment required to understand it.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments show HOW with real values, not prose.
Error() and Unwrap() were the only exported methods on MiningError
lacking usage example comments.
Co-Authored-By: Charon <charon@lethean.io>
A malformed frame with length 0 for any single-byte tag (TagVersion,
TagCurrentLayer, TagTargetLayer, TagIntent) or fewer than 2 bytes for
TagThreatScore caused a runtime panic (index out of range) on untrusted
input. Added len(tagValue) bounds checks in ReadAndVerify before each
tagValue[0] and Uint16 access to eliminate the panic path.
Co-Authored-By: Charon <charon@lethean.io>
Test naming must follow TestFilename_Function_{Good,Bad,Ugly}. The disabled
path test was named freeform, breaking the mandatory pattern. Renamed to
TestDatabase_Initialize_Bad so it joins the existing TestDatabase_Initialize_Good
and forms a correctly named pair.
Co-Authored-By: Charon <charon@lethean.io>
GetLevel had a comment that restated the signature in prose ("returns the
current minimum log level"), violating AX Principle 2. Replaced with a
concrete call-site example showing how the result is actually used.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. The mu field
requires context to understand; mutex is self-describing.
Co-Authored-By: Charon <charon@lethean.io>