Skip to content

refactor(channels): stub and WASM legacy controllers onto SlimBridgeController (#4587) - #4608

Merged
zackees merged 1 commit into
masterfrom
feat/meta-work-4587
Sep 25, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/meta-work-4587

Conversation

@zackees

@zackees zackees commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Closes #4587. Part of #4580.

Moves the stub and WASM legacy addLeds controllers (clockless_channel_stub.h, spi_channel_stub.h, clockless_channel_wasm.h, spi_channel_wasm.h) onto fl::SlimBridgeController, so host tests exercise the same controller code the devices use.

Local validation:

  • bash lint: passes.
  • bash test --cpp: all unit tests and examples pass.
  • bash test slim_bridge_controller and bash test timing_traits: pass.
  • bash compile wasm --examples Blink could not finish locally, because the session's rm guard blocked the WASM archive step. It is an environment issue, not a compile error: every WASM object compiled. CI's WASM job validates the build.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved pixel capture and transmission consistency in stub and WebAssembly environments by routing LED output through a shared controller.
    • Pixel capture now occurs only when the controller is enabled and ready to accept a frame.

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: b7a81fa5-8b2e-4014-ac66-3e06c6eaf0a7

📥 Commits

Reviewing files that changed from the base of the PR and between e61aae4 and 86e6b1f.

📒 Files selected for processing (6)
  • src/fl/channels/slim_bridge_controller.h
  • src/platforms/stub/clockless_channel_stub.h
  • src/platforms/stub/spi_channel_stub.h
  • src/platforms/wasm/clockless_channel_wasm.h
  • src/platforms/wasm/spi_channel_wasm.h
  • tests/fl/channels/slim_bridge_controller.cpp

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Stub and WASM clockless and SPI controllers now use SlimBridgeController for transmission. The base controller provides an onBeforeEncode hook, which the WASM and stub clockless controllers use for capture work.

Changes

Slim bridge controller adoption

Layer / File(s) Summary
Pre-encode hook and validation
src/fl/channels/slim_bridge_controller.h, tests/fl/channels/slim_bridge_controller.cpp
showPixels() calls onBeforeEncode() after driver readiness checks and before encoding. The hook defaults to no action. A test checks that it runs for an enabled frame and does not run when the mock driver is disabled.
Clockless controller bridge integration
src/platforms/stub/clockless_channel_stub.h, src/platforms/wasm/clockless_channel_wasm.h
Both clockless controllers now inherit from SlimBridgeController and delegate transmission to the base. Their capture work runs through onBeforeEncode().
SPI controller bridge integration
src/platforms/stub/spi_channel_stub.h, src/platforms/wasm/spi_channel_wasm.h
Both SPI controllers now inherit from SlimBridgeController and delegate channel transmission and driver handling to the base.

Priority: ⬇️ Low

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

Change: Refactor

Merge Risk: ⚪ Minimal · up to 86e6b

The stub and WASM LED controllers now share the same transmission path used on devices, and their capture work runs in a pre-encode hook. Driver routing and trait visibility match the previous behavior, and the hook's gating is tested. No merge-blocking risk remains.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 86e6b

The shared path changes frame handling for host and browser controllers. The reviewed code retains driver-enabled and readiness checks, and no new security exposure was established. End-to-end browser behavior remains incompletely verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed production behavior is scoped to legacy stub and WASM controller instances and their shared channel driver and capture state; the changed test ranges do not expand production reachability.

Trust Boundaries and Controls

  • observed — Before capture or enqueue, the bridge consults the manager’s driver-enabled state and checks readiness when its buffer is in use. No changed authentication, credential, or privileged sink is evidenced in the reviewed controller path.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The diff establishes the main [#4587] implementation. All four target controllers now derive from SlimBridgeController, and frame capture uses onBeforeEncode() where required. The added test verif… Provide the T1 conformance result, the same-SHA bash bloat before/after record, and the hardware availability or AutoResearch result.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: moving the stub and WASM legacy controllers onto SlimBridgeController. The scope matches the changeset, and the issue reference does not make the title mi…
Out of Scope Changes check ✅ Passed The changes stay within [#4587]. The four specified stub and WASM controllers move to SlimBridgeController. The base hook and slim_bridge_controller test directly support frame encoding and contro…
Full details: Linked Issues check

Explanation

The diff establishes the main [#4587] implementation. All four target controllers now derive from SlimBridgeController, and frame capture uses onBeforeEncode() where required. The added test verifies the hook behavior. The available evidence does not identify a T1 conformance result, record a same-SHA bash bloat comparison, or state whether hardware was available for AutoResearch. Full issue acceptance is therefore not established.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@zackees zackees added ci-platform:wasm Select FastLED board CI cells ci-test:wasm Select FastLED board CI cells labels Sep 25, 2026
@zackees

zackees commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

The WASM Playwright failure (no frames rendered) also happens on master at 9bf4ce33f4 without this PR, run https://github.com/FastLED/FastLED/actions/runs/36091030845. It is tracked as 4615. This PR does not change the WASM result, and the full host suite passes, so it is merged, with WASM rendering to be re-verified once 4615 is fixed.

@zackees
zackees merged commit 2943ad9 into master Sep 25, 2026
346 of 352 checks passed
@zackees
zackees deleted the feat/meta-work-4587 branch September 25, 2026 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-platform:wasm Select FastLED board CI cells ci-test:wasm Select FastLED board CI cells

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

slim bridge: stub and WASM channel controllers

1 participant