8000 fix(browser): fail the IndexedDB handle after a failed flush and settle every flush (#894) by adityamukho · Pull Request #904 · 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) - #904

Merged
adityamukho merged 1 commit into
mainfrom
fix/894-idb-flush-recovery-main
Nov 18, 2026
Merged

adityamukho merged 1 commit into
mainfrom
fix/894-idb-flush-recovery-main

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Summary

Backport of #903 (v3) to v2.x, format v7. 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 always settles: complete, error and abort each settle it once.
  • 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.
  • After a failed flush, later execute writes, checkpoint() and importGraph() reject with STG-046 and change nothing. Queries, rules and exportGraph() keep working; reopening shows the state before the failed write.
  • Flushes are ordered, and checkpoint() waits for earlier in-flight flushes.
  • Registers STG-046 and STG-048 with the v3 code, title and text. ERROR_REFERENCE describes only the IndexedDB browser path, since v2 native has no failed-handle rule.
  • Not backported: v3's open-time writeback, transactions, close(), or any other v3 code or API. No file-format, IndexedDB schema or public-method change.

Verification

  • Native cargo test: 1,326 passed, 9 ignored. cargo fmt --check clean.
  • Firefox wasm-bindgen: 26 browser tests pass; recovered exports open and query natively. The multi-page and abort-only regressions fail on unmodified main and pass here.
  • Native release size 1,152,872 -> 1,153,160 bytes (+288), under main's 1,228,800 limit.
  • Local clippy on the stable toolchain reports only pre-existing lints in files this PR doesn't touch; CI runs the gate.

Refs #894 (stays open until a release ships the fix).

🤖 Generated with Claude Code

…le every flush (#894)

Backport of the v3 fix to format v7. An IndexedDB flush lands whole or not at
all and always settles; after a failed flush the handle rejects further
writes, checkpoints and imports with STG-046 until reopened, and the failure
itself is STG-048. Registers STG-046 and STG-048 with their v3 meanings.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov
codecov Bot commented Nov 18, 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 cbdd0d0 into main Nov 18, 2026
17 checks passed
@adityamukho
adityamukho deleted the fix/894-idb-flush-recovery-main branch November 18, 2026 03:35
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