Single-letter receiver `h` on all EventHub methods is a predictability
violation — `hub` carries semantic meaning across the file.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. The abbreviated
field minersMu was missed when the EventHub mu was renamed to mutex
in a prior sweep.
Co-Authored-By: Charon <charon@lethean.io>
Remove `fmt` import from miner.go; replace all fmt.Errorf calls with
ErrInstallFailed, ErrInternal, and ErrMinerNotFound using .WithCause/.WithDetails.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. The two-character
receiver `da` on DigestAuth methods mirrors the `cb` → `circuitBreaker`
fix already applied. The local variables `ha1` and `ha2` (RFC 2617 hash
computation steps) are renamed to `hashA1` and `hashA2` for the same reason.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. The receiver abbreviation
`cb` required mapping overhead — replaced with the full `circuitBreaker` name
across all eight methods in circuit_breaker.go.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments must show HOW (concrete call), not describe WHAT.
The wsUpgrader var comment restated the variable's purpose in prose; replaced
with a usage example showing the Upgrade call site.
Co-Authored-By: Charon <charon@lethean.io>
AX principle #2: comments show HOW with real values, not WHAT
the signature already says. Replaced two prose description blocks
on MinerTypeXMRig and getXMRigConfigPath with concrete call examples.
Co-Authored-By: Charon <charon@lethean.io>
Two uses of the banned fmt import used fmt.Sprintf for trivial string
concatenation (timestamp prefix in LogBuffer.Write, XDG path in GetPath).
Replaced with direct string concatenation per AX banned-import rules.
Co-Authored-By: Charon <charon@lethean.io>
Adds containsStr alongside existing equalFold/hasPrefix string helpers in manager.go,
then removes the banned "strings" import from node_service.go.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. `rl` requires
mental decoding; `limiter` is self-documenting at the call site.
Co-Authored-By: Charon <charon@lethean.io>
Replace json.NewDecoder streaming decode with io.ReadAll + the package's
own UnmarshalJSON wrapper (bufpool.go), eliminating the direct encoding/json
dependency in line with AX banned-import rules.
Co-Authored-By: Charon <charon@lethean.io>
AX principle 2: comments show HOW with real values, not WHAT the name already says.
"DefaultMetrics is the global metrics instance" restates the declaration.
Replace with concrete field access examples an agent can copy directly.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1: predictable names over short names. tr requires
the reader to know tar conventions; tarReader is self-describing.
Co-Authored-By: Charon <charon@lethean.io>
Four fmt.Errorf calls in updateInstallationCache used the banned fmt
package for error construction. Replaced with ErrInternal().WithCause()
to match the established pattern used throughout the package. Also
replaced the prose comment with a usage example per AX Principle 2.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 1 — predictable names over short names. The parameter `st`
required a mental mapping to `*SupervisedTask`; `supervisedTask` is
self-documenting at every call site inside the function.
Co-Authored-By: Charon <charon@lethean.io>
Three comments violated AX Principle 2 (comments as usage examples):
- Repository interface comment described what it was rather than showing usage
- FileRepositoryOption comment said "configures a FileRepository" (restates the type)
- saveUnlocked comment described behaviour rather than showing the call pattern
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
name in prose; now it shows a concrete call site.
Co-Authored-By: Charon <charon@lethean.io>
Comments on TTMiner, TTMinerSummary, and getTTMinerConfigPath restated
what the type signature already said. 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 WHAT the type is.
The old comment restated the struct definition. Replaced with a concrete
construction example.
Co-Authored-By: Charon <charon@lethean.io>
AX principle 2 — comments show HOW with real values, not WHAT the
signature already says. Aligns with xmrig_stats.go and simulated_miner.go.
Co-Authored-By: Charon <charon@lethean.io>
Remove banned `encoding/json` import from pkg/mining/version.go; read
response body with io.ReadAll then decode via the package-local
UnmarshalJSON wrapper (bufpool.go). Also complete the partial fmt
removal in pkg/node/identity.go left broken by the previous sweep.
Co-Authored-By: Charon <charon@lethean.io>
AX principle 2: comments show HOW with real values, not what the
signature already says. "unzip extracts a zip archive" restates the
name; replaced with concrete call-site examples.
Co-Authored-By: Charon <charon@lethean.io>
Replace fmt.Sprintf calls with string concatenation (+) and
strconv.FormatInt for integer formatting. fmt is a banned import
per AX conventions; all string formatting goes through Core primitives
or native concatenation.
Co-Authored-By: Charon <charon@lethean.io>
// Node Info Response restated the type name — deleted per AX Principle 2.
Replaced with a concrete usage example showing all fields populated.
Co-Authored-By: Charon <charon@lethean.io>
errors.New() is a banned import. xmrig_start.go now uses ErrMinerExists()
and ErrInvalidConfig() from the package's own MiningError system, removing
the "errors" import entirely.
Co-Authored-By: Charon <charon@lethean.io>
AX principle 2 — comments must show HOW (concrete call), not restate WHAT
the name already says. Three prose-style descriptions replaced with
realistic usage examples showing struct construction and registration.
Co-Authored-By: Charon <charon@lethean.io>
Three middleware helper functions had comments that restated the function
name in prose (AX principle 2 violation). Replaced with concrete call-site
examples showing how each middleware is installed and what it does.
Co-Authored-By: Charon <charon@lethean.io>
securityHeadersMiddleware and contentTypeValidationMiddleware had comments
that restated the signature in prose — AX Principle 2 requires usage
examples showing how the function is called, not descriptions of what it does.
Co-Authored-By: Charon <charon@lethean.io>
Eight struct type comments restated what the name already said (AX Principle 2
violation). Replaced all with concrete HTTP request/response examples showing
actual field values, so agents can learn call shape from context alone.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments show HOW with real values, not WHAT the
function name already says. Prose description deleted; two concrete
call-site examples added.
Co-Authored-By: Charon <charon@lethean.io>
ContainerConfig had five "X is the Y" prose field comments that restated
the type signature (AX §2 violation). Container had three section-divider
labels ("Core services", "Database store", "Initialization state") that
describe what is self-evident from the field names. Both patterns are
explicitly banned — delete prose, show usage.
Co-Authored-By: Charon <charon@lethean.io>
LetheanTestnetPool is self-documenting; the prose description
"is the default pool endpoint for testnet mining" adds zero
information over the name. Per AX principle 2, deleted and kept
only the usage example.
Co-Authored-By: Charon <charon@lethean.io>
GetLatestVersion, Install, and Uninstall had prose comments restating
their signatures. Replaced with concrete call-site examples per AX
Principle 2 (comments as usage examples, not descriptions).
Co-Authored-By: Charon <charon@lethean.io>
The `errors` package is banned; all errors must use the package's own
error constructors. Replace `errors.New("unsupported operating system")`
with `ErrUnsupportedMiner(runtime.GOOS)` which also surfaces the actual
OS name in the error message.
Co-Authored-By: Charon <charon@lethean.io>
Replace errors.New() calls with ErrMinerExists() and ErrInvalidConfig() from the
project's own errors.go, removing the banned errors import (AX banned imports rule).
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments show HOW with real values, not WHAT the function does.
"sends a structured error response" restates the signature; replaced with
two concrete call-site examples showing realistic arguments.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2: comments must show usage examples, not restate what the
function name already conveys. Deleted 13 redundant "verifies that..."
lines; kept only the concrete usage-example lines below each.
Co-Authored-By: Charon <charon@lethean.io>
AX Principle 2 — comments show HOW with real values, not restate what
the type signature already says. Three prose-style doc comments on
DefaultRequestTimeout, HealthResponse, and StdinInput replaced with
concrete call-site examples.
Co-Authored-By: Charon <charon@lethean.io>
Use the package-local MarshalJSON helper (bufpool.go) instead of calling
json.Marshal directly, eliminating the banned encoding/json import per AX conventions.
Co-Authored-By: Charon <charon@lethean.io>
Replace fmt.Errorf with typed MiningError constructors (ErrMinerExists,
ErrMinerNotRunning) and fmt.Sprintf log lines with string concatenation
using strconv, eliminating the banned fmt import per AX conventions.
Co-Authored-By: Charon <charon@lethean.io>
AX principle 2: comments must show usage with concrete values, not restate
the function name in prose. The leading description line was deleted;
the two call-site examples that follow are sufficient.
Co-Authored-By: Charon <charon@lethean.io>
AX principle 2: comments show HOW with real values, not WHAT the
function does — the signature already says that.
Co-Authored-By: Charon <charon@lethean.io>