Commit graph

372 commits

Author SHA1 Message Date
Virgil
0893b0ef9e AX: clarify mining cache names and examples
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
2026-04-04 06:14:19 +00:00
Virgil
262987c10a AX cleanup for mining service names
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
2026-04-04 05:53:48 +00:00
Virgil
a675d16ed6 AX: clarify mining service names and comments
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
2026-04-04 05:39:20 +00:00
Virgil
4e8283c84f Apply AX naming and comment cleanup
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
2026-04-04 05:36:07 +00:00
Virgil
68c826a3d8 Align mining AX naming and comments
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
2026-04-04 05:33:08 +00:00
Virgil
c7f86cf5b9 Apply AX naming and comment cleanup
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
2026-04-04 05:27:28 +00:00
Virgil
7c214f0c8b AX: make mining helpers more descriptive
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
2026-04-04 05:21:43 +00:00
Virgil
6838f26d99 Improve AX naming and path docs
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
2026-04-04 05:17:54 +00:00
Virgil
976ff0141c refactor(ax): tighten remaining naming and docs
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-04 05:08:34 +00:00
Virgil
9102b25f55 Apply AX naming and comment cleanup
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
2026-04-04 04:16:13 +00:00
Virgil
e3986fb064 Refine AX naming and usage comments
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
2026-04-04 04:00:30 +00:00
Claude
1f9624279a
ax(batch): rename abbreviated variables to predictable names
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
resp→response, db→database pattern across mining, logging packages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 04:47:58 +01:00
Claude
3bf5496fce
ax(batch): fix abbreviated names in comment examples and locals
Some checks failed
Security Scan / security (push) Has been cancelled
Test / test (push) Has been cancelled
h→hash/histogram, e→miningError, a/b→current/previous,
n→count, user/pass→username/password, passMatch→passwordMatch
in comment examples and auth.go locals.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 18:50:29 +01:00
Claude
4a7c19689a
ax(batch): fix abbreviated names in usage example comments
cb→breaker, rl→rateLimiter, db→database in comment examples
(AX Principle 1: predictable names in examples too).

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