---
id: TASK-2.1
title: Improve coverage for core/config resolution paths
status: Done
assignee:
  - codex
created_date: '2026-02-23 13:34'
updated_date: '2026-02-23 13:37'
labels:
  - tests
  - coverage
dependencies: []
references:
  - src/core/config.rs
parent_task_id: TASK-2
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Add unit tests to cover missing branches/lines in `src/core/config.rs`, focusing on profile selection, sysbuild detection, and Zephyr discovery paths.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Coverage increases for core config resolution paths (selection logic, sysbuild, Zephyr discovery).
- [x] #2 Tests use controlled filesystem state (temp dirs) for sysbuild/Zephyr path detection.
- [x] #3 All tests are behavior-driven and avoid shallow line hits.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
1) Review `src/core/config.rs` to identify untested branches (sysbuild detection, Zephyr discovery, profile/arg edge cases).
2) Add unit tests using temp dirs to exercise sysbuild detection, discover_zephyr paths (explicit config, ZEPHYR_BASE env, .west workspace discovery, fallback), and related selection/arg merges.
3) Run `just test` and then `just coverage` to confirm improvement.
<!-- SECTION:PLAN:END -->

## Implementation Notes

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

Added tests for sysbuild detection and Zephyr discovery paths (explicit config, ZEPHYR_BASE env, workspace discovery, none) using temp dirs in `src/core/config.rs`.

Ran `just test` and `just coverage`. Core config coverage increased to ~85% regions/lines; overall coverage is ~84% due to main.rs and other modules.
<!-- SECTION:NOTES:END -->
