Skip to content

feat(wasm): add pre-flight check for wasm-bindgen-cli version#3094

Merged
QuantumExplorer merged 1 commit intov3.1-devfrom
featverify-wasm-bindgen-version
Feb 17, 2026
Merged

feat(wasm): add pre-flight check for wasm-bindgen-cli version#3094
QuantumExplorer merged 1 commit intov3.1-devfrom
featverify-wasm-bindgen-version

Conversation

@QuantumExplorer
Copy link
Member

@QuantumExplorer QuantumExplorer commented Feb 17, 2026

Issue being fixed or feature implemented

This update introduces a pre-flight check to ensure that the installed version of wasm-bindgen-cli matches the version specified in the Cargo.lock file.

What was done?

  • Added a script in build-wasm.sh that checks the installed version of wasm-bindgen-cli against the required version from Cargo.lock.
  • If there is a version mismatch, an error message is displayed with instructions on how to fix it.
  • If wasm-bindgen-cli is not installed, an error message prompts the user to install it with the correct version.

How Has This Been Tested?

The script was tested by running it in an environment with both matching and mismatched versions of wasm-bindgen-cli, as well as in an environment where wasm-bindgen-cli is not installed.

Breaking Changes

None

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added ! to the title and described breaking changes in the corresponding section if my code contains any.

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Chores
    • Improved build reliability by adding validation to ensure toolchain compatibility before compilation.
    • Enhanced error messaging to guide users when required tools are missing or incompatible.

@github-actions github-actions bot added this to the v3.1.0 milestone Feb 17, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

📝 Walkthrough

Walkthrough

The build script now includes a pre-flight version verification check that compares the installed wasm-bindgen-cli version with the required version specified in Cargo.lock, erroring if the tool is missing or a mismatch is detected.

Changes

Cohort / File(s) Summary
Version Verification Pre-flight Check
packages/scripts/build-wasm.sh
Added logic to compute repository root, extract required wasm-bindgen-cli version from Cargo.lock, verify tool installation, compare versions, and error with instructional messages if uninstalled or version mismatch occurs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A script that checks before it starts,
Ensures all versions play their parts,
With Cargo.lock and CLI in hand,
No mismatches in our wasm-land! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly summarizes the main change: adding a pre-flight check for wasm-bindgen-cli version verification. It is concise, specific, and accurately reflects the primary objective of the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 featverify-wasm-bindgen-version

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/scripts/build-wasm.sh (1)

103-103: Consider anchoring the awk match to avoid edge-case false matches.

The current awk pattern relies on $ to anchor the end of the line, which is correct. However, the getline; print will print whatever line follows — if the lockfile format ever changes (e.g., a comment or blank line between fields), this would silently extract the wrong value. A slightly more defensive approach:

♻️ Optional: more robust version extraction
-REQUIRED_WB_VERSION=$(awk '/^name = "wasm-bindgen"$/{getline; print}' "$REPO_ROOT/Cargo.lock" | head -1 | sed 's/version = "//;s/"//')
+REQUIRED_WB_VERSION=$(awk '/^name = "wasm-bindgen"$/{found=1; next} found && /^version = /{print; exit}' "$REPO_ROOT/Cargo.lock" | sed 's/version = "//;s/"//')

This validates that the next relevant line actually starts with version = before extracting it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/scripts/build-wasm.sh` at line 103, The current extraction assigned
to REQUIRED_WB_VERSION uses awk with '/^name = "wasm-bindgen"$/{getline; print}'
which can pick up the wrong following line if the lockfile format changes;
modify the awk logic used in REQUIRED_WB_VERSION so that after matching the
'name = "wasm-bindgen"' line it scans subsequent lines until it finds one that
explicitly begins with 'version = ' and then extracts that value (i.e., only
print when the next relevant line matches /^version = /), ensuring more robust
and defensively anchored version extraction.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/scripts/build-wasm.sh`:
- Line 103: The current extraction assigned to REQUIRED_WB_VERSION uses awk with
'/^name = "wasm-bindgen"$/{getline; print}' which can pick up the wrong
following line if the lockfile format changes; modify the awk logic used in
REQUIRED_WB_VERSION so that after matching the 'name = "wasm-bindgen"' line it
scans subsequent lines until it finds one that explicitly begins with 'version =
' and then extracts that value (i.e., only print when the next relevant line
matches /^version = /), ensuring more robust and defensively anchored version
extraction.

Copy link
Member Author

@QuantumExplorer QuantumExplorer left a comment

Choose a reason for hiding this comment

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

Self verified.

@QuantumExplorer QuantumExplorer changed the title feat: add pre-flight check for wasm-bindgen-cli version feat(wasm): add pre-flight check for wasm-bindgen-cli version Feb 17, 2026
@QuantumExplorer QuantumExplorer merged commit 049e740 into v3.1-dev Feb 17, 2026
18 of 21 checks passed
@QuantumExplorer QuantumExplorer deleted the featverify-wasm-bindgen-version branch February 17, 2026 19:13
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.

1 participant

Comments