---
id: TASK-36
title: Add config coverage tests for abs_canonical + env-restore branches
status: Done
assignee:
  - codex
created_date: '2026-03-04 22:30'
updated_date: '2026-03-04 22:37'
labels: []
dependencies: []
references:
  - src/core/config.rs
  - /tmp/coverage.txt
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Coverage report shows uncovered lines in `src/core/config.rs` around `abs_canonical` relative-path handling and environment-restore branches in zephyr discovery tests. Add focused unit tests to hit those paths.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Add a test that supplies a relative zephyr workspace path and asserts `discover_zephyr` (or a direct helper test) exercises the `abs_canonical` relative-path branch.
- [x] #2 Add a test that sets an existing `ZEPHYR_BASE` before running `discover_zephyr` so the branch that restores an existing env value is executed.
- [x] #3 Tests live in `src/core/config.rs` and pass under `just check`.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
1) Add a test in src/core/config.rs that sets cfg.zephyr.workspace to a relative path and calls discover_zephyr so the abs_canonical relative-path branch executes (assert returned workspace/base).
2) Add a test that pre-sets ZEPHYR_BASE, runs discover_zephyr, and confirms the env var is restored to the preexisting value afterward.
3) Run just check to confirm.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Added tests for relative workspace path (abs_canonical) and preexisting ZEPHYR_BASE restore. Ran `just check -- -D warnings` (passes).
<!-- SECTION:NOTES:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Added config coverage tests for relative workspace path handling and preexisting ZEPHYR_BASE restore behavior in zephyr discovery. Tests: `just check -- -D warnings`.
<!-- SECTION:FINAL_SUMMARY:END -->
