TEST-INFRA: [coverage-gaps] Add comprehensive Behave BDD unit tests for the application module #1828

Open
opened 2026-04-02 23:56:00 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: test/application-module-bdd-coverage
  • Commit Message: test(application): add comprehensive Behave BDD unit tests for application module
  • Milestone: v3.8.0
  • Parent Epic: #376

Background and Context

The src/cleveragents/application module — comprising container.py, reactive_registry_adapter.py, and the entire application/services/ sub-package — is severely under-tested. The current coverage report shows:

  • src.cleveragents.application package: 61.8% overall
    • container.py: 62.5%
    • reactive_registry_adapter.py: 40.0%
  • src.cleveragents.application.services package: 32.6% overall, with many files at 0–25%:
    • plan_lifecycle_service.py: 12.8%
    • plan_service.py: 13.5%
    • resource_registry_service.py: 14.1%
    • repo_indexing_persistence.py: 13.9%
    • uko_loader.py: 0.0%
    • uko_persistence.py: 0.0%
    • validation_apply.py: 0.0%
    • (and 60+ additional services all below 97%)

The project mandates ≥ 97% coverage at all times (CONTRIBUTING.md). The application module is the Application Layer in the Clean Architecture — it houses all service orchestration, ACMS pipeline, plan lifecycle, resource registry, actor/skill/tool services, and the DI container. This gap represents a critical quality risk.

Per CONTRIBUTING.md, all unit-level tests must follow BDD using Behave/Gherkin. No xUnit-style tests are permitted.

Expected Behavior

Every file in src/cleveragents/application/ and src/cleveragents/application/services/ has ≥ 97% line and branch coverage, exercised through Behave feature files with fully implemented step definitions.

Acceptance Criteria

  • All files in src/cleveragents/application/ reach ≥ 97% coverage
  • All files in src/cleveragents/application/services/ reach ≥ 97% coverage
  • All new tests are written as Behave .feature files with Gherkin scenarios
  • All step definitions are fully implemented (no placeholder steps)
  • New step files follow the BDD Test Organization Guidelines (grouped with related steps, named after their feature)
  • All mocks and test doubles live exclusively in features/steps/ — no mock code in production source
  • nox -s unit_tests passes with no failures
  • nox -s coverage_report reports ≥ 97% for the application module
  • No type: ignore or suppression annotations introduced

Supporting Information

Files currently at 0% coverage (highest priority):

  • src/cleveragents/application/services/uko_loader.py
  • src/cleveragents/application/services/uko_persistence.py
  • src/cleveragents/application/services/validation_apply.py

Files with critically low coverage (< 20%):

  • plan_lifecycle_service.py (12.8%), plan_service.py (13.5%), resource_registry_service.py (14.1%), repo_indexing_persistence.py (13.9%), lock_service.py (19.1%), llm_actors.py (19.5%), context_service.py (20.7%), _resource_registry_dag.py (20.7%), uko_indexer.py (20.5%), decision_service.py (20.1%)

