Commit graph

864 commits

Author SHA1 Message Date
Claude
43e4b447ac
ax(batch): remove banned import references from comment examples
Replace all fmt.Println, fmt.Sprintf, log.Printf, log.Println, and
json.Unmarshal references in doc comments with logging.Info/logging.Warn
or direct value access patterns. Comments are examples that agents
learn from -- they must not demonstrate banned imports.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:07:35 +01:00
Claude
93a825c7da
ax(batch): expand abbreviated receiver names (AX Principle 1)
Rename short receivers to predictable full names across all packages:
- lb -> logBuffer (LogBuffer methods in miner.go)
- l -> logger (Logger methods in logging/logger.go)
- l -> level (Level.String() in logging/logger.go)
- h -> histogram (LatencyHistogram methods in metrics.go)
- r -> repository (FileRepository methods in repository.go)

Agents can now grep for the receiver name and get the type without
context. Single-letter 'c', 'm', 's', 'e' kept where idiomatic for
Container, Miner, Store, and Error types per Go convention.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:05:42 +01:00
Claude
132b69426a
ax(batch): replace prose comments with usage examples (AX Principle 2)
Convert "X returns the Y" / "X holds Y" / "X represents Y" style
comments to concrete usage examples across database/, logging/, and
mining/ packages. Comments now show how to call the function with
realistic values instead of restating what the signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:03:43 +01:00
Claude
c703bd9050
ax(batch): remove banned fmt import from all non-test source files
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Replace fmt.Sprintf with string concatenation + strconv.Itoa/FormatInt.
Replace fmt.Errorf with project MiningError constructors (ErrStartFailed,
ErrInstallFailed, ErrInternal) and a new databaseError helper in pkg/database.
Leaves fmt in pkg/logging (it IS the logging package) and test files.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:00:44 +01:00
Claude
54481b16ba
ax(node): rename NewWorker param node→nodeManager for AX clarity
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Parameter named `node` shadowed the package name inside package node,
creating semantic ambiguity. AX Principle 1: predictable names over
short names — `nodeManager` matches the field name and the type.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:56:22 +01:00
Claude
9096452ff1
ax(mining): rename msg to clientMessage in wsClient.readPump
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 1 — predictable names over short names. `msg` required
reading the struct to understand what it contained; `clientMessage`
is self-describing at the call site.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:55:41 +01:00
Claude
aba728ff83
ax(node): rename msg to errorMessage in NewErrorMessage
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 1: Predictable names over short names.
`msg` is an abbreviation; `errorMessage` names what it is.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:55:08 +01:00
Claude
ba72f3e408
ax(mining): replace implementation-describing comment with call-site example on saveUnlocked
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments show HOW to call, not WHAT the body does.
The old comment restated the lock/defer mechanics; the new comment
shows the caller context (Save and Update) so an agent knows when
saveUnlocked is the right call.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:54:37 +01:00
Claude
f766f06c18
ax(node): rename msg/smsgMsg to message/decryptedMessage in transport
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Abbreviated variable names `msg` and `smsgMsg` violate AX Principle 1
(predictable names over short names). Renamed to `message` and
`decryptedMessage` for semantic clarity without context switching.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:53:58 +01:00
Claude
ba2e68a685
ax(mining): remove ErrCodeInternal alias in favour of canonical ErrCodeInternalError
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Two names for the same constant violates AX Principle 1 (predictable
names over short names). The alias `ErrCodeInternal` is ambiguous and
shorter than the fully-descriptive `ErrCodeInternalError`. Remove the
alias and update all five call sites to use the canonical name.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:52:03 +01:00
Claude
9261820ab2
ax(node): rename msg/conn to message/connection in worker handlers
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 1 — predictable names over short names. msg and conn
are abbreviations that require context to decode; message and connection
are self-documenting.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:51:30 +01:00
Claude
4861483238
ax(mining): rename wsClient receiver c to client for AX Principle 1
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Single-letter receiver `c` is only permitted for `*core.Core`.
`*wsClient` methods (safeClose, writePump, readPump) used the
ambiguous single-letter `c`; renamed to the full `client` so the
receiver is self-describing without a comment.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:50:48 +01:00
Claude
e68fbcaef0
ax(node): rename Worker.node field to nodeManager for AX Principle 1 compliance
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
The field `node *NodeManager` used an ambiguous single-word name that required
context to understand. Renamed to `nodeManager` to be self-describing per AX
Principle 1: predictable names over short names.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:49:13 +01:00
Claude
f0b4fea2e3
ax(mining): replace prose comment with usage example on addCliArgs
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX principle 2: comments show HOW with real values, not WHAT the signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:48:46 +01:00
Claude
8695098988
ax(node): rename body to requestBody in lethean.go (AX Principle 1)
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:47:53 +01:00
Claude
e560e93ef3
ax(mining): rename EventHub receiver from h to hub for AX Principle 1 compliance
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:47:22 +01:00
Claude
0ef766ee36
ax(node): rename Controller.node field to nodeManager for AX Principle 1
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
`node` is ambiguous in the `node` package — callers cannot distinguish the
field from the package name without tracing. `nodeManager` names the type
it holds and removes all mapping overhead.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:46:35 +01:00
Claude
9da561ae95
ax(mining): rename minersMu to minersMutex in wsClient
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:45:32 +01:00
Claude
d10faee13d
ax(mining): replace banned fmt.Errorf with package error constructors in miner.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:44:08 +01:00
Claude
bfdf3be4fd
ax(node): rename local variable pc to connection in transport.go
AX Principle 1: predictable names over short names. The abbreviation
`pc` (PeerConnection) in local variable scope is ambiguous — renamed
to `connection` in Connect, Stop, Send, Broadcast, and handleWSUpgrade.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:44:05 +01:00
Claude
45722a230c
ax(mining): rename da receiver to digestAuth and ha1/ha2 to hashA1/hashA2 in auth.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:41:38 +01:00
Claude
9a511ddc72
ax(node): replace direct json.MarshalIndent/Unmarshal with package wrappers in peer.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
encoding/json is a banned import; peer.go used json.MarshalIndent and
json.Unmarshal directly in saveNow/load instead of the package-local
MarshalJSON/UnmarshalJSON wrappers. Removes the encoding/json import.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:41:18 +01:00
Claude
852db44e4e
ax(mining): replace prose comment with usage examples in error code block
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments show HOW with real values, not WHAT the block contains.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:39:58 +01:00
Claude
21c815b494
ax(node): route identity JSON through package MarshalJSON/UnmarshalJSON wrappers
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
identity.go was calling encoding/json directly (json.MarshalIndent,
json.Unmarshal) despite the package already defining MarshalJSON and
UnmarshalJSON in bufpool.go. Switch to the wrappers and remove the
direct encoding/json import from identity.go.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:39:43 +01:00
Claude
b20b74fbe7
ax(mining): replace prose comment with usage example on MinerTypeTTMiner
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments show HOW with real values, not WHAT the name means.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:38:42 +01:00
Claude
3e48734e7e
ax(node): add missing _Bad and _Ugly test variants for TestMessage_NewMessage
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 10 (CLI tests as artifact validation) requires all three
test categories — Good, Bad, Ugly — to be mandatory. TestMessage_NewMessage
had only _Good; add _Bad (unmarshalable payload returns error) and _Ugly
(empty From/To fields succeed and produce a valid message ID).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:38:04 +01:00
Claude
263b45db88
ax(mining): rename cb receiver to circuitBreaker in CircuitBreaker methods
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:37:00 +01:00
Claude
48a6532dea
ax(node): rename ackMsg/ackData to acknowledgementMessage/acknowledgementData
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 1 — predictable names over short names. `ackMsg` and `ackData`
require the reader to expand the abbreviation; `acknowledgementMessage` and
`acknowledgementData` are self-describing in the handshake context.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:35:23 +01:00
Claude
fc79b16f67
ax(mining): replace prose doc comment with usage example on XMRigMiner.Stop
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments show HOW with real values, not what the signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:34:18 +01:00
Claude
0c2802a882
ax(mining): replace prose comment on wsUpgrader with usage example
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:33:04 +01:00
Claude
5afb9e98f7
ax(node): remove prose comment from Transport.Start
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Comment restated what the function does in prose rather than showing
a concrete usage example, violating AX principle 2 (comments as usage
examples). The usage example on the preceding line is sufficient.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:31:52 +01:00
Claude
ccf57565b9
ax(mining): replace prose comments with usage examples on xmrig.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:31:27 +01:00
Claude
f1ba1a28a5
ax(node): rename authMode to authenticationMode in PeerRegistry
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX-1 (predictable names over short names): `auth` is an abbreviation
of `authentication`; the full word removes semantic ambiguity for agents
tracing authentication mode through the peer registry.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:30:28 +01:00
Claude
39f0a57847
ax(mining): replace fmt.Sprintf with string concatenation in miner.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:29:57 +01:00
Claude
f4c7a91603
ax(mining): replace banned strings import in node_service with package-local containsStr
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:27:29 +01:00
Claude
096d7e0137
ax(node): replace direct json.Unmarshal with package-local UnmarshalJSON wrapper
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
ParsePayload was calling encoding/json.Unmarshal directly, bypassing the
package-local UnmarshalJSON wrapper that already exists in bufpool.go.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:27:01 +01:00
Claude
697394c1f4
ax(node): replace prose comment with usage example on MessageType
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments must show HOW with real values, not restate
what the type signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:26:02 +01:00
Claude
14019e9693
ax(mining): rename httpClientMu to httpClientMutex (AX Principle 1)
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:24:46 +01:00
Claude
882dff4afc
ax(node): replace banned encoding/json import with package UnmarshalJSON wrapper in lethean.go
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:24:46 +01:00
Claude
09a87eb021
ax(node): rename resp parameter to response in ResponseHandler methods
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Abbreviated parameter names violate AX Principle 1 (predictable names
over short names). resp → response in ValidateResponse and ParseResponse.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:23:03 +01:00
Claude
7e66f32ee5
ax(mining): rename rl receiver to limiter in RateLimiter methods
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>
2026-04-02 17:23:02 +01:00
Claude
f70f477745
ax(node): rename mux to serveMux for AX predictable naming
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Short name `mux` requires context to understand; `serveMux` is
self-describing per AX Principle 1 (predictable names over short names).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:21:31 +01:00
Claude
42fd76d0c2
ax(mining): remove banned encoding/json import from stats_collector.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:20:57 +01:00
Claude
7ac13d5e20
ax(node): remove banned encoding/json import from transport.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Replace three direct json.Unmarshal calls with the package-level
UnmarshalJSON wrapper defined in bufpool.go, eliminating the
banned encoding/json import from transport.go.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:19:29 +01:00
Claude
5832752616
ax(mining): replace prose description with usage example on DefaultMetrics
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:19:00 +01:00
Claude
d3ae8ce8e7
ax(mining): rename abbreviated tr to tarReader in untar
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:18:01 +01:00
Claude
409749926d
ax(node): replace prose comment on Message with usage example
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX principle 2 — comments show HOW, not WHAT. The previous comment
restated the type name; replaced with concrete NewMessage/Reply calls.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:17:24 +01:00
Claude
e0b941cf05
ax(mining): replace fmt.Errorf with ErrInternal in updateInstallationCache
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:16:27 +01:00
Claude
bcdce246f6
ax(node): add missing _Bad and _Ugly tests for TestMessage_Reply
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 10 requires all three categories (Good, Bad, Ugly) for
every test function. TestMessage_Reply had only _Good; adds _Bad
(unmarshalable payload propagates error) and _Ugly (self-to-self
addressing preserves correct From/To reversal).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:16:05 +01:00
Claude
9e5afb3d69
ax(mining): rename abbreviated parameter st to supervisedTask in startTask
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:15:01 +01:00