Commit graph

687 commits

Author SHA1 Message Date
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
Claude
5e525396ed
ax(node): replace banned strings import with inline version join
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Removes the banned `strings` import from transport.go by extracting
a `joinVersions` helper into message.go alongside SupportedProtocolVersions,
eliminating the single `strings.Join` call in the handshake rejection path.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:14:17 +01:00
Claude
ab4c764f3f
ax(mining): replace prose comments with usage examples in repository.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:13:36 +01:00
Claude
ac21008585
ax(node): remove banned fmt import from transport.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Replace all fmt.Errorf and fmt.Sprintf calls in transport.go with
ProtocolError{} structs and string concatenation, matching the error
pattern already used throughout the node package.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:12:10 +01:00
Claude
8406c0b4f2
ax(mining): replace prose comment with usage example on createConfig
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>
2026-04-02 17:11:53 +01:00
Claude
f6884ddad6
ax(mining): replace prose description comments with usage examples in ttminer.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:10:45 +01:00
Claude
70fc8a6552
ax(node): remove banned fmt import from bundle.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Replace all fmt.Errorf calls in bundle.go with ProtocolError structs,
eliminating the banned fmt import. Error messages are preserved via
string concatenation consistent with the rest of the node package.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:10:07 +01:00
Claude
ec0ab317ea
ax(mining): replace prose comment with usage example on XMRigMiner
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 type is.
The old comment restated the struct definition. Replaced with a concrete
construction example.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:08:47 +01:00
Claude
bc7b752754
ax(mining): replace prose comment with usage example on TTMiner.GetStats
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. Aligns with xmrig_stats.go and simulated_miner.go.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:07:57 +01:00
Claude
224a3c6118
ax(node): rename cfg.json to config.json in test path
AX Principle 1: predictable names over short names. cfg.json →
config.json makes the path self-describing without a comment.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:07:55 +01:00
Claude
2508b03df1
ax(mining): replace encoding/json with internal UnmarshalJSON in version.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:07:00 +01:00
Claude
23cab1fc95
ax(mining): replace prose comments with usage examples on unzip/untar
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. "unzip extracts a zip archive" restates the
name; replaced with concrete call-site examples.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:03:29 +01:00
Claude
c5bb4cf632
ax(node): replace single-letter loop variables p and k with peer and key
Range variables `p` and `k` in peer_test.go require context to decode —
violates AX Principle 1 (predictable names over short names). Renamed to
`peer` and `key` so intent is self-evident without reading the loop body.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 17:03:24 +01:00
Claude
3b3f20684e
ax(mining): remove banned fmt import from auth.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 17:02:04 +01:00
Claude
d514d4956d
ax(mining): replace prose comment with usage example on NodeInfoResponse
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
// 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>
2026-04-02 17:00:27 +01:00
Claude
406005b21a
ax(node): rename abbreviated msg locals to message in controller
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. Local variables
declared as `msg` in GetRemoteStats, StartRemoteMiner, StopRemoteMiner,
GetRemoteLogs, and PingPeer renamed to `message`.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:59:58 +01:00
Claude
5728c73496
ax(mining): replace banned errors.New() with package-native MiningError constructors
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 16:59:11 +01:00
Claude
5687999f4f
ax(mining): replace prose comment with usage example on TTMiner.Start
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 16:58:02 +01:00
Claude
b210b160d9
ax(node): rename tt to testCase in TestWorker_ConvertMinerStats_Good
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. `tt` is an
abbreviated loop variable; `testCase` states the semantic clearly.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:57:50 +01:00
Claude
7b098da3be
ax(mining): replace prose comments with usage examples in simulated_miner.go
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 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>
2026-04-02 16:56:59 +01:00
Claude
09f6f12f08
ax(node): fix TestProtocol_ValidateResponse_Ugly comment and assertion
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
ValidateResponse wraps type-mismatch in *ProtocolError (correct behaviour).
The docstring example showed the wrong negation and the assertion fired on
every run. Both the comment (AX §2 — comments as accurate usage examples)
and the guard were inverted; corrected to !IsProtocolError.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:56:38 +01:00
Claude
1e5af44364
ax(mining): replace prose comments with usage examples in service.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 16:55:07 +01:00
Claude
aa69d9c933
ax(node): add Good and Ugly test variants for GetChainInfo, DiscoverPools, DiscoverGateways
AX principle 10 requires all three test categories (Good, Bad, Ugly).
lethean_test.go only had Bad variants for the three discovery functions;
added Good (happy-path via httptest.Server) and Ugly (edge-case filtering
and malformed JSON) for each, using a local test server to avoid live daemon dependency.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:54:59 +01:00
Claude
0e5956f57d
ax(node): replace path with filepath for filesystem path joining
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
The "path" package uses forward-slash separators and is intended for
URL paths; filesystem paths require "path/filepath" for OS-correct
behaviour. Fixes worker.go handleDeploy to use filepath.Join when
constructing the miners installation directory.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:53:35 +01:00
Claude
670401c750
ax(mining): replace prose comments with usage examples on middleware funcs
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 16:52:31 +01:00
Claude
b4cef1305e
ax(node): expand nm abbreviation to nodeManager in usage comments
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 `nm` shorthand
in seven comment examples was inconsistent with the full `nodeManager`
name used in actual call-site code and the `manager` receiver name
throughout the file.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:51:54 +01:00
Claude
f78be454e4
ax(mining): replace prose DTO comments with usage examples in node_service.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 16:50:55 +01:00
Claude
1b021a073b
ax(node): rename ack to acknowledgement in Worker message handlers
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX-1: predictable names over short names. The variable `ack` is an
abbreviation for `acknowledgement` — renamed in all six callsites
within handleStartMiner, handleStopMiner, and handleDeploy so the
name is self-describing without a comment.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:50:13 +01:00
Claude
d798248ed8
ax(mining): replace prose comment with usage example on logWithRequestID
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
function name already says. Prose description deleted; two concrete
call-site examples added.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:49:16 +01:00
Claude
ea9eb19e5b
ax(node): replace prose constant comments with usage examples in message.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments show usage, not prose descriptions. The
ProtocolVersion/MinProtocolVersion block comment and SupportedProtocolVersions
doc comment restated what the names already say; replaced with concrete
call-site examples.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:48:39 +01:00
Claude
871dc781f1
ax(mining): replace prose GetType comment with usage example
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 16:48:10 +01:00
Claude
d8dffa398b
ax(mining): replace prose field comments with usage examples in ContainerConfig
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 16:47:16 +01:00
Claude
07ba7b7e62
ax(node): replace banned fmt import in peer.go with ProtocolError
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:47:06 +01:00
Claude
485411912a
ax(node): replace banned fmt import in worker.go with ProtocolError
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
All fmt.Errorf calls replaced with &ProtocolError{Code, Message} using
the package-native error type, removing the banned fmt import entirely.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:44:42 +01:00
Claude
82781c6f95
ax(mining): remove prose comment that restates constant name
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>
2026-04-02 16:44:39 +01:00
Claude
b4c73147fe
ax(node): replace direct encoding/json with package-level UnmarshalJSON wrapper
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
worker.go imported encoding/json directly and called json.Unmarshal at two
call sites. bufpool.go already provided MarshalJSON as the package wrapper;
add matching UnmarshalJSON and route both worker.go call sites through it,
removing the encoding/json import from worker.go.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:42:45 +01:00
Claude
3c9ff897f2
ax(mining): replace prose comments with usage examples on TTMiner methods
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>
2026-04-02 16:42:43 +01:00
Claude
695a62b61a
ax(node): remove banned fmt import from controller.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Replace all fmt.Errorf calls with typed *ProtocolError values using the
native node error type — consistent with how protocol.go was cleaned up.
Error wrapping cases (failed to create message) now surface the original
error directly, preserving the call chain without fmt.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:41:30 +01:00
Claude
dd9f5cfcaf
ax(mining): replace banned errors.New with ErrUnsupportedMiner in xmrig.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 16:41:15 +01:00
Claude
f71d551cdd
ax(mining): replace banned errors import in ttminer_start.go with project-native constructors
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 16:39:53 +01:00
Claude
7d5074bf3b
ax(mining): replace prose comment on requestTimeoutMiddleware 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 with real values, not WHAT the function does.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:38:52 +01:00
Claude
68fbe70c54
ax(node): rename ack to acknowledgement in controller (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 16:38:18 +01:00
Claude
abd4335935
ax(mining): replace prose comment with usage example on respondWithMiningError
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 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>
2026-04-02 16:37:20 +01:00
Claude
acef50ad62
ax(node): rename tt loop variable to testCase in lethean_test.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 `tt` loop variable
is a two-letter abbreviation with no defined exception in the AX naming rules
(only `i`, `_`, `t`, `c` are acceptable short names). Renamed to `testCase`
throughout TestParseComment_{Good,Bad,Ugly}.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:36:41 +01:00
Claude
00025dd324
ax(mining): remove prose description comments from circuit_breaker_test
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 16:35:50 +01:00
Claude
676d7b13a9
ax(node): remove prose description lines from PeerRegistry method comments
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments show usage examples, not prose descriptions.
Five methods (AddPeer, UpdatePeer, RemovePeer, UpdateMetrics, UpdateScore)
had a redundant "Note: Persistence is debounced..." prose line appended
after the usage example. The usage example already communicates intent;
the prose line restated implementation detail without adding value.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:33:20 +01:00
Claude
9933c8e5aa
ax(mining): replace prose comments with usage examples in service.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 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>
2026-04-02 16:33:00 +01:00
Claude
b0c1d0e05c
ax(mining): replace banned encoding/json import in lethean.go with project-native MarshalJSON
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 16:31:42 +01:00
Claude
81f4fc9d96
ax(node): replace prose constant comments with usage examples
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Score constants had comments restating the name in prose
("Increment for successful interaction") rather than showing
how they are used. AX Principle 2: comments are usage examples,
not descriptions.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:31:11 +01:00
Claude
10dd88281b
ax(mining): remove banned fmt import from simulated_miner.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
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>
2026-04-02 16:30:03 +01:00