[audit] Deep audit — missing tests, edge cases, error handling #3
Labels
No labels
needs-review
needs-review
athena
athena-gemini
audit
clotho
clotho-gemini
codex
darbs-claude
security
wiki
No milestone
No project
No assignees
1 participant
Notifications
Due date
-
Dependencies
No dependencies set.
Reference: core/go-ratelimit#3
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Prior AX sweep found:
This audit should go deeper: find missing test coverage, untested edge cases, and additional security concerns.
Spark Audit Findings (20 total)
HIGH (2)
MEDIUM (4)
LOW (4)
Fix Applied
Commit
d1c90b9: fix(ratelimit): harden audit edge casesVerification: FAIL (reproduced)
loadSQLite only replaces Quotas when persisted map is non-empty — breaks snapshot semantics. saveSnapshot clears + rewrites, but Load skips empty maps. Empty quota snapshot can't round-trip (reproduced: Persist with Quotas={}, reopen, Load returns stale defaults).
Needs: loadSQLite must replace Quotas even when persisted map is empty.
Fix Round 2
Commit
9e715c2: fix(sqlite): replace quotas on empty snapshot loadDispatching verification.
Verification Round 2: FAIL
HIGH: Empty snapshot fix breaks first-run — new DB has empty quotas table, unconditional Load() wipes configured defaults, CanSend falls into 'unknown model allowed' path. Rate limiting effectively disabled on first run.
Needs: distinguish 'never persisted' from 'intentionally empty'. Either a sentinel/flag in DB or don't Load() until first Persist() has occurred.
Fix Round 3
Commit
5df6ce1: fix(sqlite): preserve defaults before first persistDispatching verification.
Verification Round 3: FAIL (medium — legacy migration)
MEDIUM: Legacy pre-snapshot_meta SQLite files with intentionally empty snapshots still load incorrectly. Backfill only marks DB as having snapshot when tables have rows — valid old empty snapshot stays unmarked, Load returns early.
This is the oscillation pattern (plan anomaly #16) — each fix handles one case but misses another. 3 rounds on this specific state machine. Escalating to needs-human.
API Contract Extraction
Full exported API inventory. Key stats:
Full table in agent log.