Commit graph

358 commits

Author SHA1 Message Date
Claude
4e7d4d906b
ax(batch): remove redundant prose comments in source files
Delete inline comments that restate what the next line of code does
(AX Principle 2). Affected: circuit_breaker.go, service.go, transport.go,
worker.go, identity.go, peer.go, bufpool.go, settings_manager.go,
node_service.go.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:48:08 +01:00
Claude
8c4e8bd8f2
ax(batch): rename abbreviated locals in test files
m→manager, wg→waitGroup, w→recorder, da→digestAuth, nc→nonceCount,
tt→testCase, tc→testCase, et→eventType, bt→bundleType, mu→mutex,
c→testCase, h→hash, p→point, s→statEntry across all test files.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:44:08 +01:00
Claude
95c602104f
ax(batch): rename abbreviated locals in source files
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
ns→nodeService, c→xmrigConfig, m→manager, k→minerKey, s→stringValue,
l→linesParam, ip→clientAddress, r→character, mgr→manager across
pkg/mining and cmd/mining source files.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:36:02 +01:00
Claude
6a8efa4776
ax(batch): expand remaining abbreviated variables in loop bodies and type assertions
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Renames: m->minerName (range over miners list), rm->xmrigInstance/ttInstance
(type assertion variables), dbPoints->databasePoints (database query result).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:31:42 +01:00
Claude
63a9107f9c
ax(batch): add missing test files and fix pre-existing test compilation errors
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Adds test files for 6 source files that had no corresponding test:
bufpool_test.go (mining + node), metrics_test.go, version_test.go,
supervisor_test.go, mining_profile_test.go. Each follows
TestFilename_Function_{Good,Bad,Ugly} convention.

Also fixes 2 pre-existing compilation errors:
- ratelimiter_test.go: rl -> rateLimiter (leftover from AX rename)
- worker_test.go: worker.node -> worker.nodeManager (field was renamed)

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:30:42 +01:00
Claude
50f4310ba8
ax(batch): expand abbreviated local variables inside function bodies
Applies AX principle 1 to local variables in function bodies:
d->entry (dir entries), p->point (hashrate points), f->zipEntry/entryReader
(zip files), r->zipReader, gzr->gzipReader, f->outputFile (tar files),
k,v->key,value (map iteration), p->pattern (dangerous patterns),
f->fieldSet (logging fields).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:29:11 +01:00
Claude
0d1b20e177
ax(batch): replace prose comments with usage examples across all packages
Applies AX principle 2 (Comments as Usage Examples) — removes prose
descriptions that restate the function signature ("returns", "retrieves",
"creates", "wraps", etc.) and keeps or replaces with concrete usage
examples showing real calls with realistic values.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:28:16 +01:00
Claude
b12db10680
ax(batch): expand abbreviated parameter and local variable names across all packages
Applies AX principle 1 (Predictable Names Over Short Names) to function
signatures and local variables: s->input/raw, v->target/value, d->duration,
a,b->left,right, w->writer, r->reader, l->logger, p->part/databasePoint,
fn parameter names left as-is where they are callback conventions.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:27:21 +01:00
Claude
c67dca2a97
ax(batch): apply Good/Bad/Ugly test naming to remaining test files
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Second pass of test naming convention across xmrig_test.go,
xmrig_gpu_test.go, stats_collector_test.go, manager_race_test.go,
throttle_test.go, service_test.go, interface_test.go,
database_race_test.go. 30 additional tests renamed.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:23:59 +01:00
Claude
a7b7d6a2aa
ax(batch): remove banned fmt import from xmrig_test.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Replaces fmt.Sscanf with strconv.Atoi for port parsing, removing the
banned fmt import from the test file per AX banned-imports rules.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:21:13 +01:00
Claude
14cf520778
ax(batch): apply Good/Bad/Ugly test naming convention across all packages
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Renames test functions to follow TestFilename_Function_{Good,Bad,Ugly}
convention per AX test naming rules. Covers profile_manager_test.go
(11 tests), events_test.go (9 tests), container_test.go (8 tests),
logger_test.go (9 tests), database_test.go (10 tests).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:20:32 +01:00
Claude
3673757d2a
ax(batch): replace prose comments with usage examples across all packages
Converts comments that restate function signatures into concrete usage
examples per AX Principle 2. Affected files: database_race_test.go,
interface_test.go, errors_test.go, xmrig_test.go, service_test.go,
manager_test.go.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:16:56 +01:00
Claude
fcae672dbc
ax(batch): expand abbreviated local variable names across all packages
Renames 2-3 letter abbreviated locals to predictable names per AX
Principle 1: pm→profileManager, sm→settingsManager, rl→rateLimiter,
cb→breaker, hr→rate, wg→waitGroup, pm1/pm2→firstProfileManager/
secondProfileManager, cb1/cb2→firstBreaker/secondBreaker.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:15:15 +01:00
Claude
9e0126a935
ax(batch): remaining prose-to-example comment conversions
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Convert final batch of prose-style comments to concrete usage examples:
- ttminer_start.go: buildArgs, addTTMinerCliArgs, isValidCLIArg,
  isValidArgValue now show realistic input/output
- logger.go: log() method shows concrete call
- syslog_unix.go: logToSyslog shows realistic message

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:08:24 +01:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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