---
id: TASK-33
title: >-
  Add unit tests for zephyr workspace resolution and workspace command error
  handling
status: Done
assignee:
  - codex
created_date: '2026-03-04 22:17'
updated_date: '2026-03-04 22:24'
labels: []
dependencies: []
references:
  - src/core/config.rs
  - src/core/cmd.rs
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Workspace management relies on resolved config fields (zephyr_ws/url/manifest) and has error handling for conflicts and missing workspace. Add unit tests to cover resolution mapping and command-level validation paths without invoking external `west`.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Add config-resolution tests that verify `resolve_single` maps `zephyr.url` and `zephyr.manifest` from config into `ResolvedConfig.zephyr_url` and `ResolvedConfig.zephyr_manifest`.
- [x] #2 Add cmd tests that verify `cmd_workspace` returns an error when both `zephyr_url` and `zephyr_manifest` are set.
- [x] #3 Add cmd tests that verify `cmd_workspace` returns an error when `zephyr_ws` is not resolved (None).
- [x] #4 Add a positive-path cmd test that runs `cmd_workspace` for at least one subcommand (e.g., `Update` or `Export`) with `Runner { dry_run: true }` and a temp workspace to ensure it succeeds without requiring external `west`.
- [x] #5 Tests live in `src/core/config.rs` and `src/core/cmd.rs` and pass under `just check`.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
1) Add resolve_single tests in src/core/config.rs to ensure zephyr.url and zephyr.manifest propagate into ResolvedConfig fields.
2) Add cmd_workspace error-path tests in src/core/cmd.rs for conflicting url+manifest and missing zephyr_ws.
3) Add a positive-path cmd_workspace test using Runner { dry_run: true } and a temp .west workspace (e.g., Update) so no external west is required.
4) Run just check to confirm.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Added resolve_single test for zephyr url/manifest propagation, workspace cmd error tests for conflict/missing ws, and a dry-run update success test. Ran `just check -- -D warnings` (passes).
<!-- SECTION:NOTES:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Added config resolution test for zephyr url/manifest propagation and cmd workspace tests for conflicting config, missing workspace, and a dry-run update success path. Tests: `just check -- -D warnings`.
<!-- SECTION:FINAL_SUMMARY:END -->
