defaults:
  runner: runtime
  mode: full_chain
  input:
    rag_session_id: "fb7e0690-e737-44ca-acc6-e38a0687a5ee"

cases:
  # DOCUMENTATION_EXPLAIN
  - id: docs-v1-explain-system-flow-telegram-loop
    query: "Объясни как работает цикл отправки уведомлений в Telegram"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: SYSTEM_FLOW_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["logic.telegram_notification_loop"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D4_WORKFLOW_INDEX", "D5_RELATION_GRAPH"]
      llm:
        non_empty: true
        contains_all: ["TelegramNotifyWorker", "интервал"]
        answer_mode: answered

  - id: docs-v1-explain-component-control-channel
    query: "Объясни как устроен компонент TelegramControlChannel"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: COMPONENT_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        entity_candidates_contain: ["TelegramControlChannel"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D5_RELATION_GRAPH"]
      llm:
        non_empty: true
        contains_all: ["control plane", "/health"]
        answer_mode: answered

  - id: docs-v1-explain-api-health-endpoint
    query: "Объясни что делает API метод /health"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: API_METHOD_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["api.health_endpoint"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D4_WORKFLOW_INDEX", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_all: ["HTTP 200", "HTTP 503"]
        answer_mode: answered

  - id: docs-v1-explain-entity-runtime-health
    query: "Что такое сущность runtime health?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: ENTITY_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        entity_candidates_contain: ["WorkerHealth", "WorkerStatus"]
        doc_scope_contains: ["domain.runtime_health"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D3_ENTITY_CATALOG", "D5_RELATION_GRAPH"]
      llm:
        non_empty: true
        contains_all: ["наблюдаемости", "telegram_notify"]
        answer_mode: answered

  # DISCOVERY folded into DOCUMENTATION_EXPLAIN
  - id: docs-v1-discovery-find-documents-telegram-api
    query: "Найди документацию по Telegram API и control plane"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: RELATED_DOCS_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX"]
      llm:
        non_empty: true
        contains_all: ["/health", "/send"]
        answer_mode: answered

  - id: docs-v1-discovery-find-by-entity-telegramnotifyworker
    query: "Какие документы связаны с сущностью TelegramNotifyWorker?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: RELATED_DOCS_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        entity_candidates_contain: ["TelegramNotifyWorker"]
        layers_include: ["D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG"]
      llm:
        non_empty: true
        contains_all: ["logic.telegram_notification_loop", "api.health_endpoint"]
        answer_mode: answered

  - id: docs-v1-discovery-find-by-topic-health
    query: "Где в документации описан health runtime?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: RELATED_DOCS_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        layers_include: ["D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG"]
      llm:
        non_empty: true
        contains_all: ["api.health_endpoint", "domain.runtime_health"]
        answer_mode: answered

  # NAVIGATION folded into DOCUMENTATION_EXPLAIN
  - id: docs-v1-navigation-related-docs-health-endpoint
    query: "Какие документы связаны с endpoint /health?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: RELATED_DOCS_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["api.health_endpoint"]
        layers_include: ["D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG"]
      llm:
        non_empty: true
        contains_all: ["architecture.telegram_notify_app", "domain.runtime_health"]
        answer_mode: answered

  - id: docs-v1-navigation-parent-child-architecture
    query: "Покажи навигацию от overview архитектуры к дочерним документам"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: RELATED_DOCS_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["architecture.telegram_notify_app"]
        layers_include: ["D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG"]
      llm:
        non_empty: true
        contains_all: ["api.health_endpoint", "logic.telegram_notification_loop"]
        answer_mode: answered

  - id: docs-v1-navigation-workflow-send-message
    query: "По каким документам идти, чтобы понять сценарий ручной отправки сообщения?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: RELATED_DOCS_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        layers_include: ["D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG"]
      llm:
        non_empty: true
        contains_all: ["api.send_message_endpoint", "logic.telegram_notification_loop"]
        answer_mode: answered

  # OPENAPI_GENERATION
  - id: docs-v1-openapi-method-health-endpoint
    query: "Сгенерируй OpenAPI для метода /health по документации"
    expected:
      router:
        intent: OPENAPI_GENERATION
        sub_intent: OPENAPI_METHOD_GENERATE
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        filters_contain:
          doc_type: api_method
        doc_scope_contains: ["api.health_endpoint"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_all: ["paths:", "/health", "get:"]
        answer_mode: structured_spec

  - id: docs-v1-openapi-fragment-send-request
    query: "Сгенерируй request schema для endpoint /send по документации"
    expected:
      router:
        intent: OPENAPI_GENERATION
        sub_intent: OPENAPI_FRAGMENT_GENERATE
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        filters_contain:
          doc_type: api_method
        doc_scope_contains: ["api.send_message_endpoint"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_all: ["message", "type:", "string"]
        answer_mode: structured_spec

  - id: docs-v1-openapi-fragment-control-actions-response
    query: "Собери response schema для /actions/{action} по документации"
    expected:
      router:
        intent: OPENAPI_GENERATION
        sub_intent: OPENAPI_FRAGMENT_GENERATE
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        filters_contain:
          doc_type: api_method
        doc_scope_contains: ["api.control_actions_endpoint"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_all: ["status", "detail"]
        answer_mode: structured_spec

  # NEGATIVE / NOT FOUND
  - id: docs-v1-discovery-find-by-entity-nonexistent
    query: "Какие документы связаны с сущностью PaymentTransaction?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: RELATED_DOCS_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: false
        entity_candidates_contain: ["PaymentTransaction"]
        layers_include: ["D3_ENTITY_CATALOG", "D1_DOCUMENT_CATALOG", "D5_RELATION_GRAPH"]
      llm:
        non_empty: true
        contains_all: ["не найдена"]
        excludes: ["вероятно", "исходя из названия"]
      pipeline:
        answer_mode: degraded

  - id: docs-v1-openapi-method-nonexistent
    query: "Сгенерируй OpenAPI для endpoint /orders по документации"
    expected:
      router:
        intent: OPENAPI_GENERATION
        sub_intent: OPENAPI_METHOD_GENERATE
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: false
        filters_contain:
          doc_type: api_method
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_all: ["не найден"]
        excludes: ["paths:", "/orders", "post:"]
      pipeline:
        answer_mode: degraded
