Files
cleveragents-core/features/actor_exception_handling.feature
HAL9000 ab18e81e4a refactor(actor): add return type to _get_services and remove bare except clauses
- Add return type annotation tuple[Any, Any | None] to _get_services()
- Fix _load_config_text() to catch yaml.YAMLError and TypeError instead
  of ValueError/AttributeError around yaml.safe_load(), preserving the
  user-friendly typer.BadParameter message for malformed YAML input
- Fix _compute_actor_impact() defensive guards to also catch
  CleverAgentsError, OperationalError, and ValidationError in addition
  to AttributeError/RuntimeError, keeping actor removal resilient when
  the database layer is unavailable
- Update CHANGELOG.md with entry under Changed section for issue #8567
- Add features/actor_exception_handling.feature with four Behave scenarios
  covering the exception handling contract changes
- Add features/steps/actor_exception_handling_steps.py with step definitions

ISSUES CLOSED: #8567
2026-06-02 08:44:47 -04:00

33 lines
1.5 KiB
Gherkin

Feature: Actor CLI exception handling contracts
As a developer maintaining the actor CLI module
I want the exception handling in _load_config_text and _compute_actor_impact to be correct
So that malformed YAML produces user-friendly errors and actor removal stays resilient
Background:
Given an actor CLI runner
# --- _load_config_text: yaml.YAMLError is caught and converted to BadParameter ---
Scenario: Malformed YAML config produces a user-friendly error
Given I have a malformed YAML actor config file
When I run actor add with that config
Then the actor command should fail with bad parameter
# --- _compute_actor_impact: CleverAgentsError is caught defensively ---
Scenario: _compute_actor_impact returns zero counts when session service raises CleverAgentsError
When I call _compute_actor_impact with a session service that raises CleverAgentsError
Then the impact result should be zero counts
# --- _compute_actor_impact: OperationalError is caught defensively ---
Scenario: _compute_actor_impact returns zero counts when session service raises OperationalError
When I call _compute_actor_impact with a session service that raises OperationalError
Then the impact result should be zero counts
# --- _compute_actor_impact: ValidationError is caught defensively ---
Scenario: _compute_actor_impact returns zero counts when session service raises ValidationError
When I call _compute_actor_impact with a session service that raises ValidationError
Then the impact result should be zero counts