fix(recovery): register lazy state.db tables in one schema map; cover .recover lane and count-mismatch loss
Follow-up to the salvaged #100350 commits: replace the per-table 'if table == "delivery_obligations"' branches in session_recovery.py and session_lost_and_found.py with a single _AUXILIARY_TABLE_SCHEMAS registry (table -> destination DDL initializer) that both the SQL-level and the lost_and_found lanes consume, so the next lazily-created state.db table is one entry, not three code paths. The .recover lane now iterates _CANONICAL_TABLES + _AUXILIARY_TABLES instead of a duplicated literal list. Tests: the .recover direct-copy lane creates the missing ledger on the destination; a source-vs-destination obligation count mismatch fails verification (complete=False) instead of reporting a clean salvage. Docs: state.db table inventory lists delivery_obligations. Addresses #100313
This commit is contained in:
@@ -21,9 +21,15 @@ Source file: `hermes_state.py`
|
||||
├── gateway_routing — Gateway routing metadata
|
||||
├── compression_locks — Cross-process compression locking
|
||||
├── async_delegations — Async delegation bookkeeping
|
||||
├── delivery_obligations — Gateway outbox (owed replies); created lazily by gateway/delivery_ledger.py
|
||||
└── schema_version — Single-row table tracking migration state
|
||||
```
|
||||
|
||||
`hermes sessions recover` copies the row-bearing tables above into the
|
||||
recovered database (FTS indexes and `schema_version` are regenerated), including
|
||||
the lazily-created `delivery_obligations` ledger when the source has one — its
|
||||
row count is verified like `sessions`/`messages`.
|
||||
|
||||
Key design decisions:
|
||||
- **WAL mode** for concurrent readers + one writer (gateway multi-platform)
|
||||
- **FTS5 virtual table** for fast text search across all session messages
|
||||
|
||||
Reference in New Issue
Block a user