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
cf4d52a3b7
ax(mining): rename errors_test.go functions to TestErrors_Function_{Good,Bad,Ugly}
...
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Test names lacked the AX-required suffix pattern (RFC-025 §10 test naming).
Renamed all 8 functions to TestErrors_* with _Good, _Bad, and _Ugly suffixes.
Also renamed loop variables from tt to c (predictable name, AX principle 1).
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:01:30 +01:00
snider
95ae55e4fa
feat: Add rate limiter with cleanup and custom error types
...
Rate Limiter:
- Extract rate limiting to pkg/mining/ratelimiter.go with proper lifecycle
- Add Stop() method to gracefully shutdown cleanup goroutine
- Add RateLimiter.Middleware() for Gin integration
- Add ClientCount() for monitoring
- Fix goroutine leak in previous inline implementation
Custom Errors:
- Add pkg/mining/errors.go with MiningError type
- Define error codes: MINER_NOT_FOUND, INSTALL_FAILED, TIMEOUT, etc.
- Add predefined error constructors (ErrMinerNotFound, ErrStartFailed, etc.)
- Support error chaining with WithCause, WithDetails, WithSuggestion
- Include HTTP status codes and retry policies
Service:
- Add Service.Stop() method for graceful cleanup
- Update CLI commands to use context.Background() for Manager methods
Tests:
- Add comprehensive tests for RateLimiter (token bucket, multi-IP, refill)
- Add comprehensive tests for MiningError (codes, status, retryable)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 10:56:26 +00:00