block / block/trailblaze

WASM-bundle remediation message is wrong: BUNDLE_WASM is ignored, and kotlinWasmUpgradeYarnLock only exists with -Ptrailblaze.wasm=true

Open Beginner friendly
#184 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
310
Forks
28
Avg merge
7h 45m
Merged PRs (30d)
8

Description

### Problem

When the uber JAR is built without the WASM report template (the dev default, `trailblaze.wasm=false`), report/`/devices` rendering fails with:

```
WASM bundle not found. Rebuild with `-Ptrailblaze.wasm=true` (or `BUNDLE_WASM=true ./scripts/install-trailblaze-source.sh`) so the report template is bundled into the uber JAR.
```

Both remediations in that message are wrong / incomplete, so following them doesn't fix it:

1. **`BUNDLE_WASM=true ./scripts/install-trailblaze-source.sh` does nothing.** The script doesn't read `BUNDLE_WASM` — it only honors `TRAILBLAZE_GRADLE_EXTRA_ARGS` (its own comment notes CI uses that to pass `-Ptrailblaze.wasm=true`). So `BUNDLE_WASM=true ...` builds *without* WASM and the error persists.

2. **The WASM build then fails on a stale yarn lock**, whose own remediation is also a dead end without context:
```
:kotlinWasmStoreYarnLock FAILED
> Lock file was changed. Run the `kotlinWasmUpgradeYarnLock` task to actualize lock file
```
But `kotlinWasmUpgradeYarnLock` only registers when `-Ptrailblaze.wasm=true` is set (the `wasmJs` target is conditional on the flag). Run bare, it's `Task 'kotlinWasmUpgradeYarnLock' not found`.

### What actually works (verified end-to-end)

```bash
# 1. actualize the wasm yarn lock (task only exists with the flag)
./gradlew -Ptrailblaze.wasm=true kotlinWasmUpgradeYarnLock
# 2. build + install the uber JAR WITH the wasm flag
TRAILBLAZE_GRADLE_EXTRA_ARGS="-Ptrailblaze.wasm=true" ./scripts/install-trailblaze-source.sh
```
After that, `/devices` serves the real viewer instead of the error.

### Suggested better message

> WASM report template not bundled in this uber JAR (dev builds default to `trailblaze.wasm=false` for speed). To include it, rebuild with the WASM flag:
> `TRAILBLAZE_GRADLE_EXTRA_ARGS="-Ptrailblaze.wasm=true" ./scripts/install-trailblaze-source.sh`
> If the build fails on a stale yarn lock, first run:
> `./gradlew -Ptrailblaze.wasm=true kotlinWasmUpgradeYarnLock`

i.e. drop the non-functional `BUNDLE_WASM` suggestion, and note the yarn-lock upgrade task needs the flag.

### Environment

Trailblaze source build off `main`, macOS. Surfaced while bundling the report template into a source uber JAR.

Contributor guide

Open the contributing guide

Research direction

Start at the report /devices rendering path that emits the missing-WASM message, then inspect scripts/install-trailblaze-source.sh and the Gradle WASM task setup. Update the remediation text to use TRAILBLAZE_GRADLE_EXTRA_ARGS and explain that kotlinWasmUpgradeYarnLock requires -Ptrailblaze.wasm=true; verify the documented commands produce a working /devices viewer.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, wasm
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.