Skip to content

Conversation

@MishaKav
Copy link
Collaborator

@MishaKav MishaKav commented Nov 6, 2025

Summary

Fixes a runtime error where the GitHub Action failed with "Cannot find package '@wasm-fmt/ruff_fmt'" when using gitstream-core 2.1.216 or later.

What Changed

When gitstream-core added WASM-based Python formatting support, the GitHub Action couldn't find the required WASM package at runtime because it wasn't being bundled by ncc.

This PR:

  • Adds the WASM package as a dev dependency for build-time detection
  • Adds a static import hint so ncc can detect and bundle the package
  • Bundles the WASM binary file (1.6MB) to the dist folder
  • Adds Jest mock to prevent test failures

Testing

  • ✅ All tests passing
  • ✅ WASM file successfully bundled to dist/
  • ✅ Build process verified
  • ✅ Compatible with both GitHub Actions and Lambda environments

Related

https://linearb.atlassian.net/browse/LINBEE-20287

CHANGELOG

🐛 Bug Fixes

  • Fixed error preventing Python file formatting in workflow automations

- Add @wasm-fmt/ruff_fmt as devDependency for build-time bundling
- Add static import hint in main.ts so ncc can detect the package
- Bundle WASM binary (ruff_fmt_bg.wasm) to dist for runtime usage
- Add Jest mock to prevent test failures with ESM-only package

This fixes the "Cannot find package '@wasm-fmt/ruff_fmt'" error that
occurred when gitstream-core 2.1.216+ tried to initialize Python formatting.

The solution works for both environments:
- GitHub Actions: WASM bundled by ncc, loaded via dynamic import
- Lambda: WASM loaded from node_modules via dynamic import

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@MishaKav MishaKav added the auto-deploy when exists in PR, will auto make release and auto deploy to prod label Nov 6, 2025
@MishaKav MishaKav enabled auto-merge (squash) November 6, 2025 11:37
@MishaKav MishaKav merged commit 3614828 into develop Nov 6, 2025
14 checks passed
@MishaKav MishaKav deleted the LINBEE-20287-fix-wasm-bundling-for-python-formatting branch November 6, 2025 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 min review AI-Minor-Change auto-deploy when exists in PR, will auto make release and auto deploy to prod 🤖 Claude Code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants