test(coverage): add Behave BDD scenarios for 9 under-covered modules #468

Merged
freemo merged 1 commits from feature/m4-unit-test-coverage into master 2026-02-27 19:30:16 +00:00
Owner

Summary

Adds 246 new Behave BDD scenarios (1105 steps) across 9 feature files to improve unit test coverage for modules that were either entirely untested or had significant coverage gaps.

Closes #467

Changes

Feature File Scenarios Target Module Prior Coverage
lock_service_coverage.feature 27 application/services/lock_service.py No data
plan_apply_service_coverage.feature 54 application/services/plan_apply_service.py No data
plan_executor_coverage.feature 51 application/services/plan_executor.py No data
skill_cli_coverage_r3.feature 22 cli/commands/skill.py No data
changeset_repository_coverage.feature 39 infrastructure/database/changeset_repository.py No data
repositories_coverage.feature 20 infrastructure/database/repositories.py 91.98% line, 83.04% branch
sandbox_copy_on_write_coverage.feature 12 infrastructure/sandbox/copy_on_write.py 91.24% line, 85.19% branch
bridge_coverage.feature 8 langgraph/bridge.py 96.73% line, 90.91% branch
plan_cli_coverage.feature 13 cli/commands/plan.py 96.59% line, 92.55% branch

What's Tested

  • Validation branches: argument validation, empty string guards, type checks, range enforcement
  • Error handling paths: database rollback on exceptions, OSError wrapping, CLI error display
  • Edge cases: re-entrant lock acquisition, expired locks, TTL boundaries, empty changesets
  • CLI flows: legacy apply/list/cd commands, skill refresh/remove, plan lifecycle-apply guards
  • Domain conversion: ORM-to-domain mapping with null fields, optional field handling
  • State transitions: sandbox CREATED→ACTIVE→COMMITTED/ROLLED_BACK, plan phase guards

Test Isolation

All step definitions use unique prefixes (e.g., pas_cov, cov2, r3skill-, repos-cov, cowcov) to prevent ambiguous step conflicts with existing test suites. Each scenario is fully self-contained with per-scenario database and cleanup handlers.

## Summary Adds 246 new Behave BDD scenarios (1105 steps) across 9 feature files to improve unit test coverage for modules that were either entirely untested or had significant coverage gaps. Closes #467 ## Changes | Feature File | Scenarios | Target Module | Prior Coverage | |---|---|---|---| | `lock_service_coverage.feature` | 27 | `application/services/lock_service.py` | No data | | `plan_apply_service_coverage.feature` | 54 | `application/services/plan_apply_service.py` | No data | | `plan_executor_coverage.feature` | 51 | `application/services/plan_executor.py` | No data | | `skill_cli_coverage_r3.feature` | 22 | `cli/commands/skill.py` | No data | | `changeset_repository_coverage.feature` | 39 | `infrastructure/database/changeset_repository.py` | No data | | `repositories_coverage.feature` | 20 | `infrastructure/database/repositories.py` | 91.98% line, 83.04% branch | | `sandbox_copy_on_write_coverage.feature` | 12 | `infrastructure/sandbox/copy_on_write.py` | 91.24% line, 85.19% branch | | `bridge_coverage.feature` | 8 | `langgraph/bridge.py` | 96.73% line, 90.91% branch | | `plan_cli_coverage.feature` | 13 | `cli/commands/plan.py` | 96.59% line, 92.55% branch | ## What's Tested - **Validation branches**: argument validation, empty string guards, type checks, range enforcement - **Error handling paths**: database rollback on exceptions, OSError wrapping, CLI error display - **Edge cases**: re-entrant lock acquisition, expired locks, TTL boundaries, empty changesets - **CLI flows**: legacy apply/list/cd commands, skill refresh/remove, plan lifecycle-apply guards - **Domain conversion**: ORM-to-domain mapping with null fields, optional field handling - **State transitions**: sandbox CREATED→ACTIVE→COMMITTED/ROLLED_BACK, plan phase guards ## Test Isolation All step definitions use unique prefixes (e.g., `pas_cov`, `cov2`, `r3skill-`, `repos-cov`, `cowcov`) to prevent ambiguous step conflicts with existing test suites. Each scenario is fully self-contained with per-scenario database and cleanup handlers.
freemo force-pushed feature/m4-unit-test-coverage from 6c2825f889 to c9abb45adf 2026-02-27 18:47:53 +00:00 Compare
freemo scheduled this pull request to auto merge when all checks succeed 2026-02-27 18:52:47 +00:00
freemo merged commit c9abb45adf into master 2026-02-27 19:30:16 +00:00
freemo deleted branch feature/m4-unit-test-coverage 2026-02-27 19:30:16 +00:00
freemo added the
State
Completed
label 2026-03-04 00:41:55 +00:00
Sign in to join this conversation.
No Reviewers
No Label
State
Completed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#468