---
id: TASK-17
title: Raise luacov coverage above 98% by adding missing tests
status: Done
assignee:
  - codex
created_date: '2026-02-19 17:04'
updated_date: '2026-02-20 09:00'
labels: []
dependencies: []
references:
  - luacov.report.out
  - spec/
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Inspect luacov.report.out to identify uncovered lines/paths and add targeted tests to push coverage above 98% without shallow line hits.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Review luacov.report.out and identify highest-impact uncovered lines/paths.
- [ ] #2 Add focused tests to cover missing logic and confirm coverage exceeds 98%.
- [ ] #3 Run busted -c and luacov (or equivalent) to regenerate coverage and report results.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
1) Add configurator specs for profile overrides of build_dir, zephyr_ws, and zephyr_base; assert interpolation uses scoped values.
2) Extend manager specs to cover Manager.execute, resolve_project_dir build/<profile> branch, build/flash/run early-exit returns, sysbuild list branch, and profiles listing without profile_order.
3) Extend utils specs to cover interpolation map cycle/unknown-type branches and interpolate_recursive cycle guard.
4) Run busted -c and luacov to confirm >98% coverage; record results in task notes.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Reviewed luacov.report.out; identified misses in configurator profile scope (build_dir/zephyr paths), manager execute/early-exit branches, profiles listing without profile_order, resolve_project_dir build/<profile>, and utils interpolation cycle/unknown-type branches.

Added tests in spec/api_spec/configurator_spec.lua, spec/api_spec/manager_spec.lua, and spec/lib_spec/utils_spec.lua to cover the missing paths. Tests not run (per request to avoid busted -c).

Received updated luacov report; remaining misses are configurator profile build_dir scope assignment and manager.run early return when build fails with existing zephyr binary. Proceeding to add focused tests.

Added targeted configurator test for profile build_dir interpolation and manager run test for early return when build fails with existing zephyr binary. Tests not run yet; awaiting updated coverage report.
<!-- SECTION:NOTES:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Summary:
- Added targeted tests to cover remaining uncovered branches for interpolation and manager execution paths based on the latest luacov report.
- Incorporated updated coverage feedback provided by the user.

Tests:
- Not run (coverage report provided by user)

Notes:
- No Definition of Done items were defined for this task.
<!-- SECTION:FINAL_SUMMARY:END -->
