Repository navigation
fix(traces): slide the trace list and drop what storage evicted - #77
Merged
Merged
Conversation
The trace list only ever grew. Every batch merged in and nothing came out except a clear, so a long session re-sorted hundreds of thousands of rows per batch. Worse, eviction deleted rows from IndexedDB without removing them from the list. Measured on main with a limit of 8: after ten arrivals the header read "15 shown · 8 retained", and 7 rows on screen existed nowhere but the screen. - The list holds the newest `keep` rows: one page to start, plus a page for every "load older". New traffic pushes the oldest out of the bottom; they are still in storage, hasMore turns on, and loading older brings them back. A clear resets it to one page - pruneOldest now reports how far it reached (the last deleted row's epoch and key, in index order). Rows at or before that position are dropped from the list and from a search result, so the screen loses exactly what storage lost, including rows that share the boundary millisecond - Infinite scroll is unaffected while parked at the bottom: a batch leaves the row count and last index unchanged, so it does not re-fire - 5 new scenarios; against the old store, 4 fail (the fifth guards the end-of-storage case) - Not checked in a browser: it needs a platform past the retention limit, and the backend was not running - Gates: lint clean (same 7 warnings as main), 207 tests pass Tags: #traces #storage #honesty Co-Authored-By: htjulia <htjulia1@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The trace list only ever grew: every batch merged in and nothing came out except a clear. That causes two problems.
mainwith a retention limit of 8, after ten arrivals:At the real limit (50,000) this takes longer to reach, but the list grows without bound, so a long session ends up in the same state.
What
Sliding window. The list holds the newest
keeprows: one page to start, plus one page for every "load older". New traffic pushes the oldest rows out of the bottom. Those rows are still in storage, sohasMoreturns on and "load older" brings them back. A clear resets the window to one page.Eviction sync.
pruneOldestnow reports how far it reached: the last deleted row's(epochMillis, _key), in index order. Rows at or before that position are dropped from the list and from any search result. The screen therefore loses exactly what storage lost, including rows that share the boundary millisecond.Infinite scroll. Nothing changes while the user is parked at the bottom. A batch leaves the row count and last index the same, so the load does not fire again.
Verification
trace-window.test.ts: no ghost rows after eviction, ghost rows dropped from search results too, window slides, window grows only by explicit loads,hasMoreturns off when storage is exhausted. Against the old store, 4 fail. The fifth guards the end-of-storage case.npm run lint: 7 warnings, the same set asmainnpm test: 18 files, 207 tests pass