Skip to content

fix: keep CoreS3 USB available in normal builds - #652

Merged
meganetaaan merged 2 commits into
developfrom
fix/usb-debugger-conflict
Aug 12, 2026
Merged

fix: keep CoreS3 USB available in normal builds#652
meganetaaan merged 2 commits into
developfrom
fix/usb-debugger-conflict

Conversation

@meganetaaan

@meganetaaan meganetaaan commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Default normal host build, flash, and deploy commands to release mode.
  • Keep explicit debug and instrument modes available while warning about the CoreS3 USB CDC conflict.
  • Document the Moddable SDK 9.0.0 behavior and add command-level regression coverage.

What Changed

  • Resolve build, flash, and deploy to release mode unless a mode is explicitly selected.
  • Keep debug and MOD commands in debug mode by default.
  • Remove implicit debug flags from legacy normal build scripts.
  • Warn when a CoreS3 debug or instrument host build reserves USB Serial/JTAG for xsbug.

Root Cause

Moddable SDK 9.0.0 changed ESP32-S3 debug builds with USE_USB=2 to use its CDC debugger implementation without claiming UART pins. That implementation still installs the USB Serial/JTAG driver even when xsbug is not launched, so Stack-chan's Codex Voice USB transport cannot install the same driver.

Verification

  • cd firmware && npm run format
  • cd firmware && npm run lint
  • cd firmware && npm run test:unit — 391 tests passed
  • cd firmware && npm run check:legacy-names
  • CoreS3 release firmware build with Moddable SDK 9.0.0 and ESP-IDF 6.0.2
  • Flashed /dev/ttyACM1; image hashes verified
  • Physical USB CDC handshake: max_payload=4096 capabilities=0x00000f7f

Affected Areas

  • firmware
  • web
  • schematics
  • case
  • docs
  • ci/github-actions

Breaking Changes

  • none
  • yes, described below

Release Impact

  • patch — fixes CoreS3 Codex Voice USB initialization for normal build and flash workflows.

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Build, flash, and deploy commands now default to release mode.
    • Debug and instrument modes remain available when explicitly selected.
    • CoreS3 commands warn when non-release modes may limit USB communication.
  • Documentation

    • Updated English and Japanese firmware guides with mode defaults and CoreS3 USB guidance.
    • Added an explicit debug-mode example to command help.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 593f0654-5f6f-4b48-b715-f3d878f0d5ae

📥 Commits

Reviewing files that changed from the base of the PR and between c3efcbf and 7744c5d.

📒 Files selected for processing (1)
  • firmware/scripts/lib/firmware-command.test.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • firmware/scripts/lib/firmware-command.test.mjs

📝 Walkthrough

Walkthrough

Host build, flash, and deploy commands now default to release mode. Explicit debug and instrument modes remain available. CoreS3 non-release commands emit USB Serial/JTAG warnings. Tests, package scripts, flashing guides, and a changeset reflect the new behavior.

Changes

Release-mode firmware commands

Layer / File(s) Summary
Command mode behavior and script wiring
firmware/scripts/firmware.mjs, firmware/package.json
Host commands default to release mode when no mode is selected. Explicit modes remain supported. Non-release CoreS3 commands emit a USB warning. Package build scripts no longer pass -d.
Command behavior validation
firmware/scripts/lib/firmware-command.test.mjs
Tests cover default modes, explicit debug and instrument modes, CoreS3 warnings, and command output capture.
Release-mode documentation and changeset
firmware/docs/flashing-firmware.md, firmware/docs/flashing-firmware_ja.md, .changeset/clean-usb-release-builds.md
The flashing guides and changeset describe release defaults and CoreS3 USB limitations.

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant firmware_mjs as firmware.mjs
  participant BuildConfig as run-mcconfig.mjs
  participant CoreS3USB as CoreS3 USB Serial/JTAG
  Developer->>firmware_mjs: run build, flash, or deploy
  firmware_mjs->>BuildConfig: select release mode by default
  BuildConfig-->>firmware_mjs: return build configuration
  firmware_mjs-->>CoreS3USB: warn when CoreS3 uses non-release mode
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: preserving CoreS3 USB availability in normal builds.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/usb-debugger-conflict

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.

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

Cloudflare PR preview

This pull request is closed. Its preview has been replaced with a closed page at https://pr-652.stack-chan-pr-preview.pages.dev.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
firmware/scripts/lib/firmware-command.test.mjs (1)

39-48: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Expand coverage to the complete command and mode matrix.

The implementation applies explicit modes to build, flash, and deploy, and the warning applies to debug and instrument modes. These tests cover explicit modes only for build and cover only debug mode for the warning. Add coverage for flash, deploy, --mode=instrument, and the legacy -d and -i selectors.

As per path instructions: “Because this PR changes user-visible firmware command behavior, retain the changeset/release-impact documentation and include target-specific CoreS3 verification where applicable.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@firmware/scripts/lib/firmware-command.test.mjs` around lines 39 - 48, Expand
the firmware command tests around dryRunCommand to cover explicit debug and
instrument modes for build, flash, and deploy, including both
--mode=debug/instrument and legacy -d/-i selectors. Extend the CoreS3 Codex
Voice USB warning assertions to instrument mode while preserving the no-warning
checks for release builds and non-CoreS3 targets; retain the required
changeset/release-impact documentation and target-specific CoreS3 verification.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@firmware/scripts/lib/firmware-command.test.mjs`:
- Around line 27-48: Update the command tests around dryRunCommand to make
device selection deterministic by explicitly setting or clearing
STACKCHAN_DEVICE for every case, especially the CoreS3 warning assertions.
Ensure the tests that expect CoreS3 behavior invoke the command with an explicit
CoreS3 device, while preserving coverage of the default-device behavior
separately if needed.

---

Nitpick comments:
In `@firmware/scripts/lib/firmware-command.test.mjs`:
- Around line 39-48: Expand the firmware command tests around dryRunCommand to
cover explicit debug and instrument modes for build, flash, and deploy,
including both --mode=debug/instrument and legacy -d/-i selectors. Extend the
CoreS3 Codex Voice USB warning assertions to instrument mode while preserving
the no-warning checks for release builds and non-CoreS3 targets; retain the
required changeset/release-impact documentation and target-specific CoreS3
verification.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 00264384-592a-474a-8d70-de25668b9068

📥 Commits

Reviewing files that changed from the base of the PR and between f16e56a and c3efcbf.

📒 Files selected for processing (6)
  • .changeset/clean-usb-release-builds.md
  • firmware/docs/flashing-firmware.md
  • firmware/docs/flashing-firmware_ja.md
  • firmware/package.json
  • firmware/scripts/firmware.mjs
  • firmware/scripts/lib/firmware-command.test.mjs

Comment thread firmware/scripts/lib/firmware-command.test.mjs
@meganetaaan
meganetaaan merged commit 96ad916 into develop Aug 12, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant