8000 fix(browser): fail the IndexedDB handle after a failed flush and settle every flush (#894) by adityamukho · Pull Request #903 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

fix(browser): fail the IndexedDB handle after a failed flush and settle every flush (#894) - #903

Merged
adityamukho merged 2 commits into
v3from
fix/894-idb-flush-recovery
Nov 18, 2026
Merged

adityamukho merged 2 commits into
v3from
fix/894-idb-flush-recovery

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Summary

An IndexedDB-backed BrowserDb no longer acknowledges a write over pages that never reached IndexedDB (#894).

  • Each flush is one IndexedDB transaction that lands whole or not at all: a queue-time throw aborts it, and abort, error and complete each settle it exactly once (an abort-only failure used to hang).
  • A flush failure rejects with STG-048 naming the IndexedDB write and the DOM exception (e.g. QuotaExceededError). A preparation failure keeps its own code (e.g. INT-052).
  • After a failed flush the handle follows the failed-handle rule already used by native and OPFS: later writes, commit(), checkpoint() and importGraph() reject with STG-046 and change nothing. Reads, cursors, prepared queries, rules, exportGraph() and close() keep working. Reopen shows the state before the failed write.
  • Flushes are ordered: a successor behind a failed flush sends nothing; checkpoint() waits for earlier in-flight flushes; close() discards unstarted flushes with API-018. A failed open() migration flush rejects STG-048.
  • No file-format, IndexedDB schema or public-method change.

Verification

  • Native: cargo test 2,149 passed; clippy (native and wasm32-unknown-unknown --features browser) and cargo fmt --check clean.
  • Firefox wasm-pack test --headless: main-thread and worker lanes pass. New flush_tests.rs cases fail on unmodified v3 (partial persistence, abort-only hang, queue-throw partial commit, successor submitted) and pass here.
  • Realistic Chromium QuotaExceededError case (CDP quota override) settles with STG-048 then STG-046; reopened stores pass the native integrity check.
  • Native binary size delta: +16 B (limit 1,280,000).
  • Chrome and Safari lanes run in CI.

Refs #894 (stays open until a release ships the fix; the v2.x backport follows as a separate PR).

🤖 Generated with Claude Code

adityamukho and others added 2 commits November 17, 2026 22:11
…le every flush (#894)

An IndexedDB flush now lands whole or not at all and always settles. After a
failed flush the handle rejects further writes, commits, checkpoints and
imports with STG-046 until reopened; the failure itself is STG-048.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov
codecov Bot commented Nov 17, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit d908ab6 into v3 Nov 18, 2026
35 of 37 checks passed
@adityamukho
adityamukho deleted the fix/894-idb-flush-recovery branch November 18, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0