bazelbuild/bazel

Loaded wasm modules are not shareable between module extension and instantiated repository rules

Open

#26,974 创建于 2025年9月12日

在 GitHub 查看
 (5 评论) (0 反应) (0 负责人)Java (4,465 fork)batch import
P2help wantedteam-ExternalDepstype: bug

仓库指标

Star
 (25,384 star)
PR 合并指标
 (平均合并 22天 20小时) (30 天内合并 77 个 PR)

描述

Description of the bug:

I have a wasm module that converts toml to json. It's used in rules_rs in the hub-and-spokes pattern ("hub" @cargo repo provides aliases to targets in "spoke" repos, 1 repo for each crate). The module extension needs to parse the Cargo.lock toml file, and each spoke repo needs to parse the Cargo.toml in the downloaded crate. Since the download is triggered in the spoke repo via rctx.download_and_extract, the parsing must also occur in the spoke repo.

repository_ctx.load_wasm is intended to allow loading the module once and executing it repeatedly, but it's not clear how to pass the reference to the loaded module from the module extension to the spoke repos, and It seems wasteful to load the module repeatedly. (Not sure how to get the timing here, but loading this module into wazero, a different wasm runtime, takes around 70ms).

This hub-and-spoke model is a common pattern for rulesets that mirror package-manager dependency trees into Bazel (cargo, pnpm/rules_js, pypi/rules_python, etc.)

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

No response

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

贡献者指南