Handle InvalidStateError when reading workspace layout from OPFS #159
Labels
No labels
abandoned
active
audit
blocked
data-safety
difficulty:easy
difficulty:hard
difficulty:high
difficulty:medium
docs
done
duplicate
notebook-v0
open
priority:high
ready
release-critical
safe-mode
spec
spec-backlog
subsystem:api
subsystem:backlog
subsystem:bases
subsystem:ci
subsystem:command
subsystem:configuration
subsystem:consolidate
subsystem:dependencies
subsystem:desktop-electron
subsystem:diffmerge
subsystem:docker
subsystem:docs
subsystem:fuzzy
subsystem:graph
subsystem:hotkeys
subsystem:lapis
subsystem:maint
subsystem:maintenance
subsystem:markdown
subsystem:markdown-lint
subsystem:md018
subsystem:notebook
subsystem:notifications
subsystem:opfs
subsystem:package
subsystem:plugin-markdown
subsystem:plugin-tasks
subsystem:plugins
subsystem:registry
subsystem:release
subsystem:renovate
subsystem:restore
subsystem:scripts
subsystem:search
subsystem:settings
subsystem:spec
subsystem:tasks
subsystem:testing
subsystem:ui
subsystem:web
subsystem:workspace
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lapis-notes/lapis#159
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Browser OPFS / File System Access vault reads can throw
InvalidStateErrorwiththe message "An operation that depends on state cached in an interface object was
made but the state had changed since it was read from disk." Startup fails at
Loading layout when reading
/.obsidian/workspace.json, and SQLite WASMapp-database startup can fail with the same stale OPFS handle error before
falling back to IndexedDB. The demo workspace seed path can hit the same stale-
handle behavior while writing fixture files.
Goal
Retry stale browser file-handle errors transparently, recover SQLite WASM OPFS
startup after stale handles, and keep demo workspace seeding progress visible
during fixture writes.
Scope
BrowserHandleVaultAdapterretry policy forInvalidStateErrorSqliteWasmAppDatabaseCoreretry/reset for stale OPFS SAH pool startupcurrent/totalNon-goals
Acceptance Criteria
Step N of Mpluscurrent path) whenever fixture seeding runs
InvalidStateErrorduring startupgetFile()retryImplementation Notes
InvalidStateErrorto recoverable handle errors and wrapsstat()getFile()in the retry loopdemo progress bar wired to seed counters,
setTimeout(0)yield between seedprogress updates, OPFS root handle refresh on stale errors, and
mkdirwrapped in the same retry path
Suggested Files or Specs To Inspect
packages/api/src/lib/storage/browser.tspackages/workspace/src/lib/feature/app/demo-vault.tspackages/workspace/src/lib/components/app/VaultBootstrap.sveltepackages/api/src/lib/workspace.svelte.ts(loadLayout)Validation Commands
Related Issues
Follow-up Tasks
Implementation Summary
Retry InvalidStateError/stale OPFS handles in vault adapter and SQLite WASM startup; pass vault profile on new-vault create; add opfs-vault-boot e2e (empty storage → OPFS vault, SQLite owner, re-clear). Validated with unit tests and Playwright opfs-vault-boot.spec.ts.