2026-02-19 16:09:13 +00:00
|
|
|
module forge.lthn.ai/core/go-ratelimit
|
|
|
|
|
|
2026-02-22 20:33:48 +00:00
|
|
|
go 1.26.0
|
2026-02-19 16:10:06 +00:00
|
|
|
|
feat(persist): Phase 2 — SQLite backend with WAL mode
Add multi-process safe SQLite persistence using modernc.org/sqlite (pure
Go, no CGO). Follows the go-store pattern: single connection,
WAL journal mode, 5-second busy timeout.
New files:
- sqlite.go: sqliteStore with schema (quotas, requests, tokens, daily
tables), saveQuotas/loadQuotas, saveState/loadState, close methods
- sqlite_test.go: 25 tests covering basic round-trips, integration,
concurrency (10 goroutines, race-clean), migration, corrupt DB recovery
Wiring:
- Backend field added to Config ("yaml" default, "sqlite" option)
- Persist() and Load() dispatch to correct backend
- NewWithSQLite() and NewWithSQLiteConfig() convenience constructors
- Close() method for cleanup (no-op for YAML)
- MigrateYAMLToSQLite() helper for upgrading existing YAML state
All existing YAML tests pass unchanged (backward compatible).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 07:50:48 +00:00
|
|
|
require (
|
2026-03-22 01:34:23 +00:00
|
|
|
dappco.re/go/core/io v0.2.0
|
|
|
|
|
dappco.re/go/core/log v0.1.0
|
feat(persist): Phase 2 — SQLite backend with WAL mode
Add multi-process safe SQLite persistence using modernc.org/sqlite (pure
Go, no CGO). Follows the go-store pattern: single connection,
WAL journal mode, 5-second busy timeout.
New files:
- sqlite.go: sqliteStore with schema (quotas, requests, tokens, daily
tables), saveQuotas/loadQuotas, saveState/loadState, close methods
- sqlite_test.go: 25 tests covering basic round-trips, integration,
concurrency (10 goroutines, race-clean), migration, corrupt DB recovery
Wiring:
- Backend field added to Config ("yaml" default, "sqlite" option)
- Persist() and Load() dispatch to correct backend
- NewWithSQLite() and NewWithSQLiteConfig() convenience constructors
- Close() method for cleanup (no-op for YAML)
- MigrateYAMLToSQLite() helper for upgrading existing YAML state
All existing YAML tests pass unchanged (backward compatible).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 07:50:48 +00:00
|
|
|
gopkg.in/yaml.v3 v3.0.1
|
2026-03-17 17:47:34 +00:00
|
|
|
modernc.org/sqlite v1.47.0
|
feat(persist): Phase 2 — SQLite backend with WAL mode
Add multi-process safe SQLite persistence using modernc.org/sqlite (pure
Go, no CGO). Follows the go-store pattern: single connection,
WAL journal mode, 5-second busy timeout.
New files:
- sqlite.go: sqliteStore with schema (quotas, requests, tokens, daily
tables), saveQuotas/loadQuotas, saveState/loadState, close methods
- sqlite_test.go: 25 tests covering basic round-trips, integration,
concurrency (10 goroutines, race-clean), migration, corrupt DB recovery
Wiring:
- Backend field added to Config ("yaml" default, "sqlite" option)
- Persist() and Load() dispatch to correct backend
- NewWithSQLite() and NewWithSQLiteConfig() convenience constructors
- Close() method for cleanup (no-op for YAML)
- MigrateYAMLToSQLite() helper for upgrading existing YAML state
All existing YAML tests pass unchanged (backward compatible).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 07:50:48 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
require (
|
2026-03-22 01:34:23 +00:00
|
|
|
forge.lthn.ai/core/go-log v0.0.4 // indirect
|
feat(persist): Phase 2 — SQLite backend with WAL mode
Add multi-process safe SQLite persistence using modernc.org/sqlite (pure
Go, no CGO). Follows the go-store pattern: single connection,
WAL journal mode, 5-second busy timeout.
New files:
- sqlite.go: sqliteStore with schema (quotas, requests, tokens, daily
tables), saveQuotas/loadQuotas, saveState/loadState, close methods
- sqlite_test.go: 25 tests covering basic round-trips, integration,
concurrency (10 goroutines, race-clean), migration, corrupt DB recovery
Wiring:
- Backend field added to Config ("yaml" default, "sqlite" option)
- Persist() and Load() dispatch to correct backend
- NewWithSQLite() and NewWithSQLiteConfig() convenience constructors
- Close() method for cleanup (no-op for YAML)
- MigrateYAMLToSQLite() helper for upgrading existing YAML state
All existing YAML tests pass unchanged (backward compatible).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 07:50:48 +00:00
|
|
|
github.com/dustin/go-humanize v1.0.1 // indirect
|
|
|
|
|
github.com/google/uuid v1.6.0 // indirect
|
|
|
|
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
|
|
|
|
github.com/ncruces/go-strftime v1.0.0 // indirect
|
|
|
|
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
2026-03-16 18:27:23 +00:00
|
|
|
golang.org/x/mod v0.34.0 // indirect
|
|
|
|
|
golang.org/x/sync v0.20.0 // indirect
|
2026-03-15 15:28:59 +00:00
|
|
|
golang.org/x/sys v0.42.0 // indirect
|
|
|
|
|
modernc.org/libc v1.70.0 // indirect
|
feat(persist): Phase 2 — SQLite backend with WAL mode
Add multi-process safe SQLite persistence using modernc.org/sqlite (pure
Go, no CGO). Follows the go-store pattern: single connection,
WAL journal mode, 5-second busy timeout.
New files:
- sqlite.go: sqliteStore with schema (quotas, requests, tokens, daily
tables), saveQuotas/loadQuotas, saveState/loadState, close methods
- sqlite_test.go: 25 tests covering basic round-trips, integration,
concurrency (10 goroutines, race-clean), migration, corrupt DB recovery
Wiring:
- Backend field added to Config ("yaml" default, "sqlite" option)
- Persist() and Load() dispatch to correct backend
- NewWithSQLite() and NewWithSQLiteConfig() convenience constructors
- Close() method for cleanup (no-op for YAML)
- MigrateYAMLToSQLite() helper for upgrading existing YAML state
All existing YAML tests pass unchanged (backward compatible).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 07:50:48 +00:00
|
|
|
modernc.org/mathutil v1.7.1 // indirect
|
|
|
|
|
modernc.org/memory v1.11.0 // indirect
|
|
|
|
|
)
|
feat(ratelimit): generalise beyond Gemini with provider profiles and push coverage to 95%
Phase 0: Rewrite test suite with testify (77.1% -> 95.1% coverage).
Add boundary tests, concurrent access tests, benchmarks, error path
coverage for Load/Persist, Reset, Stats, and CountTokens.
Phase 1: Extract hardcoded Gemini quotas into provider-agnostic config.
Add Provider type, DefaultProfiles(), NewWithConfig(), SetQuota(), and
AddProvider(). Pre-configured profiles for Gemini, OpenAI, Anthropic,
and Local. New() retains exact backward compatibility via delegation.
Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 01:07:57 +00:00
|
|
|
|
|
|
|
|
require (
|
2026-02-22 21:41:04 +00:00
|
|
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
|
|
|
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
feat(ratelimit): generalise beyond Gemini with provider profiles and push coverage to 95%
Phase 0: Rewrite test suite with testify (77.1% -> 95.1% coverage).
Add boundary tests, concurrent access tests, benchmarks, error path
coverage for Load/Persist, Reset, Stats, and CountTokens.
Phase 1: Extract hardcoded Gemini quotas into provider-agnostic config.
Add Provider type, DefaultProfiles(), NewWithConfig(), SetQuota(), and
AddProvider(). Pre-configured profiles for Gemini, OpenAI, Anthropic,
and Local. New() retains exact backward compatibility via delegation.
Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 01:07:57 +00:00
|
|
|
github.com/stretchr/testify v1.11.1
|
|
|
|
|
)
|