Minimize Alloy features for sqlite-web consumers#247
Conversation
WalkthroughThe PR updates ChangesAlloy dependency feature changes
🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
93f5845 to
1586a59
Compare
|
@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment: S/M/L PR Classification Guidelines:This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed. Small (S)Characteristics:
Review Effort: Would have taken 5-10 minutes Examples:
Medium (M)Characteristics:
Review Effort: Would have taken 15-30 minutes Examples:
Large (L)Characteristics:
Review Effort: Would have taken 45+ minutes Examples:
Additional Factors to ConsiderWhen deciding between sizes, also consider:
Notes:
|
|
Tip For best results, initiate chat on the files or code changes. SIZE=S |
## Dependent PRs - Depends on rainlanguage/rain.math.float#247 at `1586a5973882b6acb72c2677c29ad23c4c6f85ef` for the submodule commit that narrows Alloy features so the latest float crate compiles with sqlite-web. ## Motivation Consumers that pass `SQLiteWasmDatabase.query.bind(localDb)` into SDK transaction batches currently express logical transactions as separate `query()` calls: `BEGIN TRANSACTION`, individual statements, then `COMMIT`. sqlite-web serializes individual worker messages, but it does not hold a transaction-level lock across multiple `query()` calls. With multiple handles/tabs sharing a database, those split transaction calls can interleave and SQLite can return `cannot start a transaction within a transaction`. ## Solution - Add public `SQLiteWasmDatabase.transaction(statements)` JS API that accepts `{ sql, params? }[]`. - Send the whole statement list as one worker job through the coordinator and DB worker queue. - Execute the batch inside a worker-owned SQLite transaction, returning the last statement result and rolling back on failure. - Reject user-supplied transaction-control statements (`BEGIN`, `COMMIT`, `END`, `ROLLBACK`, `SAVEPOINT`, `RELEASE`) so the worker owns transaction scope. - Add browser integration coverage that verifies successful transaction execution, rollback, and the old split-`BEGIN` interleaving failure. - Retry OPFS sahpool deletion after worker termination so `wipeAndRecreate` handles Chrome briefly retaining OPFS handles. - Update the rain.math.float submodule and dependency graph for the latest float crate. - Update Rainix so CI uses a Rust toolchain new enough for `revm 36`. - Install the float submodule Soldeer dependencies in `build-submodules` before running `forge build`. - Fix the local bundle script to rewrite the current wasm-bindgen export form for embedded classic workers. ## Checks By submitting this for review, I am confirming I have done the following: - [x] made this PR as small as possible - [x] unit-tested any new functionality - [x] linked any relevant issues or PRs - [ ] included screenshots (if this involves a front-end change) Validation run: - [x] `cargo fmt --all` - [x] `cargo check --tests -p sqlite-web-core` - [x] `cargo check --tests -p sqlite-web` - [x] `./scripts/local-bundle.sh` - [x] `bun run test` (`158 passed | 4 skipped`) - [x] `npm run lint-format-check` in `svelte-test` - [x] `nix develop -c rustc --version` (`rustc 1.94.0`) - [x] `nix develop -c build-submodules` - [x] `nix develop -c local-bundle` - [x] Manual `NO_HEADLESS` wasm browser test for `sqlite-web-core` (`98 passed; 0 failed`) - [x] Manual `NO_HEADLESS` wasm browser test for `sqlite-web` (`38 passed; 0 failed` before OPFS retry; CI rerun pending) - [x] `git diff --check` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added an exported `transaction(statements)` API to run multiple SQL statements atomically. * Introduced batched SQL execution support end-to-end, including optional parameters for each statement. * **Bug Fixes** * Improved batch execution robustness across leader/follower coordinator behavior, including safer initialization-pending handling. * More reliable OPFS database recreation by retrying directory deletion. * **Tests** * Added/extended wasm and integration tests for batch timeout scaling, batch validation, rollback-on-failure, and transaction interleaving across concurrent clients. * **Chores** * Improved worker wasm-bindgen initialization for local bundling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->

Summary
Test plan
cargo check -p rain-math-floatcargo fmt --all -- --checknix develop -c rainix-rs-staticrs-static / rs-static1586a5973882b6acb72c2677c29ad23c4c6f85ef):cargo check --tests -p sqlite-web-corecargo check --tests -p sqlite-webnix develop -c build-submodulesNotes
rainix-sol / test / testis still failing on production deployment assertions that are also failing on recentmainruns.