Commit graph

5 commits

Author SHA1 Message Date
Claude
b866dacdd2
feat(store): add TTL support and harden test coverage to 90.9%
Phase 0 -- Hardening:
- Fix SQLITE_BUSY under concurrent writes by setting SetMaxOpenConns(1)
  and PRAGMA busy_timeout=5000
- Add comprehensive tests: concurrent read/write (10 goroutines),
  edge cases (unicode, null bytes, SQL injection, long keys), error
  paths (closed store, invalid paths, corrupt files), group isolation,
  upsert verification, WAL mode verification, ErrNotFound wrapping
- Add benchmarks: Set, Get, GetAll (10K keys), file-backed Set

Phase 1 -- TTL Support:
- Add expires_at nullable column with schema migration for pre-TTL DBs
- SetWithTTL(group, key, value, duration) stores keys that auto-expire
- Lazy deletion on Get for expired keys
- Background purge goroutine (configurable interval, default 60s)
- Public PurgeExpired() method for manual cleanup
- Count, GetAll, Render all exclude expired entries
- Set clears TTL when overwriting a TTL key

Coverage: 73.1% -> 90.9% (48 tests, 0 races)

Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 01:14:08 +00:00
Snider
49b42b5b10 docs: enrich TODO.md with Phase 0 hardening tasks
Add Phase 0: concurrent Set/Get race tests, edge cases (empty
key, Unicode, binary values), WAL mode verification, benchmarks.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 00:28:48 +00:00
Virgil
d3d3eab174 docs: add TODO.md and FINDINGS.md for fleet delegation
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-19 21:36:19 +00:00
Snider
63c37cb801 fix: add modernc.org/sqlite dependency
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-19 16:10:16 +00:00
Snider
9ebe581069 feat: extract go-store from core/go pkg/store
SQLite key-value store wrapper.
Zero external dependencies (stdlib only).
Module: forge.lthn.ai/core/go-store

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-19 16:09:15 +00:00