# v3-related-health-2

- source_file: /Users/alex/Dev_projects_v2/ai driven app process/v2/agent/tests/pipeline_setup_v3/cases/suite_03_docs/full_chain_docs_intents_v3-3x.yaml
- runner: agent_runtime
- mode: pre_llm
- passed: True

## Query
Какие документы относятся к health endpoint?

## Actual
{
  "intent": "DOCUMENTATION_EXPLAIN",
  "sub_intent": "RELATED_DOCS_EXPLAIN",
  "graph_id": "DocsQAGraph",
  "conversation_mode": "START",
  "rag_count": 14,
  "llm_answer": "",
  "answer_mode": "answered",
  "path_scope": [],
  "doc_scope": [
    "api.control_actions_endpoint",
    "api.health_endpoint",
    "api.send_message_endpoint"
  ],
  "entity_candidates": [],
  "symbol_candidates": [],
  "layers": [
    "D5_RELATION_GRAPH",
    "D1_DOCUMENT_CATALOG",
    "D0_DOC_CHUNKS"
  ],
  "filters": {
    "doc_type": null
  },
  "pipeline_mode": "pre_llm_only",
  "gate_decision": "allow",
  "prompt_used": "docs_explain_answer",
  "llm_mode": "graph_summary",
  "degraded_reason": null,
  "code_intents_stubbed": true
}

## Pipeline Steps
### input_query
```json
{
  "input": {
    "query": "Какие документы относятся к health endpoint?"
  },
  "output": {
    "query": "Какие документы относятся к health endpoint?"
  }
}
```

### router
```json
{
  "input": {
    "query": "Какие документы относятся к health endpoint?"
  },
  "output": {
    "intent": "DOCUMENTATION_EXPLAIN",
    "sub_intent": "RELATED_DOCS_EXPLAIN",
    "graph_id": "DocsQAGraph",
    "conversation_mode": "START"
  }
}
```

### docs_pipeline
```json
{
  "input": {
    "query": "Какие документы относятся к health endpoint?"
  },
  "output": {
    "answer_mode": "ready",
    "prompt_name": "docs_explain_answer",
    "llm_request": {
      "prompt_name": "docs_explain_answer",
      "log_context": "graph.project_qa.docs.answer",
      "prompt_stats": {
        "system_chars": 393,
        "user_chars": 5475,
        "tokens_in_estimate": 1467
      }
    },
    "degraded_reason": ""
  }
}
```

