Skip to content

fix(wasm): repair default gfx renderer, kill manifest 404s, fail browser test on console errors - #3686

Merged
zackees merged 4 commits into
masterfrom
fix/wasm-frontend-console-errors
Jul 16, 2026
Merged

zackees merged 4 commits into
masterfrom
fix/wasm-frontend-console-errors

Conversation

@zackees

@zackees zackees commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

What

Follow-up to #3683: the WASM app had runtime console errors that no gate caught, and the default browser renderer was broken outright by the gfx-core refactor.

Bugs fixed

  1. Default renderer never drew (graphics_manager_gfx.ts): the shared @fastled/gfx adapter — the default whenever no gfx= URL override is present — expected strips shaped {x, y}, but the engine wire format nests coordinates as {map: {x, y}, diameter} (see js_bindings.cpp.hpp and the legacy graphics_manager.ts). Every strip was dropped, the worker threw screenmap: no coordinate strips found per frame, and rendering fell through to a fallback. Also hardened the startup races the fix exposed: empty screenmap updates no longer clobber a good one, frames arriving before the screenmap are skipped instead of throwing per frame, and zero-byte startup frames are dropped instead of tripping the core's frame-size check.
  2. Manifest 404s (ci/wasm_build.py): generate_manifest() swept every .json in the sketch dir into files.json, so clangd artifacts (.vscode/settings.json, compile_commands.json) written by fastled --write-clangd got listed as sketch data — the frontend fetched them and logged two 404 console errors on every load. Hidden dirs/files and compile_commands.json are now pruned.
  3. Console log spam (ui_manager.ts): the unconditional per-element data: / Group … found, for item … logs (one of which, garbled, was mistaken for an error during triage) are now debug-gated.

Why no test caught this

ci/wasm_test.py (Playwright) had two blind spots:

  • It captured console errors but only printed them — success was judged solely on "frames rendered".
  • It forced ?gfx=0, so CI only ever exercised the legacy renderer, never the default one users get.

The gate (friction-free error catching)

ci/wasm_test.py now fails on any browser console error or uncaught page exception (opt out with --allow-console-errors) and defaults to no gfx override, exercising the real default renderer. Either change alone would have caught everything above.

Validation

  • uv run ci/wasm_test.py hydropack / wasm / Blink — all pass strict mode on the default renderer, zero console errors.
  • Live fastled CLI server (fastled examples/hydropack --no-https): 3 consecutive Playwright sweeps, zero console errors / page errors / 4xx-5xx.
  • End-to-end visual: injected a synthesized beat WAV over CDP — the default renderer now draws the dual rings (with bloom) correctly; accent beats light both rings, regular beats only the sensitive inner ring.
  • bash lint — clean.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved graphics startup handling to prevent errors when screen maps or frame data are temporarily unavailable.
    • Added support for additional screen map coordinate formats and strip diameter information.
    • Improved browser test failure detection for fatal console errors.
    • Prevented build manifests from including hidden files, directories, and tooling artifacts.
    • Suppressed diagnostic UI logging unless debug mode is enabled.
  • Improvements

    • Graphics tests no longer add an unnecessary graphics parameter when it is not configured.

zackees and others added 4 commits July 16, 2026 00:19
The default renderer path (shared @fastled/gfx adapter, used whenever no
gfx= URL override is given) expected strips shaped {x, y}, but the
engine wire format nests coordinates as {map: {x, y}, diameter} (see
js_bindings.cpp.hpp and the legacy graphics_manager.ts). Every strip
was dropped, so the worker threw a screenmap no-coordinate-strips
error on every frame and the default renderer never drew.

Also tolerate the startup races the fix exposed: keep the previous
screenmap when an empty update arrives, skip frames that precede the
screenmap instead of erroring each one, and drop zero-byte startup
frames the core would reject.

Co-Authored-By: Claude Fable 5 <[email protected]>
generate_manifest() swept every .json under the sketch dir into
files.json, so clangd/editor artifacts (.vscode/settings.json,
compile_commands.json) written by fastled --write-clangd were listed
as sketch data; the frontend fetched them at runtime and logged 404
console errors. Prune hidden dirs/files and compile_commands.json.

Co-Authored-By: Claude Fable 5 <[email protected]>
…renderer

ci/wasm_test.py captured browser console errors but only printed them,
and it forced gfx=0 so CI always exercised the legacy renderer instead
of the one users get by default. Rendering alone is no longer success:
any console error or uncaught page exception fails the run (opt out
with --allow-console-errors), and the default run now uses no gfx
override. Either change alone would have caught the broken default
renderer, the per-frame worker screenmap errors, and the manifest 404s
that shipped with the gfx-core refactor.

Co-Authored-By: Claude Fable 5 <[email protected]>
The unconditional data: and Group-found logs printed one line per UI
element on every load, drowning real diagnostics (and one garbled copy
of them was mistaken for an error during triage).

Co-Authored-By: Claude Fable 5 <[email protected]>
@zackees
zackees merged commit 9b87064 into master Jul 16, 2026
10 of 11 checks passed
@zackees
zackees deleted the fix/wasm-frontend-console-errors branch July 16, 2026 07:20
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 03ff0b60-9143-4de2-a247-d92238330085

📥 Commits

Reviewing files that changed from the base of the PR and between a5f021c and 2e4c8fe.

📒 Files selected for processing (4)
  • ci/wasm_build.py
  • ci/wasm_test.py
  • src/platforms/wasm/compiler/modules/graphics/graphics_manager_gfx.ts
  • src/platforms/wasm/compiler/modules/ui/ui_manager.ts

📝 Walkthrough

Walkthrough

WASM build manifests now filter hidden and tooling files. Browser tests make graphics selection optional and classify fatal console errors. Graphics handling normalizes screenmaps and ignores empty startup data, while UI diagnostics are gated by debug mode.

Changes

WASM tooling and runtime handling

Layer / File(s) Summary
Manifest file filtering
ci/wasm_build.py
Manifest traversal excludes hidden directories, hidden files, and compile_commands.json.
Browser test configuration and error handling
ci/wasm_test.py
The --gfx parameter is optional, and fatal browser console errors fail tests unless explicitly allowed.
Graphics screenmap and frame handling
src/platforms/wasm/compiler/modules/graphics/graphics_manager_gfx.ts
Screenmap coordinates support multiple input shapes; empty updates preserve existing maps, early frames are ignored, and zero-byte frames are not pushed.
Debug-gated UI logging
src/platforms/wasm/compiler/modules/ui/ui_manager.ts
Element and group diagnostics are logged only when debug mode is enabled.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant wasm_test.py
  participant Browser
  participant FastLED_WASM
  participant Console
  wasm_test.py->>Browser: Navigate using optional gfx parameter
  Browser->>FastLED_WASM: Initialize and render
  FastLED_WASM->>Console: Emit console errors
  wasm_test.py->>Console: Collect and classify errors
  wasm_test.py->>Browser: Fail if fatal errors are not allowed
Loading

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wasm-frontend-console-errors

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant