Feature: Anthropic Claude chat provider coverage
  As a maintainer integrating real provider adapters
  I want unit-level Behave scenarios for the Anthropic Claude chat provider
  So that the implementation stays documented and regression tested

  @unit @providers @anthropic
  Scenario: Anthropic provider instantiates ChatAnthropic with provided credentials
    Given I have sample provider domain inputs
    When I create an Anthropic chat provider with API key "sk-ant-unit-test" and model "claude-sonnet-4-20250514"
    And I request plan generation from the Anthropic provider
    Then the Anthropic provider should construct ChatAnthropic with api key "sk-ant-unit-test" and model "claude-sonnet-4-20250514"
    And the Anthropic provider metadata should report name "anthropic" and model "claude-sonnet-4-20250514"

  @unit @providers @anthropic
  Scenario: Anthropic provider stubbed response reports metadata
    Given I have sample provider domain inputs
    And I create an Anthropic chat provider with API key "sk-ant-unit-test" and model "claude-sonnet-4-20250514"
    When I request plan generation from the Anthropic provider
    Then the Anthropic provider response should contain no generated changes
    And the Anthropic provider response should report the requested model without errors

  @unit @providers @anthropic
  Scenario: Anthropic provider rejects missing API key
    Given I have sample provider domain inputs
    When I attempt to create an Anthropic chat provider without an API key
    Then the Anthropic provider creation should fail with error "Anthropic API key is required"

  @unit @providers @anthropic
  Scenario: Anthropic provider forwards optional kwargs
    Given I have sample provider domain inputs
    And I set the Anthropic provider extra kwargs "temperature=0.35,max_tokens=2048"
    When I create an Anthropic chat provider with API key "sk-ant-unit-test" and model "claude-sonnet-4-20250514"
    And I request plan generation from the Anthropic provider
    Then the Anthropic provider should construct ChatAnthropic with api key "sk-ant-unit-test" and model "claude-sonnet-4-20250514"
    And the Anthropic provider should include kwargs "temperature=0.35,max_tokens=2048" in the ChatAnthropic call

  @unit @providers @anthropic
  Scenario: Anthropic provider reports runtime errors
    Given I have sample provider domain inputs
    And I create an Anthropic chat provider with API key "sk-ant-unit-test" and model "claude-sonnet-4-20250514"
    And the plan generation graph raises RuntimeError "deadline reached"
    When I request plan generation from the Anthropic provider
    Then the Anthropic provider response should report error "deadline reached"
    And the Anthropic provider response should contain no generated changes

  @unit @providers @anthropic
  Scenario: Anthropic provider streaming yields workflow events
    Given I have sample provider domain inputs
    And the plan generation graph returns a generated change for "app/stream.py"
    And the plan generation graph emits streaming nodes "load_context,analyze_requirements,generate_plan,validate"
    And I create an Anthropic chat provider with API key "sk-ant-unit-test" and model "claude-sonnet-4-20250514"
    When I stream plan generation from the Anthropic provider
    Then the Anthropic provider streaming events should include nodes "load_context,analyze_requirements,generate_plan,validate"
    And the Anthropic provider streaming result should finish with a response containing 1 generated change

  @unit @providers @anthropic
  Scenario: Anthropic provider surfaces plan generation errors
    Given I have sample provider domain inputs
    And the plan generation graph raises ValueError "graph exploded"
    And I create an Anthropic chat provider with API key "sk-ant-unit-test" and model "claude-sonnet-4-20250514"
    When I request plan generation from the Anthropic provider
    Then the Anthropic provider response should report error "graph exploded"
    And the Anthropic provider response should contain no generated changes

  @unit @providers @anthropic
  Scenario: Anthropic provider supports streaming responses
    Given I have sample provider domain inputs
    And I create an Anthropic chat provider with API key "sk-ant-unit-test" and model "claude-sonnet-4-20250514"
    Then the Anthropic provider should support streaming responses
