---
id: TASK-15
title: Add unit tests for cmd_flash
status: Done
assignee:
  - codex
created_date: '2026-02-26 22:59'
updated_date: '2026-02-26 23:01'
labels: []
dependencies: []
references:
  - src/core/cmd.rs
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Add unit tests to cover `cmd_flash` behavior and edge cases without changing CLI behavior.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Unit tests cover `cmd_flash` success path and argument handling without requiring external tools.
- [x] #2 Tests are hermetic and pass with `just test`.
- [x] #3 No CLI/config behavior changes.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
Plan:
1) Add unit tests in `src/core/cmd.rs` to cover `cmd_flash` with and without an explicit runner, using `Runner { dry_run: true }` to avoid external tools.
2) Ensure `ensure_built` is exercised via `cmd_flash` with minimal temp build dir setup.
3) Run `just test` to confirm.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Added cmd_flash unit tests for runner/no-runner success and non-sysbuild list error. Updated calls for the latest `cmd_flash` signature. `just test` passes (66 tests).
<!-- SECTION:NOTES:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Added unit tests covering `cmd_flash` success with and without a runner, plus list error behavior for non-sysbuild projects. Tests are hermetic and pass.

Tests: `just test`
<!-- SECTION:FINAL_SUMMARY:END -->
