Skip to content

Fix npm release version selection - #36

Merged
findolor merged 1 commit into
mainfrom
arda/fix-npm-release-version
Sep 30, 2026
Merged

findolor merged 1 commit into
mainfrom
arda/fix-npm-release-version

Conversation

@findolor

@findolor findolor commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • Keep the existing package-hash change check. Select the next stable patch above both the repository version and all published stable versions, including versions outside the latest dist-tag.
  • Serialize release jobs so two runs cannot select and publish the same version concurrently. npm and Cargo version updates still get committed after a successful publish.

Proof

  • The July release published 0.0.3 but failed its version commit; the current release then tried to reuse 0.0.3.
  • Eight regression tests passed under Nix; the selector against live npm metadata returns 0.0.4. Two local Codex reviews found no actionable issues. Release workflow actionlint passed; the existing Wasm workflow checkout@v2 deprecation was excluded from its lint check.
  • Not verified: live npm publication before merge.

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.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: a4992018-6bca-4e15-9f14-3468ff172122

📥 Commits

Reviewing files that changed from the base of the PR and between 2f182dd and 2dad8bb.

📒 Files selected for processing (4)
  • .github/workflows/npm-release.yaml
  • .github/workflows/test-wasm.yaml
  • scripts/next-release-version.mjs
  • scripts/next-release-version.test.mjs

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
Collaborator Author

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

@findolor findolor self-assigned this Sep 30, 2026
@findolor
findolor requested a review from ueco-jb September 30, 2026 13:15
@findolor
findolor merged commit 82ff799 into main Sep 30, 2026
4 checks passed
@linear

linear Bot commented Sep 30, 2026

Copy link
Copy Markdown

RAI-2777

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 -->
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.

2 participants