Repository navigation
fix(browser): an unreadable dirty page is an error, not dropped from the IndexedDB flush - #470
Merged
Merged
Conversation
…the IndexedDB flush checkpoint(), importGraph() and every write collected dirty pages with read_page_raw(id).ok() in a filter_map, so a page that failed to read was silently left out of the flush to IndexedDB while the call reported success. A shared take_dirty_pages helper (the same one v3 has since #469) now returns the read error. No current path leaves a dirty id without a page (ids enter the dirty set only after the page is stored), so this is defensive rather than a fix for observed loss. The browser unit tests did not compile on wasm32 (a duplicate page_cache_capacity from #341/#342, and dir_sync tests using tempfile); both are fixed so the two new regression tests run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
adityamukho
added a commit
that referenced
this pull request
Oct 7, 2026
…-10-07 Merge main into v3 (#470 BrowserDb regression tests)
adityamukho
added a commit
that referenced
this pull request
Oct 8, 2026
Doc sync (CHANGELOG, CLAUDE.md, ROADMAP, README, TEST_COVERAGE) and version bump to 2.0.4. v2.x patch: BrowserDb IndexedDB flush returns an error for an unreadable dirty page (#470), plus the golden-file v7 corpus (#391) and SIGKILL committed-data crash test (#384). File format v7 unchanged; no API changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h
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.
v2.x counterpart of the
BrowserDbfix in #469 (v3).Problem
checkpoint(),importGraph()and every write inBrowserDbcollected the pages to flush to IndexedDB with:A dirty page that failed to read was silently left out of the flush, and the call still reported success.
Reachability
Not reachable today. An id enters the dirty set only inside
BrowserBufferBackend::write_page, right after the page is stored.load_pages_all_dirtymarks only pages it holds, and the flush reads under the same single-threaded borrow. So this is a defensive fix: a future bug that left a dirty id without a page would surface as an error instead of as silent data loss.Fix
A shared
take_dirty_pageshelper, the same as on v3 since #469, so the next main → v3 merge is trivial. It returns the read error, coded viaMinigrafError. This PR doesn't port v3's other browser hardening (unwraps, casts); those aren't data-integrity issues.Tests
take_dirty_pages_returns_written_pagesandunreadable_dirty_page_is_an_error_not_skipped(wasm-bindgen, headless Firefox): 11/11 browser tests pass.page_cache_capacityfrom perf: skip page cache allocation for in-memory databases #341/perf: skip redundant page cache allocation in BrowserDb #342, anddir_synctests that usedtempfileon wasm32. Same fixes as v3's feat: binding support — API-017/API-018 and BrowserDb cursor (#462, #465, #467) #468.mainhas no wasm job;wasm.ymlexists only on v3 (ci: test and lint the wasm32 targets again; fix browser panics and dropped pages #469).🤖 Generated with Claude Code
https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn