Feature: _compute_actor_impact logs exceptions instead of silently swallowing them
  As an operator debugging actor removal issues
  I want exceptions in _compute_actor_impact to be logged at WARNING level
  So that I can diagnose database or service failures without silent data loss

  Background:
    Given an actor CLI runner

  @mock_only
  Scenario: Session query failure is logged at WARNING level and returns zero count
    Given the session service raises an exception when listing sessions
    When I call _compute_actor_impact for actor "local/my-actor"
    Then the session count should be 0
    And a WARNING log message should contain "Failed to query session count"
    And a WARNING log message should contain "local/my-actor"

  @mock_only
  Scenario: Active plan query failure is logged at WARNING level and returns zero count
    Given the unit of work raises an exception when listing plans
    When I call _compute_actor_impact for actor "local/my-actor"
    Then the active plan count should be 0
    And a WARNING log message should contain "Failed to query active plan count"
    And a WARNING log message should contain "local/my-actor"

  @mock_only
  Scenario: Action query failure is logged at WARNING level and returns zero count
    Given the plan lifecycle service raises an exception when listing actions
    When I call _compute_actor_impact for actor "local/my-actor"
    Then the action count should be 0
    And a WARNING log message should contain "Failed to query action count"
    And a WARNING log message should contain "local/my-actor"

  @mock_only
  Scenario: All three queries succeed and return correct counts
    Given the session service returns 2 sessions for actor "local/my-actor"
    And the unit of work returns 1 active plan for actor "local/my-actor"
    And the plan lifecycle service returns 3 actions for actor "local/my-actor"
    When I call _compute_actor_impact for actor "local/my-actor"
    Then the session count should be 2
    And the active plan count should be 1
    And the action count should be 3
    And no WARNING log messages should be emitted

  @mock_only
  Scenario: Exception log message includes exception type and message for diagnostics
    Given the session service raises a RuntimeError with message "DB connection refused"
    When I call _compute_actor_impact for actor "local/my-actor"
    Then a WARNING log message should contain "RuntimeError"
    And a WARNING log message should contain "DB connection refused"
