Repository navigation
perf(db): spool only changed usage facts - #2590
Conversation
Compare extracted facts with the expected cache installation before writing the temporary spool. Keep complete fact counts for tail removal and invalidate identities from the complete installed cache.
roborev: Combined Review (
|
roborev: Combined Review (
|
Usage-cache refills now compare complete extracted facts with the expected cache installation and spool only changed or new rows. Complete per-session counts remove obsolete tails, and identity invalidation uses the complete installed cache. Existing source snapshots and installation revision checks remain in place. Repeated full-size SQL batches reuse their prepared statement within the extraction transaction.
This reduces temporary database writes for active sessions whose history is mostly unchanged. In a synthetic 2,048-fact single-edit case, spooled rows fell from 2,048 to one and the temporary file shrank from 220 KiB to 12 KiB. The added comparisons have a cost: complete-fill medians were approximately 41 ms before and 46 ms after, with wide overlapping ranges. This change exposes that write-volume/runtime tradeoff for review.
Full source extraction still scales with session history, and appends can shift later activity or event indexes. No persistent schema or fact semantics change. Refs #2542; incremental source extraction remains open there.
Also includes the upload-artifact reference correction carried in #2589 so the CI workflow can start. The existing lockfile resolves the corrected reference to the same action commit.