Skip to content

Minimize Alloy features for sqlite-web consumers#247

Merged
hardyjosh merged 1 commit into
mainfrom
sqlite-web-alloy-feature-minimal
Jun 29, 2026
Merged

Minimize Alloy features for sqlite-web consumers#247
hardyjosh merged 1 commit into
mainfrom
sqlite-web-alloy-feature-minimal

Conversation

@findolor

@findolor findolor commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Disable Alloy default features for the float crate and workspace dependency.
  • Keep only the ABI/sol-types JSON features needed by the Rust bindings.
  • Avoid pulling Alloy provider/RPC/consensus crates that conflict with the Revm 36 dependency graph used by sqlite-web.
  • Commit the resulting lockfile/static formatting updates required by CI.

Test plan

  • cargo check -p rain-math-float
  • cargo fmt --all -- --check
  • nix develop -c rainix-rs-static
  • GitHub rs-static / rs-static
  • Verified from sqlite-web against this submodule commit (1586a5973882b6acb72c2677c29ad23c4c6f85ef):
    • cargo check --tests -p sqlite-web-core
    • cargo check --tests -p sqlite-web
    • nix develop -c build-submodules
    • prior full sqlite-web transaction validation listed in sqlite-web#28

Notes

  • GitHub rainix-sol / test / test is still failing on production deployment assertions that are also failing on recent main runs.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The PR updates alloy feature flags in the workspace manifest and in crates/float for both normal and dev dependencies. It disables default features and replaces json-rpc with json and json-abi.

Changes

Alloy dependency feature changes

Layer / File(s) Summary
Manifest feature flags
Cargo.toml, crates/float/Cargo.toml
The alloy workspace dependency and the crates/float dependency entries switch to default-features = false and enable json and json-abi instead of json-rpc; the crate’s dev-dependency entry is updated the same way.

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: reducing Alloy features for sqlite-web consumers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sqlite-web-alloy-feature-minimal

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@findolor findolor self-assigned this Jun 26, 2026
@findolor findolor changed the title Minimize alloy features for sqlite-web consumers Minimize Alloy features for sqlite-web consumers Jun 26, 2026
@findolor findolor force-pushed the sqlite-web-alloy-feature-minimal branch from 93f5845 to 1586a59 Compare June 26, 2026 10:14
@findolor findolor requested review from 0xgleb and JuaniRios June 26, 2026 11:10
@hardyjosh hardyjosh merged commit 2753b34 into main Jun 29, 2026
9 of 10 checks passed
@github-actions

Copy link
Copy Markdown

@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:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

SIZE=S

findolor added a commit to rainlanguage/sqlite-web that referenced this pull request Jul 1, 2026
## 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 -->
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.

3 participants