fix(wa-sqlite): make direct and dedicated teardown terminal - #229
Merged
Conversation
marcus-pousette
force-pushed
the
fix/wa-sqlite-terminal-teardown
branch
from
July 24, 2026 11:02
bbf7da1 to
6afda30
Compare
marcus-pousette
force-pushed
the
fix/wa-sqlite-terminal-teardown
branch
from
July 24, 2026 13:22
078817d to
15cd2c5
Compare
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.
Summary
init,close, ordropRPC rejects.close()is best-effort,drop()reports the first teardown error, and repeated teardown does not retry the backend.Why
cybersemics/em#4325 uses persistent OPFS with
dedicated-worker, plusdirectfor unit tests and some Puppeteer profiles. Its integration currently falls back from a rejecteddrop()toclose()because wa-sqlite can leave the lower handle live after teardown fails.em also treats initialization as retryable. If a dedicated worker rejects its
initRPC,createTreecrdtClient()returns no client handle, so em cannot clean up the worker itself. Terminating that failed endpoint must therefore be guaranteed by wa-sqlite.This extracts only the relevant single-client lifecycle slice from #208. It intentionally does not include #209 SharedWorker peer invalidation, protocol/server changes, cross-tab behavior, OPFS memory fallback, or a generic lifecycle-hook abstraction.
With this behavior, em can discard the terminal client after
drop()settles, remove itsdrop()→close()fallback, and safely retry after a dedicated-worker initialization rejection. em still owns WebSocket shutdown, materialization unsubscribe, provider reset, and lifecycle serialization.Validation
git diff --check