Commit graph

21 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
44223f0c67
ax(logging): rename mu to mutex for predictable naming
AX Principle 1: abbreviated field names increase semantic ambiguity.
Logger.mu renamed to Logger.mutex — no comment required to understand it.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:22:38 +01:00
Claude
3b077dd00d
ax(logging): add missing function name to GetLevel doc comment
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:21:20 +01:00
Claude
cb07aa01e3
ax(logging): replace prose comment with usage example on GetLevel
GetLevel had a comment that restated the signature in prose ("returns the
current minimum log level"), violating AX Principle 2. Replaced with a
concrete call-site example showing how the result is actually used.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:20:03 +01:00
Claude
8d323f7570
ax(logging): rename TestLoggerLevels/TestLoggerDebugLevel to TestFilename_Function_{Good,Bad,Ugly}
Some checks failed
Test / test (push) Has been cancelled
Security Scan / security (push) Has been cancelled
AX test naming rule: TestFilename_Function_{Good,Bad,Ugly} — all three
categories mandatory. Splits the single test into the three required forms.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:19:05 +01:00
Claude
1670659bba
ax(logging): replace prose comment on GetLevel with usage example
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
"GetLevel returns the current log level" restates the signature —
exactly what AX Principle 2 says to delete. Replaced with a concrete
usage example showing how a caller would inspect and conditionally
adjust the level.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:17:50 +01:00
Claude
5bfffbdec9
ax(logging): replace prose comment on WithComponent with usage example
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:16:29 +01:00
Claude
5b7c84142e
ax(logging): replace signature-restatement comment with usage example on SetLevel
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 14:15:18 +01:00
Claude
df3a641f5f
ax(logging): replace prose comments with usage examples on global functions
AX Principle 2 — global convenience functions had comments restating the
signature ("logs a debug message using the global logger") rather than
showing concrete calls with realistic values.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:14:21 +01:00
Claude
7d6d00a0e6
ax(logging): replace prose comment on New with usage example
AX Principle 2: comments must show concrete usage, not restate the
function name. "New creates a new Logger with the given configuration"
restated the signature — replaced with a callable example.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:13:04 +01:00
Claude
230c07adf3
ax(logging): rename globalMu/sb to globalMutex/builder
Abbreviated names `globalMu` and `sb` require a comment to understand
their purpose, violating AX Principle 1 (Predictable Names Over Short
Names). Renamed `globalMu` to `globalMutex` and `sb` to `builder`
throughout logger.go.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:11:47 +01:00
snider
ddcf39b7ee feat: Add structured logging package
Create pkg/logging with:
- Log levels: Debug, Info, Warn, Error
- Structured fields support (key-value pairs)
- Component-based logging (WithComponent)
- Global logger convenience functions
- ParseLevel for configuration
- Full test coverage

The package provides a migration path from log.Printf to
structured logging without external dependencies.

Example usage:
  logging.Info("miner started", logging.Fields{"name": minerName})
  logger := logging.New(cfg).WithComponent("Manager")
  logger.Warn("connection lost", logging.Fields{"pool": pool})

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 11:18:22 +00:00