Repository navigation
fix(cli): route fbuild reset through daemon device-lease admission - #2155
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
ban_std_mpsc_in_async_reachable denies std mpsc under crates/*/src/ with no allowlist; take the captured request off the server thread's join handle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
fbuild resetwas the last mutating device path that bypassed the daemon.cli/reset.rscalledfbuild_deploy::reset::reset_devicein-process (origin/maincrates/fbuild-cli/src/cli/reset.rsL46) and had no--lease-id, so it could toggle DTR/RTS on a board another workflow had leased and was validating — exactly what thePOST /api/resetadmission added in #1864 exists to prevent.Fix
The CLI no longer opens the port. It sends the reset to the daemon, which runs
DeviceManager::admit_operationbeforepreempt_for_deploy, so the bypass cannot recur through this entry point:DaemonClient::device_reset→POST /api/resetwithResetRequest { port, board, lease_id, verbose }(60 s transport ceiling; the daemon keeps its own 10 s hard reset deadline and answers 504).fbuild reset --lease-id <id>added; omitting it on an unleased board behaves exactly as before.ensure_daemon_running(), the same path deploy takes.resolve_port_arg, soser=<USB serial>still resolves at use time),platformio.iniproject/environment resolution, and the board id → platform-specific reset sequence mapping (the daemon runs the samedetect_platform_for_reset).Tests
Three stub-daemon regression tests in
crates/fbuild-cli/src/cli/reset_tests.rs(no hardware, no real daemon), driving the same functionrun_resetcalls:reset_posts_port_board_and_lease_id_to_the_daemon— assertsPOST /api/resetwith the resolved port, the board id and the caller'slease_id.foreign_lease_refusal_surfaces_the_daemon_message— a 409 must surface the holder explanation (leased by client 'other-flow',--lease-id) and must not report a completed reset.unleased_board_resets_without_a_lease_id— an unleased board is admitted and nolease_idfield is sent.Real output:
soldr cargo test -p fbuild-cli --bin fbuild→502 passed; 0 failed; 0 ignored.soldr cargo fmt -p fbuild-cli -- --checkclean.uv run --no-project python ci/enforce_platform_boundary.py --print-totals→rows=0; dylint_rows=0, exit 0.Daemon-side admission was already covered by
handlers/operations/tests.rs::device_lease_admission_tests(competing_deploy_is_refused_at_admission,holder_deploys_and_resets_under_its_own_lease), so the CLI half was the missing link.Not done here
A live-board lease e2e (acquire an exclusive lease on the attached ESP32-C6, reset without the id → refused, reset with it → done) needs a dev daemon plus CLI built from this worktree; it was not run in this tick. #2151 (remaining cell: that live-board check).