fix: reject unsupported wasm targets at the package boundary - #23
Merged
Conversation
The package still selected mocket.wasm.mbt and serve.mbt for wasm/wasm-gc, so Mocket::listen type-checked for those targets and then trapped at runtime in the panic stubs. Declare supported_targets at the package boundary so wasm/wasm-gc consumers are rejected at build/check time, matching the README. Also declare supported_targets on the cors and static_file sub-packages, which depend on mocket and are likewise js+native only. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
At
main@c545db2, the README states Mocket supports the JS and native backends, butmoon.pkgstill selectsmocket.wasm.mbtandserve.mbtforwasm/wasm-gc. As a result, server code usingMocket::listentype-checks for those targets and then traps at runtime:Fix
Declare the package's actual backend support at the top level of
moon.pkg:This makes
moon check/moon buildrejectwasmandwasm-gcconsumers at the package boundary, matching the README and avoiding runtime-only panic stubs.The
corsandstatic_filesub-packages depend onoboard/mocketand are likewise js/native-only, so they now declaresupported_targetsexplicitly (this also removes the "does not declare supported_targets" warnings they would otherwise emit once the parent package declares its targets).Verification
moon check --target wasmon a wasm consumer that callsMocket::listennow fails at build time:moon check --target wasm-gcfails the same way.moon check --target jsand--target nativestill pass.moon check --target allfinishes cleanly with no warnings.🤖 Generated with Claude Code