Skip to content

feat(deploy): pre-deploy artifact size validation (#690) - #707

Merged
zackees merged 1 commit into
mainfrom
feat/690-flash-size-check
Jun 20, 2026
Merged

feat(deploy): pre-deploy artifact size validation (#690)#707
zackees merged 1 commit into
mainfrom
feat/690-flash-size-check

Conversation

@zackees

Copy link
Copy Markdown
Member

#690. Catches too-large firmware at fbuild time instead of mid-flash when half the bytes have already been written.

What ships

  • FbuildError::FirmwareTooLarge { board, actual, max, percent_used } — structured fields so CI / bash autoresearch can pinpoint overflow without parsing strings
  • fbuild_deploy::size_check::check_artifact_fits_flash(artifact, max_size, board) — soft warning at 90% (fix(autoresearch/lpc): assert DTR=True + VID:PID port detection (#3300) FastLED#3339's LPC bring-up sat at 84%, ~6% headroom), hard error above max
  • max_size: None (e.g. esp32 catch-all) skips with debug log; esptool's own check runs at deploy time
  • Defensive: max=0 in a malformed board JSON treats any artifact as overflow instead of dividing by zero

Tests — 11 passed

Real-world numbers: LPC845-BRK at FastLED's 84%, LPC845 at 92% warn threshold, LPC804 32 KB overflow, Teensy 4.0 / RP2040 Pico fits, ESP32 catch-all skip, missing artifact IO error, zero max_size defense.

cargo clippy -p fbuild-core -p fbuild-deploy --all-targets -- -D warnings clean. cargo fmt --all --check clean.

Out of scope (follow-up)

Wiring check_artifact_fits_flash into each Deployer's pre-deploy hook (esp32, lpc, avr, teensy) — needs board JSON lookup per orchestrator and is its own integration PR.

Closes#690.

#690 — catch too-large firmware at fbuild time instead
of mid-flash when half the bytes have already been written.
- New FbuildError::FirmwareTooLarge { board, actual, max,
percent_used } — structured fields so CI / bash autoresearch can
pinpoint overflow without parsing strings
- New fbuild_deploy::size_check::check_artifact_fits_flash(artifact,
max_size, board) — soft warning at 90% (FastLED/FastLED#3339's LPC
bring-up sat at 84%, ~6% headroom); hard error above max
- max_size: None (e.g. esp32 catch-all) skips with debug log;
esptool's own check runs at deploy time
- Defensive: max=0 in a malformed board JSON treats any artifact as
overflow instead of dividing by zero
11 unit tests covering: under/at/over flash size with structured
error inspection, LPC845-BRK at FastLED's 84%, LPC845 at 92% warn
threshold, LPC804 32 KB overflow, Teensy 4.0 / RP2040 Pico fits,
ESP32 catch-all skip, missing artifact IO error, zero max_size
defense.
Out of scope (follow-ups): wiring check_artifact_fits_flash into
each Deployer's pre-deploy hook (esp32, lpc, avr, teensy) — needs
board JSON lookup per orchestrator and is its own integration PR.
Closes#690.
@coderabbitai

Copy link
Copy Markdown

Warning

Review limit reached

@zackees, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 6 minutes and 16 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a2662ae6-3ef7-413e-a416-9babd5443d71

📥 Commits

Reviewing files that changed from the base of the PR and between 758e6e1 and a0aaba5.

📒 Files selected for processing (3)
  • crates/fbuild-core/src/lib.rs
  • crates/fbuild-deploy/src/lib.rs
  • crates/fbuild-deploy/src/size_check.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/690-flash-size-check

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 and usage tips.

@zackees
zackees merged commit b480b22 into mainJun 20, 2026
85 of 91 checks passed
@zackees
zackees deleted the feat/690-flash-size-check branch June 20, 2026 20:48
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

fbuild-deploy: pre-deploy artifact size validation against board flash region

1 participant

@zackees