## Diagnostics
{
  "intent": "DOCUMENTATION_EXPLAIN",
  "sub_intent": "RELATED_DOCS_EXPLAIN",
  "layers_used": [
    "D5_RELATION_GRAPH",
    "D1_DOCUMENT_CATALOG",
    "D0_DOC_CHUNKS"
  ],
  "documents_found": 0,
  "facts_found": 0,
  "relations_found": 4,
  "openapi_fields_extracted": 0,
  "missing_required_fields": [],
  "openapi_status": {
    "has_path": false,
    "has_method": false,
    "has_request": false,
    "has_response": false
  },
  "prompt_used": "docs_explain_answer",
  "llm_mode": "graph_summary",
  "output_valid": true,
  "matched_intent_source": "deterministic",
  "matched_anchor_type": "topic",
  "matched_anchor_value": null,
  "exact_anchor_match": false,
  "docs_layers_requested": [
    "D5_RELATION_GRAPH",
    "D1_DOCUMENT_CATALOG",
    "D0_DOC_CHUNKS"
  ],
  "docs_layers_with_hits": [
    "D5_RELATION_GRAPH"
  ],
  "planned_layers": [
    "D5_RELATION_GRAPH",
    "D1_DOCUMENT_CATALOG",
    "D0_DOC_CHUNKS"
  ],
  "executed_layers": [
    "D5_RELATION_GRAPH"
  ],
  "non_empty_layers": [
    "D5_RELATION_GRAPH"
  ],
  "layer_diagnostics": {
    "D5_RELATION_GRAPH": {
      "hits": 8,
      "top_ids": [
        "5f4909bde905cd3d294ad307074a05e4ae4deefcafe6272cd2d0436e73acb8dd",
        "711fb2edb82dd222deaba3c91768b18cbbd453009235823282813c6e867dc2c1",
        "eec79f7a02b804337e791ef231784862ae26e0599eb20224790e9d4f085fa9c0",
        "c718b1939621233295ccaf6e8203e7fd94f3dd1bfb88f10c51bc5e33d53a24aa",
        "616f5cbf25da83cb51d8d0741a7fc351620c9ca2c6513fa2094b4aa476f0912a"
      ],
      "top_sections": [
        "api.control_actions_endpoint:part_of",
        "api.control_actions_endpoint:related_api",
        "api.control_actions_endpoint:related_logic",
        "api.health_endpoint:parent",
        "api.health_endpoint:part_of"
      ]
    },
    "D1_DOCUMENT_CATALOG": {
      "hits": 0,
      "top_ids": [],
      "skipped": true,
      "reason": "relation_primary_sufficient"
    },
    "D0_DOC_CHUNKS": {
      "hits": 6,
      "top_ids": [
        "api.control_actions_endpoint"
      ],
      "top_sections": [
        "api.control_actions_endpoint:Summary",
        "api.control_actions_endpoint:Описание",
        "api.control_actions_endpoint:Сценарий",
        "api.control_actions_endpoint:Функциональные требования",
        "api.control_actions_endpoint:Нефункциональные требования"
      ]
    }
  },
  "query_entity_candidates": [],
  "resolved_entity_candidates": [],
  "query_anchor_candidates": [],
  "resolved_anchor_candidates": [
    "docs/documentation/api/control-actions-endpoint.md",
    "docs/documentation/api/health-endpoint.md",
    "docs/documentation/api/send-message-endpoint.md",
    "api.control_actions_endpoint"
  ],
  "anchor_candidates": [
    "api.control_actions_endpoint",
    "api.health_endpoint",
    "api.send_message_endpoint"
  ],
  "selected_anchor": "api.control_actions_endpoint",
  "anchor_selection_reason": "relation_neighbor",
  "anchor_match_type": "semantic_fallback",
  "doc_ids": [
    "api.control_actions_endpoint",
    "api.health_endpoint",
    "api.send_message_endpoint"
  ],
  "doc_paths": [
    "docs/documentation/api/control-actions-endpoint.md",
    "docs/documentation/api/health-endpoint.md",
    "docs/documentation/api/send-message-endpoint.md"
  ],
  "doc_titles": [
    "api.control_actions_endpoint:part_of",
    "api.control_actions_endpoint:related_api",
    "api.control_actions_endpoint:related_logic",
    "api.health_endpoint:parent",
    "api.health_endpoint:part_of",
    "api.health_endpoint:depends_on",
    "api.send_message_endpoint:parent",
    "api.control_actions_endpoint:parent",
    "api.control_actions_endpoint:Summary",
    "api.control_actions_endpoint:Описание",
    "api.control_actions_endpoint:Сценарий",
    "api.control_actions_endpoint:Функциональные требования",
    "api.control_actions_endpoint:Нефункциональные требования",
    "api.control_actions_endpoint:Входные параметры"
  ],
  "relation_hits_count": 4,
  "relation_targets": [
    "api.control_actions_endpoint:part_of",
    "api.control_actions_endpoint:related_api",
    "api.control_actions_endpoint:related_logic",
    "api.health_endpoint:parent"
  ],
  "selected_doc_ids": [],
  "selected_fact_ids": [],
  "selected_relation_ids": [
    "5f4909bde905cd3d294ad307074a05e4ae4deefcafe6272cd2d0436e73acb8dd",
    "711fb2edb82dd222deaba3c91768b18cbbd453009235823282813c6e867dc2c1",
    "eec79f7a02b804337e791ef231784862ae26e0599eb20224790e9d4f085fa9c0",
    "c718b1939621233295ccaf6e8203e7fd94f3dd1bfb88f10c51bc5e33d53a24aa"
  ],
  "selected_chunk_ids": [
    "api.control_actions_endpoint"
  ],
  "selected_entity_ids": [],
  "selected_workflow_ids": [],
  "fallback_doc_hits_count": 1,
  "fallback_used": true,
  "fact_hits": 0,
  "entity_hits": 0,
  "evidence_summary": {
    "documents": 0,
    "facts": 0,
    "entities": 0,
    "workflows": 0,
    "relations": 4,
    "chunks": 1,
    "selected_doc_ids": [],
    "selected_fact_ids": [],
    "selected_relation_ids": [
      "5f4909bde905cd3d294ad307074a05e4ae4deefcafe6272cd2d0436e73acb8dd",
      "711fb2edb82dd222deaba3c91768b18cbbd453009235823282813c6e867dc2c1",
      "eec79f7a02b804337e791ef231784862ae26e0599eb20224790e9d4f085fa9c0",
      "c718b1939621233295ccaf6e8203e7fd94f3dd1bfb88f10c51bc5e33d53a24aa"
    ],
    "selected_chunk_ids": [
      "api.control_actions_endpoint"
    ],
    "entity_hits": 0,
    "openapi_signals": {
      "path_found": false,
      "method_found": false,
      "operation_semantics_found": false,
      "request_payload_found": false,
      "request_schema": false,
      "request_fields_found": false,
      "response_payload_found": false,
      "response_schema": false,
      "response_fields_found": false,
      "status_codes": false,
      "content_type_found": false,
      "examples_found": false,
      "payload_description": false
    }
  },
  "gate_decision": "allow",
  "gate_decision_reason": "relation_evidence_available",
  "gate_missing_requirements": [],
  "gate_satisfied_requirements": [
    "retrieval_non_empty"
  ],
  "openapi_evidence": {
    "path_found": false,
    "method_found": false,
    "operation_semantics_found": false,
    "request_payload_found": false,
    "request_schema": false,
    "request_fields_found": false,
    "response_payload_found": false,
    "response_schema": false,
    "response_fields_found": false,
    "status_codes": false,
    "content_type_found": false,
    "examples_found": false,
    "payload_description": false
  },
  "requested_fragment_type": null,
  "fragment_evidence_found": [],
  "fragment_missing_requirements": [],
  "answer_mode": "ready",
  "degrade_reason": null,
  "degraded_reason": null,
  "code_intents_stubbed": false
}

