Repository navigation
Fix npm release version selection - #36
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 17 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (4)
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 |
ueco-jb
approved these changes
Sep 30, 2026
4 tasks done
graphite-app Bot
pushed a commit
to rainlanguage/raindex
that referenced
this pull request
Oct 7, 2026
Browser bootstrap now imports SQL through the published sqlite-web bulk API and builds secondary indexes after the first fresh-database import. This completes the browser integration layer of [RAI-2651](https://linear.app/makeitrain/issue/RAI-2651/integrate-bulk-sql-bootstrap-and-deferred-indexes-in-raindex-browser), following merged #2887 and #2893 and [sqlite-web#35](rainlanguage/sqlite-web#35), published as `0.0.4` after [sqlite-web#36](rainlanguage/sqlite-web#36). **Live effect:** faster initial browser DB import · **Risk:** medium (stored data, browser bootstrap) · **Ships:** next raindex/webapp release ## Decisions - Import UTF-8-safe chunks of at most 256 KiB in one worker transaction, cancelling on failure or dropped Rust futures. Cleanup waits for the current SDK request before rollback and retains the executor lock until rollback settles. The browser avoids building an object for each SQL statement; native CLI and incremental writes retain their statement APIs. - Drop and restore explicit secondary indexes inside the first fresh-database import transaction. Primary/unique constraints remain enforced; later imports retain indexes when their preflight sees an existing watermark. Two tabs starting different networks simultaneously can both see an empty DB and cause an extra index rebuild; data remains correct. Attempt one final `ANALYZE` after initial target provisioning; log statistics failures without discarding already committed import reports. - Wait for cross-tab import contention every 250 ms for up to five minutes. Known-safe reads use an explicit `query_json_retryable` API; generic `query_json` and writes do not replay a timeout with an unknown commit result. The idempotent cache-size setter also opts into retries. Temporary worker errors from integrity checks never reset the database. Cap failed dump imports at three attempts per target, then fall back to RPC sync. - Switch the webapp Vercel runtime to supported Node 22 and update its architecture note, as approved to unblock preview testing. - Pin the released `@rainlanguage/sqlite-web` to exactly `0.0.4`. Align the Wasm test lockfile with the existing `wasm-bindgen 0.2.122` runner so tests execute rather than silently reporting zero tests; update the affected mocks and stale test fixtures. ## Risks - Existing stale-target refresh still clears that target before opening the atomic import; an interrupted refresh can require RPC replay from its deployment block. Atomic stale-target replacement is a separate recovery follow-up. - Incremental applies retain their existing ANALYZE frequency. This PR’s final best-effort analysis covers provisioning, including imports with no catch-up window; it does not claim a steady-state analysis-cost reduction. - Persistent SDK initialization failure still follows the existing cache reset policy; distinguishing worker failure from corruption is a separate recovery follow-up documented in RAI-2651. - Compressed/decompressed SQL is still held in memory. This change bounds the import messages, not the full download or decoded dump allocation. - Worker loss during commit can leave the commit result unknown. Retries inspect persisted target watermarks; an import failure remains eligible for at most three provisioning attempts per target in the current runner session. Readiness follows committed index reconstruction. Planner analysis is best effort; its failure does not hide successful provisioning. A permanently pending SDK request can also keep cancellation cleanup pending. ## Proof - Real browser import from an empty OPFS DB using the frozen filtered SQL: all table counts matched the reference, with matching result hashes for 2,160 orders (547 active, 1,613 inactive) and 1,714 vaults. All 41 explicit indexes and planner statistics were present. Orders/Vaults lists and details rendered; warm reload reused the DB without downloading the dump again. The fixture held the chain head fixed and rejected live indexing/quotes. - Fresh final Nix checks on submitted `8b4438e35`: 1,925 native workspace tests (599 local DB tests), 140 Node/Wasm tests, 130 actual browser/Wasm tests, and 1,168 JavaScript tests passed. Workspace formatting and Clippy with all targets/features, SDK/components/webapp builds, and UI lint/type/style checks passed. Two fresh staged Codex reviewers and three simplification passes were clean; no OpenCode reviewers were used. - CodeRabbit cancellation/ANALYZE findings and Marvin cross-tab no-wipe/bounded-import-retry findings are fixed. The follow-up covers dump preflight SELECT timeout retries and uses an idempotent cache-size script with an empty SELECT for the SDK’s JSON response path. Real published sqlite-web 0.0.4 browser verification returned `[]`, confirmed cache size `-25000`, and completed a subsequent atomic import/query successfully. - Marvin formally APPROVED submitted `8b4438e35` with no blockers. Its two non-blocking notes on preexisting stale refresh and incremental ANALYZE frequency are documented below. CodeRabbit subsequently found that generic JSON timeout retries could replay a committed write; this follow-up makes retries explicit and tests that plain, CTE, and multi-statement `INSERT ... RETURNING` are invoked once after a timeout. CodeRabbit’s fresh review of `8b4438e35` completed with no actionable comments; its review gate is green. All nine review threads are resolved. - Live Node 22 preview deployed successfully. From a fresh preview origin, Base and Robinhood dumps downloaded and both networks reached ACTIVE/healthy readiness; 3,838 order events, 934 running vault balances, all 41 explicit indexes, and 55 planner-statistics rows were present. Warm reload reused the DB without another SQL dump download. Orders and Vaults lists rendered with those two networks selected (576 active orders); an order detail showed its input/output vaults and a live quote, and the related vault detail showed its balance, order relationship, and deposit history. A Robinhood USDG vault detail also rendered its related orders and recent take-order balance changes while live sync remained ACTIVE. Preview: https://rain-orderbook-v6-k10byupab-rain-x-h20.vercel.app/orders - Preview limitation: default “All items” also selects Ethereum, while the remote registry has no Ethereum raindex. The UI receives `raindex with network key: ethereum not found` and displays an empty list. Deselecting Ethereum in Networks renders the local DB lists. Network enumeration/query routing and the registry URL are unchanged by this PR; this is documented for separate registry/UI follow-up. - **Not verified:** a new production-scale bootstrap latency/memory benchmark. The earlier local fixture held the chain head fixed; the deployed preview used live RPC sync. ## Rollout 1. Release raindex and deploy the webapp with the exact SDK pin; verify fresh bootstrap reaches ACTIVE and lists/details load. Existing SQL dumps and manifest format remain supported. 2. The producer update is already deployed: filtered, grouped dumps and their manifest were verified under RAI-2652. No additional producer change is required for this integration. 3. Roll back to the previous raindex/webapp release if bootstrap regresses; the database schema is unchanged. ## Checks - [x] Kept to the browser import integration and its verification fixtures, plus the approved Node 22 preview runtime fix. - [x] The app build emits `nodejs22.x`; deployed preview and configured-network lists/details were verified. CodeRabbit is clean, Marvin formally approved, and code/build/preview CI passes on `8b4438e35`. Existing Sol static warnings remain the previously accepted failure; the human review gate is pending. See the default-network registry limitation above. - [x] Tested the new import, failure/retry, index and analysis behavior. - [x] Linked the tracking issue and upstream/predecessor PRs. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * WebAssembly local databases can import SQL dumps in chunks, with rollback and retry support if an import fails. * Database analysis is deferred during dump imports and runs once afterward; analysis failures don’t fail the sync. * **Bug Fixes** * Failed dump imports can be retried during provisioning, with RPC synchronization continuing if retries are exhausted. * SQL dump import failures now provide a clear error message. * Temporary database worker unavailability no longer triggers an unnecessary database reset. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

The next changed SQLite Web package can publish even when npm is ahead of the repository. This restores the release blocked after #35 and completes the publication work in RAI-2650.
Live effect: next changed SDK package publishes to npm · Risk: medium (automated package publication) · Ships: on merge
Decisions
Proof
Rollout
Merge, then verify the release publishes the selected version and pushes aligned npm/Cargo manifests and the release tag. Use the published SDK for RAI-2651. If a published artifact needs correction, publish a subsequent patch; an existing npm version cannot be overwritten.