Files
cleveragents-core/features/decomposition_service_coverage_boost.feature
freemo a808c395f9
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 35s
CI / security (pull_request) Successful in 50s
CI / unit_tests (pull_request) Successful in 2m46s
CI / integration_tests (pull_request) Successful in 3m16s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m6s
CI / lint (push) Successful in 13s
CI / quality (push) Successful in 16s
CI / build (push) Successful in 18s
CI / security (push) Successful in 32s
CI / typecheck (push) Successful in 35s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m52s
CI / integration_tests (push) Successful in 3m8s
CI / docker (push) Successful in 39s
CI / coverage (push) Successful in 5m53s
CI / benchmark-publish (push) Successful in 16m55s
CI / benchmark-regression (pull_request) Successful in 33m0s
test(coverage): add Behave BDD tests to improve unit test coverage across 53 source modules
Add 53 new .feature files and corresponding step definition files targeting
uncovered lines identified in build/coverage.xml. Fix AmbiguousStep conflicts
in 7 pre-existing step files by disambiguating step text.

New tests cover: ACP clients/facade, actor CLI/config, application container,
ACMS service/strategies, async worker, automation profile CLI, autonomy
guardrail, bridge, change model, config CLI/service, context service,
cross-plan correction, database models, decision service, decomposition
clustering/service, discovery handler, langchain chat provider, langgraph
nodes, materializers, multi-project service, plan apply/CLI/lifecycle/model/
preflight/resume/service, PostgreSQL analyzer, project CLI/context CLI,
provider registry, reactive application/route, repositories, resolver handler,
resource registry service, resume model, retry patterns, sandbox protocol,
server CLI, skill CLI/service, skills registry, subplan execution/service,
system CLI, UKO loader, UoW, and YAML template engine.

Closes #645
2026-03-09 13:01:58 -04:00

59 lines
2.8 KiB
Gherkin

Feature: DecompositionService uncovered code path coverage
As a developer
I want to exercise the uncovered branches in decomposition_service.py
So that clustering fallback chains and decision recording edge cases are tested
Background:
Given a fresh decomposition service instance
# --- Lines 236-239: Language clustering fallback ---
# When cluster_by_directory returns a single cluster, the service
# should fall through to cluster_by_language.
Scenario: Falls back to language clustering when directory clustering yields one cluster
Given a file set that directory-clusters into one group but language-clusters into many
When I run decomposition on those files
Then at least one node should use the language clustering strategy
# --- Lines 242-245: Size clustering fallback ---
# When both directory and language clustering return a single cluster,
# the service should fall through to cluster_by_size.
Scenario: Falls back to size clustering when directory and language clustering both yield one cluster
Given a file set where directory and language clustering each yield one group
When I run decomposition on those files
Then at least one node should use the size clustering strategy
# --- Lines 249-264: Complete fallback with warning ---
# When ALL clustering strategies produce zero clusters, the service
# emits a warning log and creates a single FALLBACK node.
Scenario: Creates fallback node with warning when all clustering strategies return empty
Given a file set where all clustering strategies return empty lists
When I run decomposition on those files
Then the result should contain a fallback strategy node
And a decomposition fallback warning should have been logged
# --- Line 320: record_decisions early return when decision_service is None ---
Scenario: record_decisions returns immediately when no decision service is injected
Given a decomposition service without a decision service
And a trivial decomposition result
When I call record_decisions with plan id "plan-00001"
Then no exception should be raised from record_decisions
# --- Combined: language fallback produces correct strategy label ---
Scenario: Language fallback strategy label appears in result metrics
Given a file set that directory-clusters into one group but language-clusters into many
When I run decomposition on those files and collect metrics
Then the result total_nodes metric should be present
And the result leaf_nodes metric should be present
# --- Combined: size fallback with deep recursion is bounded by max_depth ---
Scenario: Size clustering fallback respects max_depth limit
Given a file set where directory and language clustering each yield one group
When I run decomposition with max_depth 1 on those files
Then the result max_depth_reached should be at most 1