Improve BDD unit test coverage for 9 under-covered modules #467

Closed
opened 2026-02-27 18:36:44 +00:00 by freemo · 0 comments
Owner

Metadata

  • Commit Message: test(coverage): add Behave BDD scenarios for 9 under-covered modules
  • Branch: feature/m4-unit-test-coverage

Background and Context

The current test coverage report (build/coverage.xml) shows several modules that either have no coverage data at all (not exercised during unit tests) or have significant uncovered lines and branches. The project enforces a 97% coverage threshold, and improving coverage on these specific modules strengthens the overall test suite.

Expected Behavior

All targeted modules should have comprehensive Behave BDD scenarios covering their uncovered code paths, error handling branches, and edge cases.

Acceptance Criteria

  • New Behave .feature files and corresponding _steps.py files are created for each of the 9 target modules
  • All new tests follow the project's Behave BDD conventions (Gherkin syntax, step naming, type annotations, assertions)
  • All new tests pass when run via nox -e unit_tests
  • No existing tests are broken by the new additions
  • Step definitions use unique prefixes to avoid ambiguous step conflicts

Target Modules

  1. src/cleveragents/application/services/lock_service.py — No prior coverage data
  2. src/cleveragents/application/services/plan_apply_service.py — No prior coverage data
  3. src/cleveragents/application/services/plan_executor.py — No prior coverage data
  4. src/cleveragents/cli/commands/skill.py — No prior coverage data
  5. src/cleveragents/infrastructure/database/changeset_repository.py — No prior coverage data
  6. src/cleveragents/infrastructure/database/repositories.py — 91.98% line, 83.04% branch
  7. src/cleveragents/infrastructure/sandbox/copy_on_write.py — 91.24% line, 85.19% branch (substituted for non-existent checkpoint.py)
  8. src/cleveragents/langgraph/bridge.py — 96.73% line, 90.91% branch
  9. src/cleveragents/cli/commands/plan.py — 96.59% line, 92.55% branch

Subtasks

  • Create lock_service_coverage.feature + steps (27 scenarios)
  • Create plan_apply_service_coverage.feature + steps (54 scenarios)
  • Create plan_executor_coverage.feature + steps (51 scenarios)
  • Create skill_cli_coverage_r3.feature + steps (22 scenarios)
  • Create changeset_repository_coverage.feature + steps (39 scenarios)
  • Create repositories_coverage.feature + steps (20 scenarios)
  • Create sandbox_copy_on_write_coverage.feature + steps (12 scenarios)
  • Create bridge_coverage.feature + steps (8 scenarios)
  • Create plan_cli_coverage.feature + steps (13 scenarios)
  • Verify all 246 scenarios pass (9 features, 1105 steps)

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 BDD scenarios for 9 under-covered modules` - **Branch**: `feature/m4-unit-test-coverage` ## Background and Context The current test coverage report (`build/coverage.xml`) shows several modules that either have no coverage data at all (not exercised during unit tests) or have significant uncovered lines and branches. The project enforces a 97% coverage threshold, and improving coverage on these specific modules strengthens the overall test suite. ## Expected Behavior All targeted modules should have comprehensive Behave BDD scenarios covering their uncovered code paths, error handling branches, and edge cases. ## Acceptance Criteria - [ ] New Behave `.feature` files and corresponding `_steps.py` files are created for each of the 9 target modules - [ ] All new tests follow the project's Behave BDD conventions (Gherkin syntax, step naming, type annotations, assertions) - [ ] All new tests pass when run via `nox -e unit_tests` - [ ] No existing tests are broken by the new additions - [ ] Step definitions use unique prefixes to avoid ambiguous step conflicts ## Target Modules 1. `src/cleveragents/application/services/lock_service.py` — No prior coverage data 2. `src/cleveragents/application/services/plan_apply_service.py` — No prior coverage data 3. `src/cleveragents/application/services/plan_executor.py` — No prior coverage data 4. `src/cleveragents/cli/commands/skill.py` — No prior coverage data 5. `src/cleveragents/infrastructure/database/changeset_repository.py` — No prior coverage data 6. `src/cleveragents/infrastructure/database/repositories.py` — 91.98% line, 83.04% branch 7. `src/cleveragents/infrastructure/sandbox/copy_on_write.py` — 91.24% line, 85.19% branch (substituted for non-existent `checkpoint.py`) 8. `src/cleveragents/langgraph/bridge.py` — 96.73% line, 90.91% branch 9. `src/cleveragents/cli/commands/plan.py` — 96.59% line, 92.55% branch ## Subtasks - [x] Create `lock_service_coverage.feature` + steps (27 scenarios) - [x] Create `plan_apply_service_coverage.feature` + steps (54 scenarios) - [x] Create `plan_executor_coverage.feature` + steps (51 scenarios) - [x] Create `skill_cli_coverage_r3.feature` + steps (22 scenarios) - [x] Create `changeset_repository_coverage.feature` + steps (39 scenarios) - [x] Create `repositories_coverage.feature` + steps (20 scenarios) - [x] Create `sandbox_copy_on_write_coverage.feature` + steps (12 scenarios) - [x] Create `bridge_coverage.feature` + steps (8 scenarios) - [x] Create `plan_cli_coverage.feature` + steps (13 scenarios) - [x] Verify all 246 scenarios pass (9 features, 1105 steps) ## 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 the
State
Completed
label 2026-03-04 00:41:56 +00:00
Sign in to join this conversation.
No Label
State
Completed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#467