refactor(deploy): remove client-side firmware ledger (#18)#62
Conversation
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>
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Removes the client-side
FirmwareLedgerand its pre-check / post-deploy bookkeeping. Device-sideverify-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:
esptool write-flashIn those cases the ledger says "current" but the device actually runs a different image, and fbuild silently skips a needed deploy.
verify-flashasks the ESP32 stub flasher for a per-regionFLASH_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
crates/fbuild-deploy/src/firmware_ledger.rsfirmware_ledgerfield fromDaemonContextrecord_deploymentblocks fromhandlers/operations.rscompute_boot_parts_hasheshelper (verify-flash already covers all three regions)fbuild-deploy/src/lib.rsfbuild-deployREADMEsNet: -712 lines.
Test plan
uv run cargo clippy --workspace --all-targets -- -D warningscleanuv run cargo test --workspace— all passing (the removed ledger tests were the only consumers)🤖 Generated with Claude Code