test_case_id: "fenced_artifact_filename_versioning_001"
description: "Tests that saving an artifact with a duplicate filename creates a new version."
tags: ["all","core_a2a"]
skip_intermediate_events: true

gateway_input:
  target_agent_name: "TestAgent"
  user_identity: "fenced_artifact_tester@example.com"
  parts: [{type: "text", text: "Create two versions of 'versioned_report.txt'."}]
  external_context:
    a2a_session_id: "fixed_session_for_fenced_artifact_versioning_test_001"

llm_interactions:
  - static_response:
      choices:
        - message:
            role: "assistant"
            content: |
              Okay, creating the first version.
              «««save_artifact: filename="versioned_report.txt" mime_type="text/plain"
              Version 0 content.
              »»»
              Now creating the second version.
              «««save_artifact: filename="versioned_report.txt" mime_type="text/plain"
              Version 1 content.
              »»»
          finish_reason: "stop"
  - static_response:
      choices:
        - message:
            role: "assistant"
            content: "I have created two versions of 'versioned_report.txt'."
    expected_request:
      expected_tool_responses_in_llm_messages:
        - tool_name: "_notify_artifact_save"
          response_json_matches:
            filename: "versioned_report.txt"
            version: 0
            status: "success"
        - tool_name: "_notify_artifact_save"
          response_json_matches:
            filename: "versioned_report.txt"
            version: 1
            status: "success"

expected_gateway_output:
  - type: "final_response"
    content_parts:
      - type: "text"
        text_contains: "I have created two versions of 'versioned_report.txt'."
    assert_artifact_state:
      - filename: "versioned_report.txt"
        version: 0
        expected_content_text: "Version 0 content.\n"
      - filename: "versioned_report.txt"
        version: 1
        expected_content_text: "Version 1 content.\n"
