Commit e3605c5
committed
feat(persistence): add SQLite persistence for conversation state and models
Implement comprehensive SQLite-based persistence layer:
- PersistenceManager with full CRUD operations for conversations
- Save/load conversation history with project isolation
- Persist reservoir computing state across sessions
- Store trained MLP weights with accuracy tracking
- Configuration persistence
- Database utilities (vacuum, size checking)
- Full test coverage (7 tests, all passing)
Schema includes:
- conversations table (indexed by project and timestamp)
- reservoir_states table (per-project state)
- model_weights table (versioned model storage)
- metadata and config tables
Features:
- Transaction safety
- Query parameterization (SQL injection safe)
- Efficient indexing for common queries
- In-memory database support for testing
- Graceful handling of missing data
Dependencies added:
- rusqlite 0.31 (bundled SQLite)
- lazy_static 1.4 (global state)
- rand 0.8 (for training)
- proptest 1.4 (dev dependency for future property tests)
Default feature: persistence enabled by default for production use
Can be disabled with --no-default-features for minimal builds
Stats: 612 lines of persistence code + tests
All tests passing: cargo test --features persistence persistence1 parent 68ea6f5 commit e3605c5
3 files changed
Lines changed: 621 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
18 | 23 | | |
19 | 24 | | |
20 | 25 | | |
| |||
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | | - | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
| 37 | + | |
| 38 | + | |
31 | 39 | | |
32 | 40 | | |
33 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
0 commit comments