Feature: Plan Preflight Guardrail — coverage boost for uncovered branches
  As a developer
  I want thorough test coverage of the plan preflight guardrail
  So that all code paths are validated, including repr, format_report, and edge cases

  # Target: lines 52-53 — PreflightCheckResult.__repr__ for a passing result
  Scenario: PreflightCheckResult repr shows PASS for a passing check
    Given a passing PreflightCheckResult for action_schema_validation
    When I get the repr of the check result
    Then the repr should contain "PASS"
    And the repr should contain "action_schema_validation"

  # Target: lines 52-53 — PreflightCheckResult.__repr__ for a failing result
  Scenario: PreflightCheckResult repr shows FAIL for a failing check
    Given a failing PreflightCheckResult for actor_availability with message "missing roles"
    When I get the repr of the check result
    Then the repr should contain "FAIL"
    And the repr should contain "missing roles"

  # Target: lines 86-90 — PreflightReport.format_report with mixed results
  Scenario: PreflightReport format_report renders a human-readable summary with mixed results
    Given a PreflightReport with one passing and one failing check result
    When I format the report
    Then the formatted report should start with "Pre-flight Guardrail Report:"
    And the formatted report should contain a PASS line
    And the formatted report should contain a FAIL line

  # Target: lines 86-90 — PreflightReport.format_report with all passing results
  Scenario: PreflightReport format_report renders correctly when all checks pass
    Given a PreflightReport with only passing check results
    When I format the report
    Then the formatted report should start with "Pre-flight Guardrail Report:"
    And the formatted report should not contain "[FAIL]"

  # Target: lines 166-169 — check_action_schema when action_name is None
  Scenario: Action schema check fails when no action name is provided
    Given a fresh plan preflight guardrail instance
    When I check action schema with no action name
    Then the action schema check should fail
    And the action schema check message should contain "No action specified"

  # Target: line 221 — check_skill_tool_existence with missing skills only
  Scenario: Skill/tool existence check fails when skills are missing from registry
    Given a fresh plan preflight guardrail instance
    And a skill registry containing only "data-transform"
    When I check skill/tool existence for skills "data-transform,missing-skill"
    Then the skill tool check should fail
    And the skill tool check message should contain "Missing skills"
    And the skill tool check message should contain "missing-skill"

  # Target: line 221 — both missing tools AND missing skills in the same call
  Scenario: Skill/tool existence check reports both missing tools and missing skills
    Given a fresh plan preflight guardrail instance
    When I check skill/tool existence for tools "absent-tool" and skills "absent-skill" with empty registries
    Then the skill tool check should fail
    And the skill tool check message should contain "Missing tools"
    And the skill tool check message should contain "Missing skills"

  # Target: lines 166-169 via run_all_checks — action_name=None triggers rejection
  Scenario: run_all_checks rejects when action_name is None
    Given a fresh plan preflight guardrail instance with all registries populated but no action name
    When I run all preflight checks with action_name as None
    Then a preflight rejection should be raised for "action_schema_validation"
    And the preflight rejection message should contain "No action specified"
