Commit graph

3 commits

Author SHA1 Message Date
Snider
6970da5c49 refactor: apply go fix modernizers for Go 1.26
Automated fixes: interface{} → any, range-over-int, t.Context(),
wg.Go(), strings.SplitSeq, strings.Builder, slices.Contains,
maps helpers, min/max builtins.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 21:00:17 +00:00
Snider
0be744e46a feat(allowance): add Redis backend for AllowanceStore
Implements RedisStore using github.com/redis/go-redis/v9 with Lua
scripts for atomic increment/decrement operations. Adds functional
options (WithRedisPassword, WithRedisDB, WithRedisPrefix), config
wiring via "redis" store_backend, and comprehensive tests covering
all 10 interface methods, concurrency, persistence, and error paths.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:23:13 +00:00
Snider
3e43233e0e feat: Phase 2 — SQLite AllowanceStore backend + config wiring
Add persistent storage for agent allowance quotas using go-store (SQLite KV).
SQLiteStore implements all 11 AllowanceStore methods with JSON serialisation,
mutex-guarded read-modify-write for atomic increments, and proper
time.Duration handling via nanosecond int64 encoding.

- allowance_sqlite.go: full AllowanceStore implementation with 4 KV groups
- allowance_sqlite_test.go: 26 tests covering CRUD, persistence across
  close/reopen, concurrent access (10 goroutines), and AllowanceService
  integration
- config.go: AllowanceConfig struct + NewAllowanceStoreFromConfig factory
- go.mod: add forge.lthn.ai/core/go-store dependency

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 07:07:49 +00:00