Files
deepseek-harness/packages/session/session-persistence-sqlite/src
Magolor 870c1d5c7e fix(session): list Sessions again after a damaged database is recovered
Recovery moved the database aside but left every `.segments/*.json` routing
record in place. Each record names a Session whose row lived in the moved
database, so `list()` found a record without a row and refused with
`SESSION_STORAGE_MISSING` on every later call, permanently: not even a Session
created after the recovery could be listed, and `listStoredHeaders()` failed
with it.

`setAside()` now moves each routing record to `<hash>.json.unreadable-<stamp>`
with the bytes it names, so every record stays readable and none of them counts
as lost state. `list()` reads the directory again after the scan, because the
scan is what triggers recovery; without that the first call would still fail.
The extraction report for a missing database now says the records are kept, so a
restored database reads through them, which is what the code does.

`test: moves the routing records with a damaged database, so listing Sessions
works after recovery` writes a Session, damages the database, and asserts that
`list()` resolves and no `.json` record remains. It fails with
`SESSION_STORAGE_MISSING` when the two source files are reverted.

Also from the same review:
- `standIn`'s comment states that `time` resets per Segment, so a damaged first
  frame reports the epoch.
- README documents `codec` 255 rows and the `session_segments` internal view.
- An unused `plan` helper is gone from the schema fixture.
2026-11-26 14:44:53 +08:00
..