Repository navigation
Description
Goal
Complete the v2.x triage left open in #894 with an actual browser/WASM reproduction. Keep #894 as the parent defect; this issue tracks the isolated experiment, release applicability and evidence, not a duplicate implementation.
Source evidence and limits
At main 82e1ea5e6aaf1c2760a4d59cf33db3410c49d4c3, these files have identical Git blob IDs to tag v2.0.11:
- src/browser/mod.rs:
3f9417874515cd76fe42d1ce368733c8b9035f8c. - src/browser/buffer.rs:
96dc9accab89dcd5ca6ab68588e81a24a1041aac. - src/browser/indexeddb.rs:
8ca8a0957a01d92956d76a6c752355c699adf5da. - src/storage/persistent_facts.rs:
9eac695d76bd42279b1d0efa709726b9e0be89e9.
BrowserDb saves into memory and drains dirty pages before awaiting IndexedDB. Failed writes do not restore them. PersistentFactStorage appends pending fact pages, publishes the new in-memory state and clears its dirty flag before the IDB flush. A later write can therefore omit predecessor pages; checkpoint alone appears able to report success without retrying them.
The transaction wrapper listens for complete/error, not abort. The put loop propagates a synchronous exception without explicitly aborting earlier queued requests. These are source findings, not end-to-end reproduction or proof of published-package impact.
An isolated Chromium diagnostic could not start because local socket creation failed with Operation not permitted; no test assertions executed. No compiled MiniGraf browser artifact or Rust/WASM toolchain was available. Main/v2 does not have v3's explicit BrowserWriteTransaction API or deletion list; do not transfer those findings unchanged.
Experimental protocol
Use disposable database names and isolated browser profiles, never user data. Record browser/OS, core and binding revisions, package version and integrity hash, WASM build flags, commands and exact fault-injection point.
- Baseline: build v2.0.11 and the pinned main revision separately. Verify ordinary writes, checkpoint and reopen preserve exact query results and stored pages. Separately resolve and test a published browser package, recording its actual embedded-core provenance rather than assuming its version matches the core tag.
- Recoverable failure then checkpoint: persist baseline facts, then inject a recoverable IDB transaction failure after a new write's pages have been captured. Record promise settlement and in-memory visibility. With failure injection disabled, call checkpoint, reopen through a fresh handle, and compare exact state and page integrity. A closed connection alone is insufficient because later writes must be able to succeed.
- Failure then successful write: repeat with a later independent write. Ensure the first operation creates fact pages the successor does not rewrite; retain captured dirty-page IDs and bytes. Verify the acknowledged successor and all state it depends on after reopen. Include repeated failures.
- Overlap: start a successor before the failing predecessor settles. Record when each delta is captured, IDB transaction creation/order, abort/error/complete events and promise settlement. Check whether a successful successor omits predecessor pages. Do not assume restoring dirty IDs after rejection fixes an already queued delta.
- Abort-only settlement: separately force an abort without a request error, capture the event sequence and check that the API rejects within a bounded timeout. Include a successful-commit control. Distinguish a pending promise from a rejected flush followed by stale state.
- Synchronous put failure: inject a failure after at least one put is queued; inspect whether any queued writes commit despite API failure. Identify the injection as synthetic unless a realistic production trigger is established.
- Import and v3 comparison: test failed import followed by checkpoint/write on v2 independently. Run v3's transaction, smaller-import deletion and page-ID-reuse cases only against a separately pinned v3 build under BrowserDb (IndexedDB): a failed flush can leave the store with a meta that references missing pages #894, recording branch-specific differences. Do not infer v2 deletion behavior from v3.
Acceptance criteria
- Reproducible scripts, raw event/page traces and a result matrix distinguish source builds from published packages and passed/failed/unrun cases.
- Exact reopened state and page consistency are checked, not just promise resolution.
- Sequential recovery, overlap, abort-only settlement and synchronous request exceptions have separate conclusions and controls.
- Report confirmed affected versions and any tested workaround back to BrowserDb (IndexedDB): a failed flush can leave the store with a meta that references missing pages #894. If released-package impact is confirmed, follow CONTRIBUTING.md's known-issues process (Known issues in the current release (v2.x) #421); do not close the parent defect merely because a fix merges.
- Any fix or backport recommendation follows the evidence; no native FinBench impact is assumed.
This is bounded browser reliability and error-path verification, consistent with PHILOSOPHY.md. No new runtime feature, dependency or file-format change is proposed.
Activity
adityamukho commentedon Nov 17, 2026
Result: reproduced on main, v2.0.11 and the published
@minigraf/browser@2.0.11Harness, raw traces and full matrix:
spikes/896-idb-flushon branchspike/896-idb-flush-repro(835ffb5). It is evidence only and not for merging. Reviewed by Codexgpt-6-astra(high) over three rounds; its findings were fixed and the last round found nothing.Provenance. Chromium 159.0.8154.6 headless shell (Playwright 1.65.1), Linux x86_64, rustc 1.94.0, wasm-pack 0.13.1.
main=19fd080a6andv2.0.11=709be06c3, each built withwasm-pack build --target web --features browser. The two.wasmfiles are byte-identical (sha256c4bffe16…2c76b).published=npm pack @minigraf/browser@2.0.11(integritysha512-ycTP4OYO…pWaA==), built by minigraf-wasm8b48111from crates.iominigraf =2.0.11.BrowserDb.open.All three builds gave the same result in all 14 cases.
checkpoint()checkpoint()resolves without opening an IDB transaction[INT-052] Page 6 not found: the database does not open, so no acknowledged write can be read through a fresh handleINT-052QuotaExceededError(real, CDP quota)INT-052importGraphMechanism. After a failed flush the dirty page ids are not restored, and
PersistentFactStoragehas already published the new state. The next save appends after the failed write's fact pages and rewrites the index pages and header, so the new header references fact pages IndexedDB never received. If those pages fall inside the old stored range, the slots hold stale index pages and the database opens degraded. If they reach past it, the slots don't exist and open fails withINT-052.Second defect.
transaction_to_promiseusesClosure::onceforonerror. Each pending request'sAbortErrorbubbles to the transaction, so every request-abort producesFnOnce called more than oncepage errors (4 per 1-page failure, 35 for the 400-fact one). The promise still rejects once.Mitigation, tested in two cases only. Await each write before starting the next, and bound each write with a timeout. After any rejection or timeout, stop using that handle and open a fresh one before writing again. It is not shown to help overlapping writes, non-atomic failures (sync-throw), or an origin that is still full. After
INT-052the original handle (before reload) could stillexportGraph(); re-import was not tested.Not run. v3 cases (they belong to #894 with a pinned v3 build), Firefox and WebKit, and recovery from a fresh page after
INT-052. No native or FinBench impact is assumed.Recommendation. Fix on v3 under #894, then backport to v2.x as a data-integrity patch. The fix should do three things: settle on
abort; keep failed pages dirty, or poison the handle after a failed flush, so later saves andcheckpoint()cannot build on unflushed pages; and abort explicitly when aputthrows. Released-package impact is confirmed, so #894 now carriesknown-issueand has an entry in #421.