Skip to content

Fix orderbook package bug for unused wasm import - #2305

Merged
hardyjosh merged 2 commits into
mainfrom
2025-11-07-fix-wasm-url-import-bug
Nov 7, 2025
Merged

Fix orderbook package bug for unused wasm import#2305
hardyjosh merged 2 commits into
mainfrom
2025-11-07-fix-wasm-url-import-bug

Conversation

@rouzwelt

@rouzwelt rouzwelt commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Motivation

Warning

Reported bug:

Screenshot 2025-11-07 at 2 02 16 AM

Reproduction steps:

# 1. Create Next.js app
npx create-next-app@latest my-test-app --typescript --app --no-tailwind

# 2. Install your SDK
cd my-test-app 
npm install @rainlanguage/orderbook@0.0.1-alpha.188

# 3. Create a simple component
cat > src/app/test/page.tsx << 'EOF''use client'import { useEffect } from 'react'export default function TestPage() {  useEffect(() => {    async function init() {      const { RaindexClient } = await import('@rainlanguage/orderbook')      console.log(RaindexClient)    }    init()  }, [])    return <div>Testing Raindex SDK</div>}EOF

# 4. Run dev server
npm run dev

# 5. Visit http://localhost:3000/test
Error appears immediately during compilation, before the page even loads.

Solution

This is caused by an unused wasm URL import which some bundlers like webpack resolve it internally causing the error to appear, so we need to remove that as its totally unused as we import the wasm through json import.

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Summary by CodeRabbit

  • Chores
    • Updated ESM build so WebAssembly modules are embedded in the bundle rather than loaded via a dynamic external URL—resulting in more reliable module initialization, fewer runtime fetches, and improved consistency across environments.

@rouzwelt rouzwelt self-assigned this Nov 7, 2025
@coderabbitai

coderabbitai Bot commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Replaces the dynamic module_or_path WASM URL assignment in the ESM build wrapper with an inlined base64/JSON blob approach and updates the subsequent import/initialization logic to use embedded WASM data instead of a runtime URL.

Changes

Cohort / File(s) Summary
WASM initialization in ESM bundle
packages/orderbook/scripts/buildPackage.js
Removed assignment of module_or_path to a runtime WASM URL and updated ESM wrapper logic to load/initialize WASM from an inlined/base64 JSON blob instead of a dynamic URL.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant ESM as ESM wrapper
    participant WasmBlob as Embedded WASM blob (base64 JSON)
    participant WASM as WebAssembly module

    rect rgb(230, 247, 255)
    ESM->>WasmBlob: read inlined base64 data
    Note right of WasmBlob: New path — no runtime URL fetch
    WasmBlob-->>ESM: provide binary bytes
    ESM->>WASM: initialize with bytes (WebAssembly.instantiate)
    WASM-->>ESM: exports ready
    end
Loading

