Files
cleveragents-core/features/tui_persona_registry_coverage.feature
freemo 051ee7c290 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

57 lines
2.8 KiB
Gherkin

Feature: TUI persona registry coverage
Additional scenarios that exercise previously uncovered code paths
in the PersonaRegistry class (registry.py).
Background:
Given a fresh temporary persona registry
Scenario: persona_path rejects name that resolves outside personas directory
When I call persona_path with a path-traversal name bypassing validation
Then persona_path should raise ValueError with "Invalid persona name"
Scenario: list_personas skips files with non-dict YAML content
Given I create a persona YAML file "notadict" with content that parses to a list
And I save a valid registry persona "keeper" with actor "local/mock-actor"
When I list all registry personas
Then the registry persona list should contain "keeper"
And the registry persona list should not contain "notadict"
Scenario: get returns None for persona file with non-dict YAML content
Given I create a persona YAML file "badformat" with content that parses to a string
When I get persona "badformat" from the registry
Then the get result should be None
Scenario: validate_cycle_order skips self when checking duplicates
Given I save a valid registry persona "alpha" with actor "local/mock-actor" and cycle order 2
When I re-save registry persona "alpha" with actor "local/mock-actor" and cycle order 2
Then the re-save should succeed without error
Scenario: delete returns False for non-existent persona
When I delete persona "ghost" from the registry
Then tprcov the delete result should be False
Scenario: export_persona raises ValueError for non-existent persona
When I export persona "nonexistent" to "out.yaml"
Then the export should raise ValueError with "Persona not found"
Scenario: export_persona writes file for existing persona
Given I save a valid registry persona "exportable" with actor "local/mock-actor"
When I export persona "exportable" to a valid relative path
Then the exported file should exist and contain persona data
Scenario: import_persona reads file and saves persona to registry
Given I create a valid persona YAML file at a relative path for import
When I import a persona from the relative path
Then the imported persona should be saved in the registry
And the imported persona name should be "imported-test"
Scenario: import_persona raises ValueError for non-dict YAML file
Given I create a non-dict YAML file at a relative path for import
When I import a persona from the non-dict file
Then the import should raise ValueError with "Invalid persona file"
Scenario: load_state returns empty dict when state file has non-dict YAML
Given I write non-dict YAML to the state file
When I load registry state
Then the loaded state should be an empty dict