---
id: TASK-1.3
title: 'Add unit tests for core module (cli, exec, config)'
status: Done
assignee:
  - codex
created_date: '2026-02-23 12:50'
updated_date: '2026-02-23 12:59'
labels:
  - tests
dependencies: []
references:
  - src/core/cli.rs
  - src/core/exec.rs
  - src/core/config.rs
parent_task_id: TASK-1
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Create focused unit tests for core module behaviors: CLI parsing/flags, command execution behavior, and config resolution helpers.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 CLI parsing covers flags, options, subcommands, and defaults using clap parsing helpers.
- [x] #2 Exec module tests cover command formatting and dry-run behavior without executing external commands.
- [x] #3 Core config resolution covers profile selection rules, defaults, and error cases (unknown profile, missing board).
- [x] #4 Tests avoid reliance on main and external services.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
1) Add CLI parsing unit tests in `src/core/cli.rs` using clap’s `try_parse_from` to cover flags/options/subcommands/defaults.
2) Add exec tests in `src/core/exec.rs` for formatting and dry-run behavior without executing external commands.
3) Add core config resolution tests in `src/core/config.rs` for profile selection, defaults, and error cases using in-memory configs.
4) Run `just test`.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Plan approved by user on 2026-02-23.

Added CLI parsing tests in `src/core/cli.rs` for defaults, flags/options, and subcommand args.

Added exec tests in `src/core/exec.rs` for dry-run behavior, spawn failure, and builder fields.

Added core config tests in `src/core/config.rs` for profile selection, defaults, and error cases.

Ran `just test` (nextest) successfully.
<!-- SECTION:NOTES:END -->
