Skip to content

dotbot/cli: add --local-root to the device flash commands - #280

Merged
geonnave merged 2 commits into
DotBots:developfrom
geonnave:device-flash-local-root
Jul 27, 2026
Merged

dotbot/cli: add --local-root to the device flash commands#280
geonnave merged 2 commits into
DotBots:developfrom
geonnave:device-flash-local-root

Conversation

@geonnave

Copy link
Copy Markdown
Contributor

What

dotbot device flash-swarmit-sandbox and flash-mari-gateway gain --local-root, and every -f local flash now prints where each image actually came from.

Why

-f local reads ~/.dotbot/artifacts/swarmit-local/, a directory of symlinks into a build tree. Two problems in practice:

  1. You cannot say which tree. The links are set by a separate dotbot fw fetch -S swarmit -f local --local-root <path> run, possibly days earlier. Working out of a git worktree, the obvious command (flash-swarmit-sandbox -f local --local-root <worktree>) was rejected with "No such option".
  2. You cannot see which tree. The flash echoed the symlink path, not its target, so a link left pointing at a stale tree flashed silently. This actually happened here: the bootloader and netcore links pointed at a worktree while the two gateway links still pointed at another checkout with a build two months old.

Changes

  • --local-root on both role-flash commands, passed through to flash_role, which re-links before flashing. Same flag name as dotbot fw fetch, so this is the existing two-step collapsed into one. Rejected with a clear message when --fw-version is not local, checked before the J-Link probe so it fails instantly.
  • describe_image() resolves a symlinked image and appends the target plus its build timestamp:
[INFO] app hex: /Users/x/.dotbot/artifacts/swarmit-local/bootloader-dotbot-v3.hex
              -> /path/to/tree/device/bootloader/Output/dotbot-v3/Debug/Exe/bootloader-dotbot-v3.hex (built 2026-07-20 16:22)

A dangling link reports (BROKEN LINK) instead of the previous bare missing-file error.

Not done

_link_local_assets still maps all four assets from one root and fails if any is missing, so pointing --local-root at a tree that only builds the device images (no mari gateway) errors out. Linking per-role would fix that; it is a separate change.

Test

pytest dotbot/tests/test_device.py dotbot/tests/test_cli_deployment_fetch.py - 49 pass. Full pre-commit run --all-files clean. Exercised against real hardware artifacts: provenance output verified on live symlinks, guard verified to reject --local-root without -f local.

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.50%. Comparing base (6f11e9c) to head (0df33ae).
⚠️ Report is 24 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #280      +/-   ##
===========================================
+ Coverage    83.27%   83.50%   +0.23%     
===========================================
  Files          119      121       +2     
  Lines        11120    11237     +117     
  Branches       570      570              
===========================================
+ Hits          9260     9384     +124     
+ Misses        1857     1850       -7     
  Partials         3        3              
Files with missing lines Coverage Δ
dotbot/cli/device.py 84.21% <100.00%> (+0.69%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@geonnave
geonnave merged commit bd8be0a into DotBots:develop Jul 27, 2026
14 checks passed
@geonnave
geonnave deleted the device-flash-local-root branch July 27, 2026 12:05
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