Repository navigation
[PR] fix: preserve null historical rows in full JSONL exports - #6725
Conversation
(ai: vllm-qwen/qwen3.8-27b) Duplicate screening: Not a duplicate. #6725 is the only open PR fixing #6724's symptom (a JSON-null historical row degrading the full JSONL export to the legacy-tail fallback). Same-author #6727 ("export CCR originals instead of reference metadata") is a different mechanism — it changes what a CCR placeholder resolves to, not how a non-object row is handled. No other open issue/PR targets this access. Direction (①): Correct, and it fixes the root cause at the decision point. The producer of the offending access is Regression (②): I inventoried every existing behavior of the touched path. Only one changes, and it is the intended fix:
Code (③): The type change Tests (④): 11 real-SQLite tests (no mocks). I verified teeth both ways: on the base Diff (⑤/⑤b): 2 files, +140/−3, every line on-purpose; no unrelated changes, whitespace churn, or lock-file churn. External-submission strict standard passes: honest naming, no dead code, no duplication, error handling preserved, no magic numbers, style matches the file, no new dependencies, single-responsibility, clean tests. CI: Green on the pushed head 结构化八问
判定:可合并。这是一处根因定位准确、范围恰当、测试有牙(双向)、CI 全绿、diff 干净的高质量外部贡献,无阻塞项。 |
Closes #6724
Problem
A stored historical message can contain valid JSON
null. The identity/migration path deliberately preserves such raw content, and a plain JSONL export already retains it. With--full, the table renderer assumes every parsed value is an object and readsmessage.text.That throws on a null row. The public export path catches the exception as an unreadable unified index and emits the shorter
legacy-tailfallback. A readable SQLite index therefore loses its historical rows from the generated export, including retired rows that the historian export is meant to retain.Change
Keep parsed content typed as
unknownand inspect its text only when it is a non-null object. Nulls, scalars, arrays, and the existing invalid-JSON{raw: ...}representation remain in their original output records. Actual object placeholders keep their existing CCR dereferencing behavior. The database and stored content are unchanged.Verification
Eleven new tests use the real SQLite store. The public-path case persists a live session, retains an older null row in the historian, then calls
exportSession()with JSONL/full/output-file options. It verifies the unified source, both historical/current rows, exactretiredAt, the written output, and unchanged database rows.Other cases cover padded null, booleans, numbers, strings, arrays, objects without string text, malformed JSON, the non-full control, and a subsequent valid CCR placeholder.
sourcetolegacy-tail; the renderer failures areCannot read properties of null (reading 'text').npm run typecheck,npm run build, andgit diff --checkpassed.Tests ran with
TZ=UTCand an isolated writable temporary directory on Node 24.22.1. No live MySQL server was used; the production change stays inside the shared backend-neutral renderer.History check
Checked Afloat16's 127-issue index and actual 111-PR patch index plus current submissions. #6230 concerns scanning archive files during restore, and #6209 only makes JSONL honor output paths. Actual upstream #2768 handles an unreadable index, #3432 introduces the backend seam, #4670 includes retired rows, and #5076/#5084 optimize session selection. None guards this full-export content access. Focused all-state searches found no prior report or patch for this failure.
Base: current master
3858b6956abab52da781c2436c0245586ce18358, bili 0.1.214. Full-suite results remain the hosted CI on the exact pushed head.