Skip to content

refactor(deploy): remove client-side firmware ledger (#18)#62

Merged
zackees merged 1 commit intomainfrom
fix/issue-18-remove-firmware-ledger
Apr 17, 2026
Merged

refactor(deploy): remove client-side firmware ledger (#18)#62
zackees merged 1 commit intomainfrom
fix/issue-18-remove-firmware-ledger

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented Apr 17, 2026

Summary

Removes the client-side FirmwareLedger and its pre-check / post-deploy bookkeeping. Device-side verify-flash (already wired into the daemon's deploy handler) becomes the sole authoritative "can we skip this flash?" check.

Why

The ledger's guarantee only holds when every flash goes through fbuild. Any of the following breaks the invariant and makes the ledger a correctness bug rather than an optimization:

  • manual esptool write-flash
  • Arduino IDE flash
  • OTA update
  • a different fbuild instance or machine flashing the same device

In those cases the ledger says "current" but the device actually runs a different image, and fbuild silently skips a needed deploy.

verify-flash asks the ESP32 stub flasher for a per-region FLASH_MD5SUM. ~6 s round-trip for a 2.4 MB image; the existing 76% speedup over a full re-flash is preserved, and the check reflects actual device state rather than our bookkeeping.

Changes

  • Delete crates/fbuild-deploy/src/firmware_ledger.rs
  • Remove firmware_ledger field from DaemonContext
  • Remove pre-check + post-deploy record_deployment blocks from handlers/operations.rs
  • Remove compute_boot_parts_hashes helper (verify-flash already covers all three regions)
  • Drop the re-export from fbuild-deploy/src/lib.rs
  • Update fbuild-deploy READMEs

Net: -712 lines.

Test plan

  • uv run cargo clippy --workspace --all-targets -- -D warnings clean
  • uv run cargo test --workspace — all passing (the removed ledger tests were the only consumers)
  • CI green on Linux / macOS / Windows

🤖 Generated with Claude Code

The ledger's promise — "skip deploy if the device already has this
firmware" — only holds when every flash goes through fbuild. Any of the
following breaks the invariant:
- manual esptool write-flash
- Arduino IDE flash
- OTA update
- a different fbuild instance or machine flashing the same device

In those cases the ledger says "current" but the device actually runs a
different image, and fbuild silently skips a needed deploy.

Device-side `verify-flash` (already wired into the daemon's deploy
handler) is the authoritative check: it asks the ESP32 stub flasher for
a per-region `FLASH_MD5SUM` and compares against what we're about to
write. ~6 s round-trip for a 2.4 MB image; the 76% speedup over a full
re-flash is preserved.

Removes:
- `crates/fbuild-deploy/src/firmware_ledger.rs`
- `firmware_ledger` field from `DaemonContext`
- Pre-check + post-deploy `record_deployment` blocks in operations.rs
- `compute_boot_parts_hashes` helper (verify-flash covers all 3 regions)
- Re-export from `fbuild-deploy/src/lib.rs`

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

Warning

Rate limit exceeded

@zackees has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 54 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 19 minutes and 54 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 10fad5fb-21bb-4e32-85dc-2af61dbc4643

📥 Commits

Reviewing files that changed from the base of the PR and between f6c48f1 and b246d6b.

📒 Files selected for processing (6)
  • crates/fbuild-daemon/src/context.rs
  • crates/fbuild-daemon/src/handlers/operations.rs
  • crates/fbuild-deploy/README.md
  • crates/fbuild-deploy/src/README.md
  • crates/fbuild-deploy/src/firmware_ledger.rs
  • crates/fbuild-deploy/src/lib.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-18-remove-firmware-ledger

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 588879e into main Apr 17, 2026
76 checks passed
@zackees zackees deleted the fix/issue-18-remove-firmware-ledger branch April 17, 2026 16:51
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