(Comparison: previous flow used ESM -> fetch WASM URL -> instantiate WASM.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas needing attention:
    • Correctness of base64 decoding and binary conversion before WebAssembly.instantiate.
    • Any edge cases where "" (removed URL) could be falsy/affect other branches.
    • Ensure source map, packaging, and consumers expecting a runtime URL still work.

Possibly related PRs

Suggested reviewers

  • hardyjosh

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: removing an unused wasm import that caused a compilation bug in the orderbook package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2025-11-07-fix-wasm-url-import-bug

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

@rouzwelt rouzwelt added bug Something isn't working js/wasm Update wasm/js labels Nov 7, 2025
@rouzwelt rouzwelt changed the title Fix orderbook package bug Fix orderbook package bug for unused wasm import Nov 7, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2b186f9 and 9e945d3.

📒 Files selected for processing (1)
  • packages/orderbook/scripts/buildPackage.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
packages/**

📄 CodeRabbit inference engine (AGENTS.md)

JavaScript/Svelte projects live under packages/* (webapp, ui-components, orderbook)

Files:

  • packages/orderbook/scripts/buildPackage.js
🧠 Learnings (5)
📓 Common learnings
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1913
File: Cargo.toml:55-55
Timestamp: 2025-06-06T16:38:04.182Z
Learning: In rain.orderbook repository, during PR chains involving dependency updates, wasm-bindgen-utils may temporarily point to git commits that don't contain the full required functionality, with the understanding that subsequent PRs in the chain will update it to the correct commit.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 2246
File: packages/webapp/src/hooks.client.ts:2-2
Timestamp: 2025-10-19T20:24:08.629Z
Learning: In the rain.orderbook repository, the import `rainlanguage/orderbook/esm` in packages/webapp/src/hooks.client.ts is intentional and should not be changed to the root package path, as it's specific to the webapp build configuration.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 2246
File: packages/orderbook/scripts/buildEsm.js:38-53
Timestamp: 2025-10-25T21:07:19.704Z
Learning: In the rain.orderbook repository, the deduplication logic in buildEsm.js (and similar build scripts) intentionally lacks defensive checks for indexOf returning -1. If duplicates are not found, the script should throw to surface breaking changes in wasm-bindgen output that require attention.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1744
File: crates/subgraph/src/orderbook_client.rs:44-46
Timestamp: 2025-05-14T05:13:59.713Z
Learning: In the rain.orderbook project, WASM dependencies are intentionally made available in non-WASM targets to facilitate testing of WASM-related functionality, so conditional compilation guards like `#[cfg(target_family = "wasm")]` should not be added to imports or implementations that may be needed for tests.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1710
File: crates/quote/Cargo.toml:30-30
Timestamp: 2025-05-14T04:49:14.621Z
Learning: In the rain.orderbook repository, wasm-bindgen-utils is intentionally used as an unconditional dependency because non-wasm targets (like tests) sometimes need to use it.
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2044
File: crates/common/src/raindex_client/vaults_list.rs:363-423
Timestamp: 2025-07-31T19:34:11.716Z
Learning: In the rainlanguage/rain.orderbook project, for WASM-exposed functionality like VaultsList, the team prefers to keep comprehensive tests in the non-WASM environment due to the complexity of recreating objects like RaindexVaults in WASM. WASM tests focus on basic functionality and error cases since the WASM code reuses the already-tested non-WASM implementation.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1715
File: crates/js_api/src/common/mod.rs:55-59
Timestamp: 2025-05-14T05:51:50.277Z
Learning: In the Rain Orderbook project, the error handling for WASM exported functions uses WasmEncodedError which includes both the original error message and a human-readable version, making direct modification of the JsValue conversion unnecessary.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1938
File: crates/js_api/src/raindex/orders.rs:1-11
Timestamp: 2025-06-18T12:54:47.807Z
Learning: In the rain.orderbook repository, findolor prefers to keep unused imports in place when they will be used in upcoming follow-up PRs, rather than removing and re-adding them during incremental development.
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2036
File: crates/js_api/src/filters/raindex_filter_store.rs:446-533
Timestamp: 2025-08-02T02:34:32.237Z
Learning: In the rainlanguage/rain.orderbook project's RaindexFilterStore WASM tests (crates/js_api/src/filters/raindex_filter_store.rs), brusherru decided to focus on testing only methods without side effects (that don't use web_sys) due to difficulties with mocking localStorage and window APIs in the WASM test environment. This pragmatic approach tests pure logic separately from browser integration.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:26:31.566Z
Learning: For PR #1884 and future PRs in rainlanguage/rain.orderbook repository, provide PR size reports in a separate comment with ONLY the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number", without any additional text or explanation. Reports should exclude irrelevant files such as lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock).
Learnt from: CR
Repo: rainlanguage/rain.orderbook PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-06T08:05:50.452Z
Learning: WASM bundle via nix develop -c rainix-wasm-artifacts
📚 Learning: 2025-10-25T21:07:19.704Z
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 2246
File: packages/orderbook/scripts/buildEsm.js:38-53
Timestamp: 2025-10-25T21:07:19.704Z
Learning: In the rain.orderbook repository, the deduplication logic in buildEsm.js (and similar build scripts) intentionally lacks defensive checks for indexOf returning -1. If duplicates are not found, the script should throw to surface breaking changes in wasm-bindgen output that require attention.

Applied to files:

  • packages/orderbook/scripts/buildPackage.js
📚 Learning: 2025-10-19T20:24:08.629Z
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 2246
File: packages/webapp/src/hooks.client.ts:2-2
Timestamp: 2025-10-19T20:24:08.629Z
Learning: In the rain.orderbook repository, the import `rainlanguage/orderbook/esm` in packages/webapp/src/hooks.client.ts is intentional and should not be changed to the root package path, as it's specific to the webapp build configuration.

Applied to files:

  • packages/orderbook/scripts/buildPackage.js
📚 Learning: 2025-10-25T21:06:38.487Z
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 2246
File: packages/orderbook/scripts/buildCjs.js:38-53
Timestamp: 2025-10-25T21:06:38.487Z
Learning: In the rain.orderbook repository, build scripts in packages/orderbook/scripts/ (such as buildCjs.js and buildEsm.js) should keep duplicated logic separate rather than extracting to shared utilities, even when identical, to allow future divergence and to surface breaking changes as early failures.

Applied to files:

  • packages/orderbook/scripts/buildPackage.js
📚 Learning: 2025-10-06T08:05:50.452Z
Learnt from: CR
Repo: rainlanguage/rain.orderbook PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-06T08:05:50.452Z
Learning: WASM bundle via nix develop -c rainix-wasm-artifacts

Applied to files:

  • packages/orderbook/scripts/buildPackage.js

Comment on lines +117 to +120

// remove unused wasm import as we import the wasm through json
esm = esm.replaceAll(`module_or_path = new URL('${pkg}_bg.wasm', import.meta.url);`, "");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Fix correctly removes unused wasm URL import.

The change properly addresses the compilation error by removing the unused URL-based wasm import, since the wasm is already loaded via the JSON base64 approach (lines 82-90, 123-126).

However, consider adding a defensive check to ensure the replacement actually occurred, consistent with the team's preference for explicit failures when wasm-bindgen output changes unexpectedly:

 
 // remove unused wasm import as we import the wasm through json
-esm = esm.replaceAll(`module_or_path = new URL('${pkg}_bg.wasm', import.meta.url);`, "");
+const beforeLength = esm.length;
+esm = esm.replaceAll(`module_or_path = new URL('${pkg}_bg.wasm', import.meta.url);`, "");
+if (esm.length === beforeLength) {
+    throw new Error(`Expected to find and remove wasm URL import pattern for ${pkg}, but pattern was not found. wasm-bindgen output may have changed.`);
+}

This ensures the script fails loudly if wasm-bindgen changes its output format, rather than silently leaving the problematic import in place.

Verify that the pattern matches the current wasm-bindgen output:


🏁 Script executed:

#!/bin/bash
# Description: Verify the wasm URL import pattern exists in wasm-bindgen generated output

# First, check if there are any existing generated files in temp/web/
if [ -d "./packages/orderbook/temp/web" ]; then
    echo "Checking existing generated files..."
    fd -e js -x grep -l "module_or_path = new URL" {} \; ./packages/orderbook/temp/web/
    echo "---"
    fd -e js -x grep "module_or_path = new URL" {} \; ./packages/orderbook/temp/web/
fi

# Check the buildPackage.js to see what the exact pattern is
echo "Pattern in buildPackage.js:"
rg -A 2 "remove unused wasm import" ./packages/orderbook/scripts/buildPackage.js

Length of output: 190


🏁 Script executed:

#!/bin/bash
# Check if there are similar URL import patterns that need removal
echo "=== Searching for other URL import patterns in buildPackage.js ==="
rg -n "new URL" ./packages/orderbook/scripts/buildPackage.js

echo ""
echo "=== Checking for test files related to buildPackage ==="
fd -e test.js -e test.ts -e spec.js "buildPackage" ./packages/orderbook/

echo ""
echo "=== Looking for generated wasm output validation or tests ==="
rg -n "module_or_path\|bg\.wasm\|wasm-bindgen" ./packages/orderbook/test/ -C 2

echo ""
echo "=== Comparing with buildEsm.js defensive checks ==="
rg -n "indexOf" ./packages/orderbook/scripts/buildEsm.js -B 2 -A 2

Length of output: 581


🏁 Script executed:

#!/bin/bash
# Search for URL import patterns and defensive checks in build scripts

echo "=== Searching for URL import patterns in buildPackage.js ==="
rg -n "new URL" packages/orderbook/scripts/buildPackage.js

echo ""
echo "=== Searching for the wasm pattern in buildPackage.js ==="
rg -n "module_or_path.*new URL" packages/orderbook/scripts/buildPackage.js -C 3

echo ""
echo "=== Comparing defensive checks in buildEsm.js ==="
rg -n "indexOf.*-1\|throw.*Error" packages/orderbook/scripts/buildEsm.js -B 2 -A 1

echo ""
echo "=== Check for tests that validate wasm output ==="
fd . packages/orderbook/test/ -name "*.test.js" -o -name "*.test.ts" -o -name "*.spec.js" | head -5

echo ""
echo "=== Look for replaceAll usage patterns in build scripts ==="
rg -n "replaceAll" packages/orderbook/scripts/ -B 1 -A 1

Length of output: 1834


🏁 Script executed:

#!/bin/bash
# Find buildEsm.js and check its structure
echo "=== Locating buildEsm.js ==="
find packages -name "buildEsm.js" -o -name "*buildEsm*" 2>/dev/null

echo ""
echo "=== Show full context of deduplication with defensive checks ==="
rg -n "if.*indexOf.*-1" packages/orderbook/scripts/buildPackage.js -B 3 -A 2

echo ""
echo "=== Check if wasm pattern has any condition/check around it ==="
rg -n "module_or_path.*new URL\|replaceAll.*wasm" packages/orderbook/scripts/buildPackage.js -B 5 -A 2

Length of output: 159


🏁 Script executed:

#!/bin/bash
# Simpler approach - just look at the full buildPackage.js around the relevant lines
echo "=== View lines 40-60 (first deduplication block) ==="
sed -n '40,60p' packages/orderbook/scripts/buildPackage.js

echo ""
echo "=== View lines 100-120 (wasm removal) ==="
sed -n '100,120p' packages/orderbook/scripts/buildPackage.js

echo ""
echo "=== Count replaceAll usage without defensive checks ==="
rg "replaceAll" packages/orderbook/scripts/buildPackage.js -n

Length of output: 1755


Add defensive check to ensure wasm URL pattern replacement succeeds.

The fix correctly removes the unused wasm URL import (line 119), but lacks a defensive check present in other similar operations within the same file. Lines 49 and 106 both use conditional checks before replaceAll, whereas the wasm pattern removal operates without verification.

Since the wasm URL import should always be present in wasm-bindgen output, a missing pattern indicates a breaking change that requires explicit attention:

 // remove unused wasm import as we import the wasm through json
-esm = esm.replaceAll(`module_or_path = new URL('${pkg}_bg.wasm', import.meta.url);`, "");
+const beforeLength = esm.length;
+esm = esm.replaceAll(`module_or_path = new URL('${pkg}_bg.wasm', import.meta.url);`, "");
+if (esm.length === beforeLength) {
+    throw new Error(`Expected wasm URL import pattern for ${pkg} not found. wasm-bindgen output may have changed.`);
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// remove unused wasm import as we import the wasm through json
esm = esm.replaceAll(`module_or_path = new URL('${pkg}_bg.wasm', import.meta.url);`, "");
// remove unused wasm import as we import the wasm through json
const beforeLength = esm.length;
esm = esm.replaceAll(`module_or_path = new URL('${pkg}_bg.wasm', import.meta.url);`, "");
if (esm.length === beforeLength) {
throw new Error(`Expected wasm URL import pattern for ${pkg} not found. wasm-bindgen output may have changed.`);
}
🤖 Prompt for AI Agents
In packages/orderbook/scripts/buildPackage.js around lines 117 to 120, the
unconditional call to replaceAll removing the wasm URL import should be guarded
like the other replacements; first check that the target string or pattern (the
module_or_path = new URL('${pkg}_bg.wasm', import.meta.url); fragment) is
present (or test with a regex) and only then call replaceAll, and if it is
missing, log or throw a clear error so missing wasm-bindgen output is detected
instead of silently proceeding.

@hardyjosh
hardyjosh enabled auto-merge November 7, 2025 06:11
@hardyjosh
hardyjosh disabled auto-merge November 7, 2025 09:43
@hardyjosh
hardyjosh merged commit eda479e into main Nov 7, 2025
36 of 39 checks passed
@github-actions

github-actions Bot commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

@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 Nov 7, 2025

Copy link
Copy Markdown
Contributor

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get PR diff statistics and changed files
gh pr view 2305 --json files,additions,deletions,changedFiles --jq '.files[] | "\(.path): +\(.additions) -\(.deletions)"'
echo "---"
gh pr view 2305 --json additions,deletions,changedFiles --jq '"Total: +\(.additions) -\(.deletions), Files: \(.changedFiles)"'

Length of output: 76


🏁 Script executed:

#!/bin/bash
# Get the actual diff to see the changes
gh pr diff 2305

Length of output: 684


SIZE=S


🧠 Learnings used
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:42.275Z
Learning: For PR #1884, after each commit review, I should provide a new comment with a PR size report in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding irrelevant files such as lock files (package-lock.json, cargo.lock, etc.).

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:42.275Z
Learning: After each commit in PR #1884, I should provide a new comment with the PR size report in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`. The report should exclude irrelevant files such as lock files (e.g., package-lock.json, cargo.lock).

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:25:47.873Z
Learning: After each new commit review for rainlanguage/rain.orderbook repository, generate a PR size report in a separate comment with the format: "TOTAL=number ADDITIONS=number DELETIONS=number". This report should exclude irrelevant files such as lock files (e.g., package-lock.json, cargo.lock).

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:25:47.873Z
Learning: After each new commit review for rainlanguage/rain.orderbook repository, generate a PR size report in a separate comment with the exact format: "TOTAL=number\nADDITIONS=number\nDELETIONS=number". This report should exclude irrelevant files such as lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock).

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T22:14:22.646Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, I must consistently report the PR size after EVERY new commit in the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number" without any formatting blocks. The report must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock) and can be included either as part of the review or as a separate comment.

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T22:14:22.646Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, I must consistently report the PR size after EVERY new commit in the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number" without any additional text or formatting blocks. The report must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock) and can be included either as part of the review or as a separate comment.

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T22:46:08.530Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, the PR size report should be the only content in the comment - no text before it, no text after it, no formatting blocks, just the raw report in the exact format: "TOTAL=number\nADDITIONS=number\nDELETIONS=number". The report must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock).

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.

Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1971
File: .github/workflows/vercel-docs-prod.yaml:32-34
Timestamp: 2025-07-11T12:30:09.245Z
Learning: findolor prefers not to pin Node versions explicitly in GitHub Actions workflows when using Nix with webapp-shell, considering the current setup sufficient for deterministic builds in the rainlanguage/rain.orderbook project.

Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1971
File: .github/workflows/vercel-docs-prod.yaml:10-14
Timestamp: 2025-07-11T12:29:49.284Z
Learning: In GitHub Actions workflows for the rainlanguage/rain.orderbook project, findolor is comfortable with job names that may seem misleading (like "Deploy-Docs-Preview" in a production workflow) when there's only one job in the workflow, as the context makes it clear enough.

Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1913
File: Cargo.toml:55-55
Timestamp: 2025-06-06T16:38:04.182Z
Learning: In rain.orderbook repository, during PR chains involving dependency updates, wasm-bindgen-utils may temporarily point to git commits that don't contain the full required functionality, with the understanding that subsequent PRs in the chain will update it to the correct commit.

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 2246
File: packages/webapp/src/hooks.client.ts:2-2
Timestamp: 2025-10-19T20:24:08.629Z
Learning: In the rain.orderbook repository, the import `rainlanguage/orderbook/esm` in packages/webapp/src/hooks.client.ts is intentional and should not be changed to the root package path, as it's specific to the webapp build configuration.

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 2246
File: packages/orderbook/scripts/buildEsm.js:38-53
Timestamp: 2025-10-25T21:07:19.704Z
Learning: In the rain.orderbook repository, the deduplication logic in buildEsm.js (and similar build scripts) intentionally lacks defensive checks for indexOf returning -1. If duplicates are not found, the script should throw to surface breaking changes in wasm-bindgen output that require attention.

Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1744
File: crates/subgraph/src/orderbook_client.rs:44-46
Timestamp: 2025-05-14T05:13:59.713Z
Learning: In the rain.orderbook project, WASM dependencies are intentionally made available in non-WASM targets to facilitate testing of WASM-related functionality, so conditional compilation guards like `#[cfg(target_family = "wasm")]` should not be added to imports or implementations that may be needed for tests.

Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1710
File: crates/quote/Cargo.toml:30-30
Timestamp: 2025-05-14T04:49:14.621Z
Learning: In the rain.orderbook repository, wasm-bindgen-utils is intentionally used as an unconditional dependency because non-wasm targets (like tests) sometimes need to use it.

Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2044
File: crates/common/src/raindex_client/vaults_list.rs:363-423
Timestamp: 2025-07-31T19:34:11.716Z
Learning: In the rainlanguage/rain.orderbook project, for WASM-exposed functionality like VaultsList, the team prefers to keep comprehensive tests in the non-WASM environment due to the complexity of recreating objects like RaindexVaults in WASM. WASM tests focus on basic functionality and error cases since the WASM code reuses the already-tested non-WASM implementation.

Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1715
File: crates/js_api/src/common/mod.rs:55-59
Timestamp: 2025-05-14T05:51:50.277Z
Learning: In the Rain Orderbook project, the error handling for WASM exported functions uses WasmEncodedError which includes both the original error message and a human-readable version, making direct modification of the JsValue conversion unnecessary.

Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1938
File: crates/js_api/src/raindex/orders.rs:1-11
Timestamp: 2025-06-18T12:54:47.807Z
Learning: In the rain.orderbook repository, findolor prefers to keep unused imports in place when they will be used in upcoming follow-up PRs, rather than removing and re-adding them during incremental development.

Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2036
File: crates/js_api/src/filters/raindex_filter_store.rs:446-533
Timestamp: 2025-08-02T02:34:32.237Z
Learning: In the rainlanguage/rain.orderbook project's RaindexFilterStore WASM tests (crates/js_api/src/filters/raindex_filter_store.rs), brusherru decided to focus on testing only methods without side effects (that don't use web_sys) due to difficulties with mocking localStorage and window APIs in the WASM test environment. This pragmatic approach tests pure logic separately from browser integration.

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:26:31.566Z
Learning: For PR #1884 and future PRs in rainlanguage/rain.orderbook repository, provide PR size reports in a separate comment with ONLY the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number", without any additional text or explanation. Reports should exclude irrelevant files such as lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working js/wasm Update wasm/js

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants