АДРЕСНЫЙ РЕЖИМ - M2.3c тюнинг резолвинга и фильтров адресных запросов, поэтапная диагностика и аудит фильтрации по счету

This commit is contained in:
2026-03-29 21:51:09 +03:00
parent 2bf16de4ea
commit a2886faed6
37 changed files with 3050 additions and 151 deletions
+2
View File
@@ -12,6 +12,7 @@
- `runtime_readiness_matrix_v1.md` - матрица structural vs runtime readiness.
- `known_positive_live_suite_v1.md` - базовый template positive-evidence suite.
- `data_aware_positive_acceptance_suite_v1.md` - M2.3 canonical guide для curated live acceptance.
- `curated_positive_live_suite_v1.md` - M2.3c curated suite (counterparty/account split + negative twins).
- `address_query_bootstrap_report_2026-03-29.md` - итоговая сводка bootstrap этапа.
## Связанные run-паки
@@ -21,4 +22,5 @@
- `docs/ADDRESS/runs/2026-03-29_Address_Query_Runtime_V1_M2_3_DocumentsFormingBalance_DataAwareAcceptance/`
- `docs/ADDRESS/runs/2026-03-29_Address_Query_Runtime_V1_M2_3A_Stage_Diagnostic_Materialization/`
- `docs/ADDRESS/runs/2026-03-29_Address_Query_Runtime_V1_M2_3B_AccountScope_Mode_Tuning/`
- `docs/ADDRESS/runs/2026-03-29_Address_Query_Runtime_V1_M2_3C_Resolver_Filter_Tuning_And_AccountScope_Audit/`
@@ -1,4 +1,4 @@
# Address Runtime Contracts V1 (M2.3b)
# Address Runtime Contracts V1 (M2.3c)
Дата: 2026-03-29
@@ -38,6 +38,9 @@
- `ambiguity_count`
- MCP/evidence flow block:
- `mcp_call_status`
- `mcp_call_status_legacy`
- `match_failure_stage`
- `match_failure_reason`
- `rows_fetched`
- `raw_rows_received`
- `rows_after_account_scope`
@@ -46,6 +49,12 @@
- `rows_matched`
- `raw_row_keys_sample`
- `materialization_drop_reason`
- account-scope audit block:
- `account_token_raw`
- `account_token_normalized`
- `account_scope_fields_checked`
- `account_scope_match_strategy`
- `account_scope_drop_reason`
- `response_type`
- `limited_reason_category`
- `fallback_reason`
@@ -85,16 +94,20 @@
- `DEEP_ONLY`
- `UNKNOWN`
## MCP Stage Status Taxonomy (M2.3a)
## MCP Stage Status Taxonomy (M2.3c)
- `skipped`
- `error`
- `no_raw_rows`
- `raw_rows_received_but_not_materialized`
- `materialized_but_not_matched`
- `materialized_but_not_anchor_matched`
- `materialized_but_filtered_out_by_recipe`
- `matched_non_empty`
## Materialization Drop Reasons (M2.3a)
Legacy compatibility:
- `mcp_call_status_legacy` may still report `materialized_but_not_matched` for backward-compatible analytics.
## Materialization Drop Reasons (M2.3c)
- `none`
- `dropped_by_account_scope_filter`
@@ -103,15 +116,21 @@
- `missing_registrator_field`
- `unknown_row_shape`
## Account Scope Strategy (M2.3b)
## Account Scope Strategy (M2.3c)
- `strict` - account scope is mandatory and applied as a hard filter.
- `preferred` - account scope is applied first; if it yields zero rows while raw rows exist, runtime falls back to raw rows and continues matching.
## M2.3c Runtime Snapshot
- Counterparty intents now have confirmed `matched_non_empty` cases in curated live suite.
- Account intents still mostly stop at `raw_rows_received_but_not_materialized`.
- Guardrails remain unchanged: no free query generation, no false factual outputs.
## Compound Query Note
- `COMPOUND_FACTUAL_QUERY` currently remains detection-only.
- Multi-intent decomposition execution is planned for next increment.
- Multi-intent decomposition execution is planned for the next increment.
## Guardrails
@@ -119,5 +138,3 @@
- read-only MCP
- no free-form query generation
- no silent source substitution
@@ -41,7 +41,7 @@
- Если обязательные фильтры не извлечены, вернуть `LIMITED_WITH_REASON` с указанием недостающих параметров.
- Если вопрос требует causal/proof reasoning, перевести в deep-analysis path.
- Для `as_of_date` по умолчанию используется текущая дата runtime (на момент этого документа: 2026-03-29), если пользователь явно не задал дату.
## Runtime status note (M2.3b)
## Runtime status note (M2.3c)
Implemented in live runtime now:
- `list_documents_by_counterparty`
@@ -53,6 +53,6 @@ Still not implemented in runtime:
Stage diagnostic note:
- strict account intents still show `raw_rows_received > 0`, but `rows_after_account_scope = 0`;
- preferred counterparty intents now reach `rows_materialized > 0`, but rows still drop at recipe/anchor filter stage;
- non-empty factual acceptance now requires resolver/filter tuning after materialization.
- counterparty intents now have curated `matched_non_empty` cases after resolver/filter tuning;
- account family still needs account-scope/materialization fix before first stable non-empty account case.
@@ -0,0 +1,48 @@
# Curated Positive Live Suite V1 (M2.3c)
Дата: 2026-03-29
## Назначение
Этот suite нужен для acceptance live-runtime без хардкода бизнес-объектов в продуктовой логике.
- runtime остается `data-agnostic`
- acceptance остается `data-aware`
То есть набор кейсов собирается по exploratory live pass, но не вшивается в runtime-правила.
## Семейства в M2.3c
1. `counterparty`
2. `account`
## Curated Case Set
| case_id | family | question pattern | intent | expected |
|---|---|---|---|---|
| C1 | counterparty | documents by counterparty (known non-empty anchor + period) | `list_documents_by_counterparty` | `FACTUAL_LIST`, non-empty |
| C2 | counterparty | bank operations by counterparty (known non-empty anchor + period) | `bank_operations_by_counterparty` | `FACTUAL_LIST`, non-empty |
| C3 | counterparty | documents by counterparty (negative twin) | `list_documents_by_counterparty` | `LIMITED_WITH_REASON` |
| C4 | counterparty | bank ops by counterparty (negative twin) | `bank_operations_by_counterparty` | `LIMITED_WITH_REASON` |
| C5 | account | account balance snapshot by account/date | `account_balance_snapshot` | stage-diagnostic limited |
| C6 | account | documents forming balance by account/date | `documents_forming_balance` | stage-diagnostic limited |
| C7 | account | documents forming balance by account/date (variant) | `documents_forming_balance` | stage-diagnostic limited |
| C8 | account | account balance snapshot by account/date (variant) | `account_balance_snapshot` | stage-diagnostic limited |
## Что проверяем этим suite
- есть ли реальные `matched_non_empty` в counterparty-family;
- сохраняется ли `false_factual_rate = 0` на negative twins;
- где именно застревает account-family (`raw_rows_received_but_not_materialized` vs later stages).
## Acceptance Rules
- минимум один non-empty factual для каждого counterparty intent;
- zero false-factual;
- account-family must be localized with explicit stage/failure reason (без размытого limited).
## Где лежат артефакты
- run-pack: `docs/ADDRESS/runs/2026-03-29_Address_Query_Runtime_V1_M2_3C_Resolver_Filter_Tuning_And_AccountScope_Audit/`
- diagnostic matrix: `stage_diagnostic_matrix.md`
- case matrix: `curated_positive_case_matrix.md`
+12 -1
View File
@@ -97,9 +97,20 @@
- Runtime вызывает MCP proxy (`/api/execute_query`) только с query-template из recipe и параметрами после валидации.
- Для V1 все recipe выполняются в `read-only` режиме.
- Ограничения на выборку (`limit`) и сортировки фиксируются recipe-контрактом, а не свободным текстом вопроса.
## 8) Account Scope Strategy (M2.3b)
## 8) Account Scope Strategy (M2.3c)
- `account_balance_snapshot` and `documents_forming_balance` use `strict` account scope.
- counterparty-oriented recipes use `preferred` account scope with runtime fallback to raw rows when scope gives zero rows.
- this keeps account-intent precision while preventing blind row loss on party intents.
## 9) Runtime Query Template Notes (M2.3c)
- `address.documents.by_counterparty` and `address.bank_ops.by_counterparty` use a dedicated `bank_docs` live query template.
- account intents (`address.account.balance_snapshot`, `address.balance.drilldown_documents`) continue using movement-oriented query template with strict account scope.
- stage diagnostics are tracked with split statuses:
- `raw_rows_received_but_not_materialized`
- `materialized_but_not_anchor_matched`
- `materialized_but_filtered_out_by_recipe`
- `matched_non_empty`
- for backward compatibility analytics, legacy status is emitted as `mcp_call_status_legacy`.
@@ -1,4 +1,4 @@
# Runtime Readiness Matrix V1 (M2.3b)
# Runtime Readiness Matrix V1 (M2.3c)
Дата: 2026-03-29
@@ -7,45 +7,29 @@
## Статусы
- `STRUCTURALLY_VISIBLE` - сущность подтверждена в snapshot/inventory.
- `LIVE_QUERYABLE` - в текущем live path можно дать factual без натяжек.
- `LIVE_QUERYABLE_WITH_LIMITS` - live path работает, но часто нужен дополнительный anchor.
- `REQUIRES_SPECIALIZED_RECIPE` - базовый movement recipe недостаточен для materialization.
- `LIVE_QUERYABLE` - в текущем live path можно давать factual ответ стабильно.
- `LIVE_QUERYABLE_WITH_LIMITS` - live path работает, но результат зависит от anchor/period precision.
- `REQUIRES_SPECIALIZED_RECIPE` - базовый recipe-контур не покрывает сценарий.
- `DEEP_ONLY` - сценарий не относится к address V1.
## Матрица (P0/P1)
| scenario_id | scenario | structural_readiness | runtime_readiness | current_blocker | next_action |
|---|---|---|---|---|---|
| AQ-P0-01 | list_open_contracts | STRUCTURALLY_VISIBLE | REQUIRES_SPECIALIZED_RECIPE | weak contract anchors in movement rows | добавить object-aware recipe (`documents/contracts`) |
| AQ-P0-02 | list_payables_counterparties | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | empty matches on narrow filters | расширить live evidence pack по контрагентам |
| AQ-P0-03 | list_receivables_counterparties | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | empty matches on narrow filters | улучшить фильтрацию и fallback hints |
| AQ-P0-04 | account_balance_snapshot | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | dry-run frequently returns `empty_match` on broad `today` filters | lock data-aware positive account/date fixtures |
| AQ-P0-05 | open_items_by_counterparty_or_contract (counterparty) | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | missing counterparty anchor in short phrases | усилить anchor-first extraction |
| AQ-P0-06 | open_items_by_counterparty_or_contract (contract) | STRUCTURALLY_VISIBLE | REQUIRES_SPECIALIZED_RECIPE | movement rows often miss contract linkage | двухшаговый path: anchor resolution -> focused recipe |
| AQ-P0-07 | documents_by_counterparty | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | implemented path, but dry-run still often `empty_match` on current anchors/period | expand data-aware positive fixtures and improve resolver targeting |
| AQ-P0-07B | bank_operations_by_counterparty | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | implemented path, but dry-run still often `empty_match` on current anchors/period | expand data-aware positive fixtures and tighten bank-doc targeting |
| AQ-P0-08 | documents_by_contract | STRUCTURALLY_VISIBLE | REQUIRES_SPECIALIZED_RECIPE | by-contract live recipe not implemented in runtime V1 | add contract-aware document-list recipe with resolver confidence gate |
| AQ-P0-09 | documents_forming_balance | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | implemented, but stage diagnostic shows loss before materialization | diagnose and tune account-scope filtering for live recipes |
| AQ-P1-10 | account_turnover_snapshot | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | not in current intent set | расширение intents V1.1 |
| AQ-P0-01 | list_open_contracts | STRUCTURALLY_VISIBLE | REQUIRES_SPECIALIZED_RECIPE | weak contract anchors in current live rows | add contract-aware document recipe + resolver confidence gate |
| AQ-P0-02 | list_payables_counterparties | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | broad prompts still produce sparse matches | keep curated positive suite and tighten period hints |
| AQ-P0-03 | list_receivables_counterparties | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | broad prompts still produce sparse matches | keep curated positive suite and tighten period hints |
| AQ-P0-04 | account_balance_snapshot | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | `raw_rows_received > 0`, but account scope drops rows before materialization | account token/shape audit and account field mapping fix |
| AQ-P0-05 | open_items_by_counterparty_or_contract (counterparty) | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | requires explicit counterparty anchor for stable non-empty | anchor refinement and resolver ambiguity handling |
| AQ-P0-06 | open_items_by_counterparty_or_contract (contract) | STRUCTURALLY_VISIBLE | REQUIRES_SPECIALIZED_RECIPE | movement rows often miss contract linkage | two-step path: contract resolver -> focused recipe |
| AQ-P0-07 | documents_by_counterparty | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | positive cases confirmed, but narrow/broad anchor variants still fragile | continue resolver/filter tuning and parity checks |
| AQ-P0-07B | bank_operations_by_counterparty | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | positive cases confirmed, but narrow/broad anchor variants still fragile | continue resolver/filter tuning and bank-doc visibility checks |
| AQ-P0-08 | documents_by_contract | STRUCTURALLY_VISIBLE | REQUIRES_SPECIALIZED_RECIPE | by-contract live recipe not implemented in runtime V1 | implement contract resolver + focused recipe |
| AQ-P0-09 | documents_forming_balance | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | implemented, but account-family still blocked before materialization | account scope/materialization diagnostics and account token normalization |
| AQ-P1-10 | account_turnover_snapshot | STRUCTURALLY_VISIBLE | LIVE_QUERYABLE_WITH_LIMITS | not in current intent set | extend intents in V1.1 |
## Примечание
Матрица разделяет "видимость сущности в inventory" и "операционную готовность live-runtime".
Это обязательная опора для приоритезации Sprint B, чтобы не путать structural coverage и runtime proofability.
### Sync note (M2.3b -> live dry-run)
`account_balance_snapshot` intentionally remains `LIVE_QUERYABLE_WITH_LIMITS`.
Reason: dry-run still shows repeatable `empty_match` on broad `as_of=today` prompts.
Promote to `LIVE_QUERYABLE` only after data-aware positive live cases are stable.
`documents_forming_balance` is implemented with strict account-scope path.
Validation should be based on data-aware acceptance suite, not only safety dry-run.
Stage-diagnostic replay (M2.3b) shows split-stage behavior:
`D1-D3`: `raw_rows_received > 0` with `rows_after_account_scope = 0` (strict account intents).
`D4-D5`: `rows_after_account_scope > 0` and `rows_materialized > 0`, but `rows_after_recipe_filter = 0` (preferred mode progressed to matching stage).
Current bottleneck moved forward for non-account intents: resolver/filter matching after materialization.
`COMPOUND_FACTUAL_QUERY` currently remains detection-only.
Multi-intent decomposition execution is not part of M2.3b and tracked for next increment.
## Sync Note (M2.3c)
- `documents_by_counterparty` and `bank_operations_by_counterparty` now have curated `matched_non_empty` cases.
- `account_balance_snapshot` and `documents_forming_balance` remain limited because rows are dropped before materialization.
- `COMPOUND_FACTUAL_QUERY` is detection-only and does not execute multi-intent decomposition yet.