## LLM Request
- prompt_name: docs_explain_answer
- log_context: graph.project_qa.docs.answer

### Prompt Stats
```json
{
  "system_chars": 393,
  "user_chars": 5475,
  "tokens_in_estimate": 1467
}
```

### System Prompt
```text
Ты объясняешь документацию системы.

На вход приходит JSON с полями:
- question
- intent
- sub_intent
- documents
- facts
- relations

Правила:
- Используй только предоставленные факты
- Не додумывай
- Если данных недостаточно, скажи это явно
- Объясняй структурировано

Формат ответа:
1. Краткое описание
2. Основные элементы
3. Как это работает
4. Связи с другими частями системы (если есть)
```

### User Prompt
```json
{
  "question": "Какие документы относятся к health endpoint?",
  "intent": "DOCUMENTATION_EXPLAIN",
  "sub_intent": "RELATED_DOCS_EXPLAIN",
  "documents": [],
  "facts": [],
  "entities": [],
  "workflows": [],
  "relations": [
    {
      "layer": "D5_RELATION_GRAPH",
      "path": "docs/documentation/api/control-actions-endpoint.md",
      "title": "api.control_actions_endpoint:part_of",
      "content": "api.control_actions_endpoint part_of architecture.telegram_notify_app",
      "metadata": {
        "owner": null,
        "anchor": "frontmatter.links",
        "doc_id": null,
        "repo_id": "test_echo_app",
        "section": null,
        "blob_sha": "a251c550a23249ef1a74389c93aaccd4c5ae88ef621efad2aa018fcd132cce7e",
        "source_id": "api.control_actions_endpoint",
        "target_id": "architecture.telegram_notify_app",
        "doc_version": null,
        "relation_id": "5f4909bde905cd3d294ad307074a05e4ae4deefcafe6272cd2d0436e73acb8dd",
        "source_path": "docs/documentation/api/control-actions-endpoint.md",
        "artifact_type": null,
        "last_modified": null,
        "relation_type": "part_of",
        "staleness_score": null,
        "system_component": null
      }
    },
    {
      "layer": "D5_RELATION_GRAPH",
      "path": "docs/documentation/api/control-actions-endpoint.md",
      "title": "api.control_actions_endpoint:related_api",
      "content": "api.control_actions_endpoint related_api api.health_endpoint",
      "metadata": {
        "owner": null,
        "anchor": "frontmatter.links",
        "doc_id": null,
        "repo_id": "test_echo_app",
        "section": null,
        "blob_sha": "a251c550a23249ef1a74389c93aaccd4c5ae88ef621efad2aa018fcd132cce7e",
        "source_id": "api.control_actions_endpoint",
        "target_id": "api.health_endpoint",
        "doc_version": null,
        "relation_id": "711fb2edb82dd222deaba3c91768b18cbbd453009235823282813c6e867dc2c1",
        "source_path": "docs/documentation/api/control-actions-endpoint.md",
        "artifact_type": null,
        "last_modified": null,
        "relation_type": "related_api",
        "staleness_score": null,
        "system_component": null
      }
    },
    {
      "layer": "D5_RELATION_GRAPH",
      "path": "docs/documentation/api/control-actions-endpoint.md",
      "title": "api.control_actions_endpoint:related_logic",
      "content": "api.control_actions_endpoint related_logic logic.telegram_notification_loop",
      "metadata": {
        "owner": null,
        "anchor": "frontmatter.links",
        "doc_id": null,
        "repo_id": "test_echo_app",
        "section": null,
        "blob_sha": "a251c550a23249ef1a74389c93aaccd4c5ae88ef621efad2aa018fcd132cce7e",
        "source_id": "api.control_actions_endpoint",
        "target_id": "logic.telegram_notification_loop",
        "doc_version": null,
        "relation_id": "eec79f7a02b804337e791ef231784862ae26e0599eb20224790e9d4f085fa9c0",
        "source_path": "docs/documentation/api/control-actions-endpoint.md",
        "artifact_type": null,
        "last_modified": null,
        "relation_type": "related_logic",
        "staleness_score": null,
        "system_component": null
      }
    },
    {
      "layer": "D5_RELATION_GRAPH",
      "path": "docs/documentation/api/health-endpoint.md",
      "title": "api.health_endpoint:parent",
      "content": "api.health_endpoint parent architecture.telegram_notify_app",
      "metadata": {
        "owner": null,
        "anchor": "frontmatter.parent",
        "doc_id": null,
        "repo_id": "test_echo_app",
        "section": null,
        "blob_sha": "8b5a533a8076e2e9d36995eee29aeade260080bdca2ec8e21fe28f08574b983f",
        "source_id": "api.health_endpoint",
        "target_id": "architecture.telegram_notify_app",
        "doc_version": null,
        "relation_id": "c718b1939621233295ccaf6e8203e7fd94f3dd1bfb88f10c51bc5e33d53a24aa",
        "source_path": "docs/documentation/api/health-endpoint.md",
        "artifact_type": null,
        "last_modified": null,
        "relation_type": "parent",
        "staleness_score": null,
        "system_component": null
      }
    }
  ],
  "chunks": [
    {
      "layer": "D0_DOC_CHUNKS",
      "path": "docs/documentation/api/control-actions-endpoint.md",
      "title": "api.control_actions_endpoint:Summary",
      "content": "Endpoint `/actions/{action}` управляет control actions runtime и поддерживает `start`, `stop` и `status`. Для долгих операций `start` и `stop` допускается ответ HTTP 202, если действие еще выполняется. Endpoint используется для operator-driven управления жизненным циклом worker'а через HTTP API.",
      "metadata": {
        "tags": [
          "api",
          "control-plane",
          "lifecycle"
        ],
        "type": "api_method",
        "order": 1,
        "owner": null,
        "doc_id": null,
        "module": "telegram_notify_app",
        "repo_id": "test_echo_app",
        "section": null,
        "blob_sha": "a251c550a23249ef1a74389c93aaccd4c5ae88ef621efad2aa018fcd132cce7e",
        "doc_kind": "misc",
        "doc_version": null,
        "document_id": "api.control_actions_endpoint",
        "source_path": "docs/documentation/api/control-actions-endpoint.md",
        "section_path": "Summary",
        "artifact_type": null,
        "last_modified": null,
        "section_title": "Summary",
        "staleness_score": null,
        "system_component": null
      }
    }
  ]
}
```

### User Prompt Overview
- question: Какие документы относятся к health endpoint?
- intent: DOCUMENTATION_EXPLAIN
- sub_intent: RELATED_DOCS_EXPLAIN
- documents: 0
- facts: 0
- relations: 4 | samples: api.control_actions_endpoint:part_of, api.control_actions_endpoint:related_api, api.control_actions_endpoint:related_logic

## Mismatches
- none