fix(trace): repair runs interrupted by service-worker eviction - #2889
Conversation
|
@alectimison-maker is attempting to deploy a commit to the esokullu's projects Team on Vercel. A member of the Team first needs to authorize it. |
- Candidate scan walks only the startedAt slice that can be stale instead of every run on record at each wake or Traces load. - The startup scan is deferred so a run resuming right after eviction registers its in-memory state first, and the repair transaction re-checks liveness immediately before writing. - The Traces page asks the background to own the scan via WB_TRACE_REPAIR_STALE_RUNS and repairs locally only when the background cannot be reached, so a live-but-silent run is never misread as abandoned from another page.
|
I reviewed the branch and pushed 5480bba with fixes for three issues found during review. Full suite passes (1987 tests). Unbounded scan on every wake (perf). Startup race against resuming runs. The scan fired at module top-level, so when the worker woke specifically to resume an interrupted run, repair could race its first event write and mark it abandoned mid-flight. Two mitigations: the background defers its startup scan by 15s, and Traces page could close out live-but-silent runs. The page's recorder instance has an empty Test assertions were extended to pin the bounded candidate scan, the deferred startup call, the message route, and the local fallback. |
Summary
runningafter a service-worker eviction.Motivation
The recorder can persist a running run before the service worker is evicted, while the in-memory
endRun()call is lost. The run then remains permanentlyrunning, even though its event sequence can still be recovered.Closes #2888
Design
runs+eventsIndexedDB transaction.step_end/error/turn_endevidence as applicable, and mark the run withrepairedByandrepairReason.SERVICE_WORKER_EVICTEDerror code. No new event kind or trace schema migration is introduced.Testing
node test/run.js— 1987 passed, 0 failednpm run test:toolbar-guard— 33 passednpm run test:security— 60/60 passednode scripts/benchmark-offline-relevance.mjs— completed successfullyCompatibility and risks