Files
cleveragents-core/features/db_repositories_coverage_boost.feature
freemo 051ee7c290
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 31s
CI / typecheck (pull_request) Successful in 47s
CI / security (pull_request) Successful in 52s
CI / build (pull_request) Successful in 56s
CI / e2e_tests (pull_request) Successful in 5m1s
CI / integration_tests (pull_request) Successful in 5m30s
CI / unit_tests (pull_request) Successful in 5m42s
CI / docker (pull_request) Successful in 58s
CI / coverage (pull_request) Successful in 7m35s
CI / build (push) Successful in 21s
CI / docker (push) Has been skipped
CI / benchmark-regression (pull_request) Failing after 49m24s
CI / lint (push) Successful in 22s
CI / quality (push) Successful in 39s
CI / security (push) Successful in 48s
CI / typecheck (push) Successful in 1m26s
CI / benchmark-regression (push) Has been skipped
CI / e2e_tests (push) Successful in 5m53s
CI / coverage (push) Successful in 9m4s
CI / benchmark-publish (push) Successful in 19m10s
CI / integration_tests (push) Failing after 19m18s
CI / unit_tests (push) Failing after 19m20s
test(coverage): add Behave BDD tests to improve coverage across 52 source files
Added 52 new .feature files and corresponding _steps.py files targeting
previously uncovered code paths in the following areas:

- TUI layer: app, commands, persona (state/schema/registry), widgets,
  input (shell_exec, reference_parser)
- Application services: plan lifecycle/service/executor, session,
  project, repo indexing, correction, checkpoint, actor, llm_actors,
  strategy coordinator, resource file watcher, service retry wiring
- CLI commands: session, resource, repl, plan, db, automation_profile
- Domain models: retry_policy, resource_type, cost_budget,
  docker_compose_analyzer, detail_level, _sql_string_aware,
  _postgresql_helpers
- Core: circuit_breaker, retry_service_patterns
- Infrastructure: repositories, transaction_sandbox, strategy_registry,
  plugins/loader, container
- Config: settings
- Agents: plan_generation, context_analysis, auto_debug
- A2A: facade

All new tests follow the Behave/Gherkin BDD standard. Resolved step
definition collisions with unique prefixes. Fixed Alembic fileConfig
logger disabling issue (disable_existing_loggers=False).

ISSUES CLOSED: #1068
2026-03-20 21:22:10 +00:00

116 lines
6.4 KiB
Gherkin
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@phase1 @domain @repository @coverage_boost
Feature: Database repositories coverage boost for uncovered branches
As a developer ensuring high test coverage
I want to exercise previously uncovered code paths in repositories.py
So that persistence-layer branch coverage improves
Background:
Given a fresh in-memory database for repo coverage boost
And an action repository for coverage boost
And a lifecycle plan repository for coverage boost
And a resource type repository for coverage boost
# ---------------------------------------------------------------------------
# ActionRepository.update arg_type/requirement as plain strings (lines 1080, 1083)
# ---------------------------------------------------------------------------
@action_update @string_enums
Scenario: Updating an action with plain-string arg_type and requirement hits else branches
Given a valid action named "local/string-enum-action" for coverage boost
And the action is persisted for coverage boost
When the action arguments are replaced with plain-string arg_type and requirement
And the action is updated for coverage boost
Then the update should succeed for coverage boost
And the retrieved action should have the string-typed arguments
# ---------------------------------------------------------------------------
# LifecyclePlanRepository.update automation_profile truthy (line 1340)
# ---------------------------------------------------------------------------
@plan_update @automation_profile
Scenario: Updating a plan with a truthy automation_profile serializes it
Given a valid action named "local/auto-profile-action" for coverage boost
And the action is persisted for coverage boost
And a lifecycle plan linked to "local/auto-profile-action" with automation profile
And the lifecycle plan is persisted for coverage boost
When the plan automation profile is updated to a new profile ref
And the lifecycle plan is updated for coverage boost
Then the plan update should succeed for coverage boost
And the retrieved plan should have the automation profile set
# ---------------------------------------------------------------------------
# LifecyclePlanRepository.update validation_summary not None (line 1357)
# ---------------------------------------------------------------------------
@plan_update @validation_summary
Scenario: Updating a plan with validation_summary serializes it to JSON
Given a valid action named "local/val-summary-action" for coverage boost
And the action is persisted for coverage boost
And a lifecycle plan linked to "local/val-summary-action" with validation summary
And the lifecycle plan is persisted for coverage boost
When the plan validation summary is set to a non-None value
And the lifecycle plan is updated for coverage boost
Then the plan update should succeed for coverage boost
And the retrieved plan should have the validation summary
# ---------------------------------------------------------------------------
# LifecyclePlanRepository.update execution_env_priority not None (line 1367)
# ---------------------------------------------------------------------------
@plan_update @execution_env
Scenario: Updating a plan with execution_env_priority serializes its value
Given a valid action named "local/env-priority-action" for coverage boost
And the action is persisted for coverage boost
And a lifecycle plan linked to "local/env-priority-action" with env priority
And the lifecycle plan is persisted for coverage boost
When the plan execution env priority is set
And the lifecycle plan is updated for coverage boost
Then the plan update should succeed for coverage boost
And the retrieved plan should have execution env priority set
# ---------------------------------------------------------------------------
# LifecyclePlanRepository.list_all DatabaseError branch (lines 1472-1473)
# ---------------------------------------------------------------------------
@plan_list @error_handling
Scenario: list_all raises DatabaseError on OperationalError
Given a lifecycle plan repository with a broken session factory
When list_all is called on the broken plan repository
Then a DatabaseError mentioning "Failed to list plans" should be raised for coverage boost
# ---------------------------------------------------------------------------
# ResourceTypeRepository.create name with "/" namespace extraction (line 1730)
# and plain-string resource_kind (line 1734) and sandbox_strategy (line 1737)
# ---------------------------------------------------------------------------
@resource_type @create @namespaced
Scenario: Creating a resource type with namespaced name and string enums
Given a resource type spec with namespaced name "custom/my-db-type" and string enums
When the resource type is created for coverage boost
Then the resource type creation should succeed for coverage boost
And the retrieved resource type should have namespace "custom"
# ---------------------------------------------------------------------------
# ResourceTypeRepository.update plain-string resource_kind (line 1857)
# and sandbox_strategy (line 1862) and cli_args serialization (lines 1867-1872)
# ---------------------------------------------------------------------------
@resource_type @update @string_enums
Scenario: Updating a resource type with string enums and cli_args
Given a resource type spec with name "custom/updatable-type" and string enums
And the resource type is persisted for coverage boost
When the resource type is updated with new description and cli_args
Then the resource type update should succeed for coverage boost
And the retrieved resource type should have updated cli_args
# ---------------------------------------------------------------------------
# ResourceTypeRepository.create builtin name without "/" (line 1730 else)
# ---------------------------------------------------------------------------
@resource_type @create @builtin
Scenario: Creating a resource type with builtin name uses "builtin" namespace
Given a resource type spec with builtin name "test-builtin-type" and string enums
When the resource type is created for coverage boost
Then the resource type creation should succeed for coverage boost
And the retrieved builtin resource type should have namespace "builtin"