Files
deepseek-harness/packages/session/session-persistence-sqlite/tests
07ad3a4dc5 perf(session): merge short SQLite frames inside the append transaction (#8674)
* perf(session): merge short SQLite frames inside the append transaction

Live writes store one to three events per frame, so compression barely
works. When the newest short frames of a Segment reach frameEvents events,
the append transaction re-encodes them as full frames. The frames_no_delete
trigger is dropped from the unreleased schema and from existing databases.

Co-authored-by: Magolor <25860372+Magolor@users.noreply.github.com>
Co-authored-by: Kexin Liu <69756503+liukx0205@users.noreply.github.com>

* perf(session): read SQLite frame payloads only for a merge

Scan only frame ranges to decide whether the trailing short frames merge,
then read their payloads. Append decoded lines one by one so a large
frame size cannot exceed the argument limit.

Co-authored-by: Magolor <25860372+Magolor@users.noreply.github.com>
Co-authored-by: Kexin Liu <69756503+liukx0205@users.noreply.github.com>

* perf(session): cap SQLite frame merges by decoded bytes

A merge skips a run of short frames whose stored or decoded text exceeds
4 MiB, bounding how long it holds the event loop and the write lock. Tests
cover merged compression, the live event path, a failure after the merge's
delete, and large events; a seeded synthetic diagnostic measures size and
append cost. Documentation drops the one-frame-per-write wording and lists
the write stop after short-frame corruption.

Co-authored-by: Magolor <25860372+Magolor@users.noreply.github.com>
Co-authored-by: Kexin Liu <69756503+liukx0205@users.noreply.github.com>

* perf(session): store short SQLite frames uncompressed until merged

A short frame below min(64 KiB, 2 MiB / frameEvents) of JSON text is stored
as text; the merge compresses it together with its neighbours. This skips a
compression on every live append that the merge would redo, and keeps any run
of such frames within the 4 MiB merge limit.

Co-authored-by: Magolor <25860372+Magolor@users.noreply.github.com>
Co-authored-by: Kexin Liu <69756503+liukx0205@users.noreply.github.com>

* perf(session): seal short SQLite frames when a writer closes

* test(session): assert the reported seal failure without an untyped matcher

---------

Co-authored-by: Turtle <turtle1999@deepseek.com>
Co-authored-by: Magolor <25860372+Magolor@users.noreply.github.com>
Co-authored-by: Kexin Liu <69756503+liukx0205@users.noreply.github.com>
Co-authored-by: Magolor <magolor@qq.com>
2026-11-23 18:09:42 +08:00
..