Repository navigation
Replies: 1 comment
|
The framing rule is documented, not just enforced.
So a log whose header line and events live in one frame is not a valid artifact with an undocumented constraint — it is a different physical layout. The check you found ( That said, two of your points survive the correction:
I could not verify your third point (the For recovery tooling in the meantime: repack with the header line in its own frame, then the event frames — that is the shape Read-only source inspection at master |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
3/3 - Zstd session log: undocumented "first frame must be exactly one header line" rule, misleading error text, and a
recoverableread mode that still throwsVersion: 0.2.1-rc.5 (Windows desktop)
Area:
@deepseek-ai/dsh-session-persistence-jsonl1. The frame rule is strict, undocumented, and silently enforced
assertZstdHeaderFrame(lib/index.js:2298):readFirstZstdLine(:3379) reads only the first frame and applies that assertion;listArtifacts(:3103) catches the resulting error and skips the artifact.Consequence: a session log whose header line and events are re-compressed into a single zstd frame is byte-for-byte correct as plaintext, passes
validateStoredEventson the full event list, and is still rejected - because the physical framing is wrong. Nothing in the documented format says a frame boundary is part of the contract.We hit exactly this while hand-repairing a corrupted log: the repaired file validated
PASS, events 711and then vanished from the list after restart.2. The error message points at the wrong thing
The message says "corrupt Zstandard session log" for a file whose zstd stream decodes perfectly. It should say what actually failed: the first frame contains more than the header line. As written it sends the reader hunting for a compression bug that does not exist.
3.
recoverablemode is not actually recoverablescanRowsacceptsrecovery === "recoverable", suggesting a degraded load is available, but it still throws when it encountersturn/end(and the other relationship checks). So there is no code path that loads a log with a single bad event - the only options are "loads fine" or "gone".Suggested fix
first frame must contain only the header line.recoverableactually degrade: skip/quarantine offending events and load the rest, reporting what was dropped.Repro
session.v4.jsonl.zstd,zstd -dit toh.jsonl(712 lines), recompress the whole file as one frame.validateStoredEvents(meta, events, loc)on the decoded events: PASS.first frame is not exactly one header linecorruption error.Appendix - the three physical variants of the same 712 lines
The middle row matters:
validateStoredEvents(meta, events, location)returnsPASS, events 711for it - every event is well-formed - and it is still rejected by the loader because of a frame boundary that no document mentions.Related: #12007 (how the log got bad) and #12008 (why the session then vanished).
The thing a reader needs to judge this report:
validateStoredEventsreturning PASS does not imply the artifact loads. We measured the 1-frame variant of a 712-line log:PASS, events 711, and the loader still rejected it withfirst frame is not exactly one header line.So there are two independent acceptance criteria - event-level validity and frame layout - and only the first one is discoverable from the public API. Anyone writing a repair tool (or any future code path that re-compresses a log) will hit the second one blind.
All reactions