Роутер работает нормально в process v2
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
from app.modules.rag.contracts.enums import RagLayer
|
||||
from app.modules.rag.indexing.docs.pipeline import DocsIndexingPipeline
|
||||
from app.core.rag.contracts.enums import RagLayer
|
||||
from app.core.rag.indexing.docs.pipeline import DocsIndexingPipeline
|
||||
|
||||
|
||||
def test_docs_pipeline_builds_new_d0_to_d5_layers() -> None:
|
||||
def test_docs_pipeline_builds_docs_layers_from_modern_markdown_structure() -> None:
|
||||
pipeline = DocsIndexingPipeline()
|
||||
content = """---
|
||||
id: api.billing.create_invoice
|
||||
type: api_method
|
||||
doc_type: api_method
|
||||
name: create_invoice
|
||||
title: Create Invoice API
|
||||
module: billing
|
||||
domain: billing
|
||||
sub_domain: invoices
|
||||
layer: application
|
||||
status: draft
|
||||
updated_at: 2026-03-23
|
||||
@@ -17,21 +20,26 @@ tags: [billing, api]
|
||||
entities: [Invoice]
|
||||
parent: billing_api
|
||||
children: []
|
||||
related_docs: [api.billing.validate_invoice]
|
||||
links:
|
||||
- type: related_api
|
||||
target: api.billing.validate_invoice
|
||||
called_by:
|
||||
- ui.billing.invoice_form
|
||||
uses_logic:
|
||||
- logic.billing.invoice_validation
|
||||
---
|
||||
# Summary
|
||||
# Create Invoice API
|
||||
|
||||
## Summary
|
||||
|
||||
Creates an invoice in billing.
|
||||
|
||||
# Details
|
||||
## Details
|
||||
|
||||
## Описание
|
||||
### Описание
|
||||
|
||||
Создает счет на оплату.
|
||||
|
||||
## Сценарий
|
||||
### Сценарий
|
||||
|
||||
**Название:**
|
||||
Create invoice
|
||||
@@ -55,7 +63,12 @@ Create invoice
|
||||
**Постусловие:**
|
||||
- Invoice is created.
|
||||
|
||||
## Контракт
|
||||
### Контракт
|
||||
|
||||
#### Метаданные вызова
|
||||
- Method: POST
|
||||
- Auth: USER
|
||||
- Idempotency: false
|
||||
|
||||
### Входные параметры
|
||||
|
||||
@@ -69,7 +82,22 @@ Create invoice
|
||||
| --- | --- | --- |
|
||||
| invoice_id | string | yes |
|
||||
|
||||
## Ошибки
|
||||
### Интеграции
|
||||
|
||||
#### Billing DB
|
||||
- target: db.billing.invoices
|
||||
- target_type: db
|
||||
- direction: outbound
|
||||
- interaction: writes
|
||||
- via: invoice repository
|
||||
- purpose: persist created invoices
|
||||
- details:
|
||||
- transaction: required
|
||||
- tables:
|
||||
- invoices
|
||||
- invoice_items
|
||||
|
||||
### Ошибки
|
||||
|
||||
| status | error | client action |
|
||||
| --- | --- | --- |
|
||||
@@ -89,10 +117,14 @@ Create invoice
|
||||
assert RagLayer.DOCS_ENTITY_CATALOG in layers
|
||||
assert RagLayer.DOCS_WORKFLOW_INDEX in layers
|
||||
assert RagLayer.DOCS_RELATION_GRAPH in layers
|
||||
assert RagLayer.DOCS_INTEGRATION_INDEX in layers
|
||||
|
||||
catalog_doc = next(doc for doc in docs if doc.layer == RagLayer.DOCS_DOCUMENT_CATALOG)
|
||||
assert catalog_doc.metadata["document_id"] == "api.billing.create_invoice"
|
||||
assert catalog_doc.metadata["module"] == "billing"
|
||||
assert catalog_doc.metadata["domain"] == "billing"
|
||||
assert catalog_doc.metadata["subdomain"] == "invoices"
|
||||
assert catalog_doc.metadata["summary_text"] == "Creates an invoice in billing."
|
||||
|
||||
fact_texts = [doc.text for doc in docs if doc.layer == RagLayer.DOCS_FACT_INDEX]
|
||||
assert any("has_field amount" in text for text in fact_texts)
|
||||
@@ -108,6 +140,16 @@ Create invoice
|
||||
relation_targets = [doc.metadata["target_id"] for doc in docs if doc.layer == RagLayer.DOCS_RELATION_GRAPH]
|
||||
assert "billing_api" in relation_targets
|
||||
assert "api.billing.validate_invoice" in relation_targets
|
||||
assert "logic.billing.invoice_validation" in relation_targets
|
||||
assert "Invoice" in relation_targets
|
||||
|
||||
chunk_doc = next(doc for doc in docs if doc.layer == RagLayer.DOCS_DOC_CHUNKS)
|
||||
assert chunk_doc.metadata["section_path"]
|
||||
assert chunk_doc.metadata["artifact_type"] == "DOCS"
|
||||
assert chunk_doc.metadata["domain"] == "billing"
|
||||
assert chunk_doc.metadata["subdomain"] == "invoices"
|
||||
|
||||
integration_doc = next(doc for doc in docs if doc.layer == RagLayer.DOCS_INTEGRATION_INDEX)
|
||||
assert integration_doc.metadata["target"] == "db.billing.invoices"
|
||||
assert integration_doc.metadata["target_type"] == "db"
|
||||
assert integration_doc.metadata["details"]["transaction"] == "required"
|
||||
|
||||
Reference in New Issue
Block a user