Root cause, from the Tracy capture the CPU watcher took when the tray spun
(2026-11-15 08:15, 67% for 15 s): database.reload_read_only rebuilt the whole
evidence view from every segment — mean 1.4 s, max 1.7 s, 4x in 20 s — because
every 3 s poll that saw the daemon append evidence triggered a full reload.
- store::scan_store_read_only_from + ReadCursor (per segment: id, sealed,
bytes, records delivered). When the previously seen segments are an
unchanged prefix (same ids, sealed ones byte-identical), only records
appended since are delivered: the rest of the previously last segment
(skipping what was applied) and new segments. Any other change —
compaction, retention, reduction, a rewritten or shrunk segment — delivers
everything and the caller rebuilds.
- Database read-only refresh uses it; records apply in the same order a full
rebuild uses, so the view is identical. read_only_reload_counts() reports
full vs incremental refreshes.
Live, on the real evidence store: the change-driven reload went from ~1.4 s
to 2.8 ms; the tray did ~97 ms of work in a 60 s window.
Test (test_incremental_view, seeded property): a long-lived reader
refreshing across random appends, upserts, seals and a compaction always
equals a freshly opened reader; appends refresh incrementally (42-49 per run),
the compaction forces a rebuild, and no change reports no change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>