Extract reverse JSONL scanning from session indexing (#32246)

## What changed

- Add a generic `ReverseJsonlScanner` that reads seekable JSONL data from the
  end in bounded chunks, skips blank records, and reports malformed records
  without stopping the scan.
- Use the scanner for reverse session-index lookups while preserving the
  existing behavior of ignoring invalid entries.

## Testing

- Add coverage for unterminated final records, malformed JSON, blank lines,
  chunk boundaries, and records spanning multiple chunks.
- Verify session-index lookup can skip an invalid record and still find valid
  entries on either side of it.

GitOrigin-RevId: 66255f48492f74726d4ac4831cdc82f748de17d6
This commit is contained in:
Owen Lin authored and copyberry committed 2026-07-10 19:18:39 +00:00
1 parent 414217dc8a
commit a328f30172
5 files changed
+288 -57

No files matched your search

+1
View File
@@ -11,6 +11,7 @@ pub(crate) mod metadata;
mod persistence_metrics;
pub(crate) mod policy;
pub(crate) mod recorder;
mod reverse_jsonl_scanner;
pub(crate) mod search;
pub(crate) mod session_index;
mod sqlite_metrics;