Existing partial coverage feature files (extend, do not duplicate):

  • features/application_container_coverage.feature and _boost, _boost_r2, _r3 variants
  • features/reactive_application_coverage.feature and _boost variant
  • Various features/*_service_coverage*.feature files for individual services

Related issues: #1721, #1709 (coverage gaps for __main__.py), #1693 (mock in production container.py)

Subtasks

  • Audit all files in src/cleveragents/application/ and src/cleveragents/application/services/ against the coverage report to identify uncovered lines and branches
  • Extend or create Behave feature files for container.py (target ≥ 97%)
  • Extend or create Behave feature files for reactive_registry_adapter.py (target ≥ 97%)
  • Add Behave scenarios for uko_loader.py, uko_persistence.py, validation_apply.py (currently 0%)
  • Add Behave scenarios for all services with < 20% coverage (plan_lifecycle_service, plan_service, resource_registry_service, repo_indexing_persistence, lock_service, llm_actors, context_service, _resource_registry_dag, uko_indexer, decision_service)
  • Add Behave scenarios for all remaining services with 20–96% coverage until each reaches ≥ 97%
  • Ensure all step definitions are fully implemented with no placeholder steps
  • Run nox -s unit_tests and fix any failures
  • Run nox -s coverage_report and verify application module ≥ 97%
  • Run full nox (all default sessions) and fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • nox -s coverage_report shows ≥ 97% for both src.cleveragents.application and src.cleveragents.application.services packages.
  • All new tests are Behave BDD scenarios with fully implemented step definitions.
  • No mock code exists in production source files.
  • 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.
  • All nox stages pass.
  • Coverage ≥ 97%.

Automated by CleverAgents Bot
Supervisor: Unknown | Agent: ca-new-issue-creator

## Metadata - **Branch**: `test/application-module-bdd-coverage` - **Commit Message**: `test(application): add comprehensive Behave BDD unit tests for application module` - **Milestone**: v3.8.0 - **Parent Epic**: #376 ## Background and Context The `src/cleveragents/application` module — comprising `container.py`, `reactive_registry_adapter.py`, and the entire `application/services/` sub-package — is severely under-tested. The current coverage report shows: - `src.cleveragents.application` package: **61.8%** overall - `container.py`: 62.5% - `reactive_registry_adapter.py`: 40.0% - `src.cleveragents.application.services` package: **32.6%** overall, with many files at 0–25%: - `plan_lifecycle_service.py`: 12.8% - `plan_service.py`: 13.5% - `resource_registry_service.py`: 14.1% - `repo_indexing_persistence.py`: 13.9% - `uko_loader.py`: 0.0% - `uko_persistence.py`: 0.0% - `validation_apply.py`: 0.0% - (and 60+ additional services all below 97%) The project mandates **≥ 97% coverage** at all times (CONTRIBUTING.md). The `application` module is the Application Layer in the Clean Architecture — it houses all service orchestration, ACMS pipeline, plan lifecycle, resource registry, actor/skill/tool services, and the DI container. This gap represents a critical quality risk. Per CONTRIBUTING.md, all unit-level tests must follow BDD using Behave/Gherkin. No xUnit-style tests are permitted. ## Expected Behavior Every file in `src/cleveragents/application/` and `src/cleveragents/application/services/` has ≥ 97% line and branch coverage, exercised through Behave feature files with fully implemented step definitions. ## Acceptance Criteria - [ ] All files in `src/cleveragents/application/` reach ≥ 97% coverage - [ ] All files in `src/cleveragents/application/services/` reach ≥ 97% coverage - [ ] All new tests are written as Behave `.feature` files with Gherkin scenarios - [ ] All step definitions are fully implemented (no placeholder steps) - [ ] New step files follow the BDD Test Organization Guidelines (grouped with related steps, named after their feature) - [ ] All mocks and test doubles live exclusively in `features/steps/` — no mock code in production source - [ ] `nox -s unit_tests` passes with no failures - [ ] `nox -s coverage_report` reports ≥ 97% for the `application` module - [ ] No `type: ignore` or suppression annotations introduced ## Supporting Information Files currently at 0% coverage (highest priority): - `src/cleveragents/application/services/uko_loader.py` - `src/cleveragents/application/services/uko_persistence.py` - `src/cleveragents/application/services/validation_apply.py` Files with critically low coverage (< 20%): - `plan_lifecycle_service.py` (12.8%), `plan_service.py` (13.5%), `resource_registry_service.py` (14.1%), `repo_indexing_persistence.py` (13.9%), `lock_service.py` (19.1%), `llm_actors.py` (19.5%), `context_service.py` (20.7%), `_resource_registry_dag.py` (20.7%), `uko_indexer.py` (20.5%), `decision_service.py` (20.1%) Existing partial coverage feature files (extend, do not duplicate): - `features/application_container_coverage.feature` and `_boost`, `_boost_r2`, `_r3` variants - `features/reactive_application_coverage.feature` and `_boost` variant - Various `features/*_service_coverage*.feature` files for individual services Related issues: #1721, #1709 (coverage gaps for `__main__.py`), #1693 (mock in production `container.py`) ## Subtasks - [ ] Audit all files in `src/cleveragents/application/` and `src/cleveragents/application/services/` against the coverage report to identify uncovered lines and branches - [ ] Extend or create Behave feature files for `container.py` (target ≥ 97%) - [ ] Extend or create Behave feature files for `reactive_registry_adapter.py` (target ≥ 97%) - [ ] Add Behave scenarios for `uko_loader.py`, `uko_persistence.py`, `validation_apply.py` (currently 0%) - [ ] Add Behave scenarios for all services with < 20% coverage (`plan_lifecycle_service`, `plan_service`, `resource_registry_service`, `repo_indexing_persistence`, `lock_service`, `llm_actors`, `context_service`, `_resource_registry_dag`, `uko_indexer`, `decision_service`) - [ ] Add Behave scenarios for all remaining services with 20–96% coverage until each reaches ≥ 97% - [ ] Ensure all step definitions are fully implemented with no placeholder steps - [ ] Run `nox -s unit_tests` and fix any failures - [ ] Run `nox -s coverage_report` and verify `application` module ≥ 97% - [ ] Run full `nox` (all default sessions) and fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - `nox -s coverage_report` shows ≥ 97% for both `src.cleveragents.application` and `src.cleveragents.application.services` packages. - All new tests are Behave BDD scenarios with fully implemented step definitions. - No mock code exists in production source files. - 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. - All nox stages pass. - Coverage ≥ 97%. --- **Automated by CleverAgents Bot** Supervisor: Unknown | Agent: ca-new-issue-creator
freemo added this to the v3.8.0 milestone 2026-04-02 23:57:34 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: MoSCoW/Could Have — CI/test infrastructure improvement.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: MoSCoW/Could Have — CI/test infrastructure improvement. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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.

Blocks
Reference
cleveragents/cleveragents-core#1828
No description provided.