Improve unit test coverage for under-tested service, CLI, and database modules #418

Closed
opened 2026-02-24 16:18:02 +00:00 by freemo · 0 comments
Owner

Metadata

  • Commit Message: test(coverage): add Behave scenarios for under-tested modules
  • Branch: test/improve-coverage

Background and Context

Several core modules had low or zero unit test coverage, creating gaps in regression safety. Specifically, four service/CLI modules had 0% coverage (config_service.py, correction_service.py, resource_handler_service.py, repl.py), and five additional modules had minor coverage gaps on specific branches or error-handling paths (plan_executor.py, plan_lifecycle_service.py, plan.py, skill.py, models.py). Increasing coverage on these modules strengthens the project's overall test safety net and moves closer to the 97% merge-gate threshold.

Expected Behavior

All nine target modules should have Behave scenarios exercising their previously uncovered lines and branches. All new and existing tests should pass (nox -e unit_tests).

Acceptance Criteria

  • config_service.py has new Behave scenarios covering its public API
  • correction_service.py has new Behave scenarios covering its public API
  • resource_handler_service.py has new Behave scenarios covering its public API
  • repl.py has new Behave scenarios covering its public API
  • plan_executor.py uncovered lines (144, 225, 233–235, 273, 483, 490) are exercised
  • plan_lifecycle_service.py uncovered lines (340–341, 376–380) are exercised
  • plan.py (CLI) uncovered lines (1817–1888 cancel/revert paths) are exercised
  • skill.py (CLI) uncovered lines (273, 343–344, 353, 393, 589–594) are exercised
  • models.py (DB) uncovered lines (1666, 1921, 2131–2132) are exercised
  • All existing tests continue to pass (nox -e unit_tests green)
  • No production source code is modified

Subtasks

  • Run nox -e coverage_report and extract coverage data for all 9 target files
  • Write Behave feature + step files for config_service.py
  • Write Behave feature + step files for correction_service.py
  • Write Behave feature + step files for resource_handler_service.py
  • Write Behave feature + step files for repl.py
  • Write Behave feature + step files for plan_executor.py (targeting uncovered lines)
  • Write Behave feature + step files for plan_lifecycle_service.py (targeting uncovered lines)
  • Write Behave feature + step files for plan.py CLI (targeting cancel/revert paths)
  • Write Behave feature + step files for skill.py CLI (targeting uncovered branches)
  • Write Behave feature + step files for models.py DB (targeting uncovered lines)
  • Run nox -e unit_tests — all 274 features, 5746 scenarios, 24906 steps pass
  • Verify coverage >=97% via nox -e coverage_report

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
## Metadata - **Commit Message**: `test(coverage): add Behave scenarios for under-tested modules` - **Branch**: `test/improve-coverage` ## Background and Context Several core modules had low or zero unit test coverage, creating gaps in regression safety. Specifically, four service/CLI modules had 0% coverage (`config_service.py`, `correction_service.py`, `resource_handler_service.py`, `repl.py`), and five additional modules had minor coverage gaps on specific branches or error-handling paths (`plan_executor.py`, `plan_lifecycle_service.py`, `plan.py`, `skill.py`, `models.py`). Increasing coverage on these modules strengthens the project's overall test safety net and moves closer to the 97% merge-gate threshold. ## Expected Behavior All nine target modules should have Behave scenarios exercising their previously uncovered lines and branches. All new and existing tests should pass (`nox -e unit_tests`). ## Acceptance Criteria - [ ] `config_service.py` has new Behave scenarios covering its public API - [ ] `correction_service.py` has new Behave scenarios covering its public API - [ ] `resource_handler_service.py` has new Behave scenarios covering its public API - [ ] `repl.py` has new Behave scenarios covering its public API - [ ] `plan_executor.py` uncovered lines (144, 225, 233–235, 273, 483, 490) are exercised - [ ] `plan_lifecycle_service.py` uncovered lines (340–341, 376–380) are exercised - [ ] `plan.py` (CLI) uncovered lines (1817–1888 cancel/revert paths) are exercised - [ ] `skill.py` (CLI) uncovered lines (273, 343–344, 353, 393, 589–594) are exercised - [ ] `models.py` (DB) uncovered lines (1666, 1921, 2131–2132) are exercised - [ ] All existing tests continue to pass (`nox -e unit_tests` green) - [ ] No production source code is modified ## Subtasks - [x] Run `nox -e coverage_report` and extract coverage data for all 9 target files - [x] Write Behave feature + step files for `config_service.py` - [x] Write Behave feature + step files for `correction_service.py` - [x] Write Behave feature + step files for `resource_handler_service.py` - [x] Write Behave feature + step files for `repl.py` - [x] Write Behave feature + step files for `plan_executor.py` (targeting uncovered lines) - [x] Write Behave feature + step files for `plan_lifecycle_service.py` (targeting uncovered lines) - [x] Write Behave feature + step files for `plan.py` CLI (targeting cancel/revert paths) - [x] Write Behave feature + step files for `skill.py` CLI (targeting uncovered branches) - [x] Write Behave feature + step files for `models.py` DB (targeting uncovered lines) - [x] Run `nox -e unit_tests` — all 274 features, 5746 scenarios, 24906 steps pass - [x] Verify coverage >=97% via `nox -e coverage_report` ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done.
freemo added this to the v3.1.0 milestone 2026-02-24 16:18:38 +00:00
freemo self-assigned this 2026-02-24 17:57:37 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#418
No description provided.