АДРЕСНЫЙ РЕЖИМ - M2.3b тюнинг account-scope и диагностика стадий адресного рантайма
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# Run: 2026-03-29 Address Runtime Pivot Baseline
|
||||
|
||||
Тип прогона: архитектурный baseline-аудит перед реализацией address-lane.
|
||||
|
||||
## Цель
|
||||
|
||||
Подтвердить фактическое состояние:
|
||||
|
||||
1. текущий assistant runtime = snapshot-primary;
|
||||
2. live MCP = overlay и не для всех маршрутов;
|
||||
3. Postgres не является активным runtime-слоем в assistant path;
|
||||
4. требуется отдельный MCP-first lane для address-вопросов.
|
||||
|
||||
## Состав артефактов
|
||||
|
||||
- `run_summary.json`
|
||||
- `postgres_runtime_check.json`
|
||||
- `source_inventory.json`
|
||||
- `code_path_inventory.md`
|
||||
|
||||
## Краткий результат
|
||||
|
||||
Статус: `BASELINE_CONFIRMED`.
|
||||
|
||||
Ключевой вывод:
|
||||
|
||||
- технически проще и быстрее добавить отдельный `address_query` lane поверх текущего Stage 4, чем пытаться продолжать расширять snapshot-first path под новый класс задач.
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# Architecture Findings
|
||||
|
||||
## Confirmed
|
||||
|
||||
1. Current assistant execution is snapshot-primary, MCP-secondary.
|
||||
2. Large full snapshots exist, but assistant reads only narrow export samples.
|
||||
3. Existing claim-bound live path was designed for deep accounting families (VAT/RBP/FA), not address lookup UX.
|
||||
4. Canonical store DB layer is present (SQLite now, Postgres optional), but not part of active assistant runtime retrieval path.
|
||||
|
||||
## Decision for next implementation wave
|
||||
|
||||
1. Keep Stage 4 deep-chain flow unchanged.
|
||||
2. Add `address_query` lane with MCP-first source policy.
|
||||
3. Define explicit address intents, recipes, and response contract.
|
||||
4. Keep snapshot fallback explicit and limited (no silent substitution).
|
||||
|
||||
## Baseline verdict
|
||||
|
||||
`BASELINE_CONFIRMED_FOR_MCP_FIRST_ADDRESS_PIVOT`
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
# Code Path Inventory (Address Pivot Baseline)
|
||||
|
||||
## A. Assistant runtime data path
|
||||
|
||||
1. `llm_normalizer/backend/src/services/assistantDataLayer.ts:2804`
|
||||
`AssistantDataLayer` uses `ARCH_EXPORT_2020_DIR` root by default.
|
||||
|
||||
2. `llm_normalizer/backend/src/services/assistantDataLayer.ts:3379-3386`
|
||||
Runtime loads fixed sample files from `docs/ARCH/2020экспорт` (narrow package).
|
||||
|
||||
3. `llm_normalizer/backend/src/services/assistantDataLayer.ts:2858-2863`
|
||||
MCP overlay is runtime-optional and route-limited.
|
||||
|
||||
4. `llm_normalizer/backend/src/services/assistantDataLayer.ts:332`
|
||||
`buildLiveMcpCallPlan(...)` generates live calls.
|
||||
|
||||
5. `llm_normalizer/backend/src/services/assistantDataLayer.ts:348,396,460,444`
|
||||
Claim-specific live plans exist for FA/VAT/RBP; else `claim_type: null`.
|
||||
|
||||
## B. Routing discipline
|
||||
|
||||
1. `llm_normalizer/backend/src/services/routeHintAdapter.ts:86-87`
|
||||
`exact_object_trace -> live_mcp_drilldown`.
|
||||
|
||||
2. `llm_normalizer/backend/src/services/routeHintAdapter.ts:149-150`
|
||||
`canonical_fact_lookup -> store_canonical` (snapshot-oriented path).
|
||||
|
||||
## C. MCP runtime config
|
||||
|
||||
1. `llm_normalizer/backend/src/config.ts:90-100`
|
||||
MCP feature flag and defaults:
|
||||
- `FEATURE_ASSISTANT_MCP_RUNTIME_V1` (default false),
|
||||
- `ASSISTANT_MCP_PROXY_URL=http://127.0.0.1:6003`,
|
||||
- `ASSISTANT_MCP_CHANNEL=default`.
|
||||
|
||||
2. `llm_normalizer/package.json:11`
|
||||
`dev:all:mcp` enables MCP flags for local dev.
|
||||
|
||||
## D. Canonical layer / DB
|
||||
|
||||
1. `.env.example:18` and `README.md:89`
|
||||
Default canonical DB URL is SQLite.
|
||||
|
||||
2. `canonical_layer/store.py:55,59`
|
||||
SQLAlchemy store supports non-SQLite URLs (including Postgres), but SQLite is default branch.
|
||||
|
||||
3. `canonical_layer/app.py:61,82,96,128`
|
||||
Canonical API exposes read and refresh endpoints (`/documents`, `/postings`, `/counterparties/...`, `/refresh/run`).
|
||||
|
||||
## E. Architectural implication
|
||||
|
||||
Для Address V1 достаточно внедрить новый `address_query` lane в assistant runtime и сделать его MCP-first.
|
||||
Это не требует немедленной обязательной миграции в Postgres, но требует разведения route/intents и отдельного answer contract.
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"dataset": "docs/ARCH/2020_monthly_company_asof_full/_tmp_ndjson",
|
||||
"total_files": 12,
|
||||
"total_mb": 6732,
|
||||
"files": [
|
||||
{ "name": "snapshot_2020-01.ndjson", "mb": 553.16 },
|
||||
{ "name": "snapshot_2020-02.ndjson", "mb": 554.27 },
|
||||
{ "name": "snapshot_2020-03.ndjson", "mb": 556.83 },
|
||||
{ "name": "snapshot_2020-04.ndjson", "mb": 557.63 },
|
||||
{ "name": "snapshot_2020-05.ndjson", "mb": 558.38 },
|
||||
{ "name": "snapshot_2020-06.ndjson", "mb": 561.38 },
|
||||
{ "name": "snapshot_2020-07.ndjson", "mb": 562.26 },
|
||||
{ "name": "snapshot_2020-08.ndjson", "mb": 563.23 },
|
||||
{ "name": "snapshot_2020-09.ndjson", "mb": 564.69 },
|
||||
{ "name": "snapshot_2020-10.ndjson", "mb": 565.01 },
|
||||
{ "name": "snapshot_2020-11.ndjson", "mb": 566.03 },
|
||||
{ "name": "snapshot_2020-12.ndjson", "mb": 569.14 }
|
||||
]
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"check_date": "2026-03-29",
|
||||
"postgres_process_detected": false,
|
||||
"canonical_db_url_in_env_example": "sqlite:///X:/1C/NDC_1C/data/canonical_store.db",
|
||||
"canonical_store_sqlite_file": {
|
||||
"path": "X:/1C/NDC_1C/data/canonical_store.db",
|
||||
"exists": true,
|
||||
"size_bytes": 6594560
|
||||
},
|
||||
"assistant_runtime_direct_db_dependency_detected": false,
|
||||
"notes": [
|
||||
"Postgres is currently optional in canonical layer design, not mandatory in assistant runtime path.",
|
||||
"Assistant runtime uses snapshot files and optional MCP overlay; it is not wired to canonical store reads."
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"run_id": "2026-03-29_Address_Runtime_Pivot_Baseline",
|
||||
"date_utc": "2026-03-29",
|
||||
"scope": "architecture_audit_for_mcp_first_address_queries",
|
||||
"source_of_truth": [
|
||||
"llm_normalizer/backend/src/services/assistantDataLayer.ts",
|
||||
"llm_normalizer/backend/src/services/routeHintAdapter.ts",
|
||||
"llm_normalizer/backend/src/config.ts",
|
||||
"canonical_layer/store.py",
|
||||
"canonical_layer/app.py",
|
||||
".env.example",
|
||||
"README.md"
|
||||
],
|
||||
"key_findings": [
|
||||
"assistant runtime currently loads a narrow snapshot package (2020export) as primary source",
|
||||
"live MCP is optional (feature-flagged) and route-limited overlay",
|
||||
"current claim-bound live plan is focused on VAT/RBP/FA and does not define address-query intents",
|
||||
"canonical layer supports SQLAlchemy db_url, but assistant runtime does not directly use canonical store",
|
||||
"sqlite canonical store file exists, postgres process was not detected"
|
||||
],
|
||||
"verdict": "MCP_INFRA_EXISTS_BUT_ADDRESS_RUNTIME_NOT_IMPLEMENTED",
|
||||
"next_status_target": "ADDRESS_RUNTIME_V1_READY"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"snapshot_primary_runtime_package": {
|
||||
"path": "X:/1C/NDC_1C/docs/ARCH/2020экспорт",
|
||||
"files_total": 10,
|
||||
"total_bytes": 1913578,
|
||||
"total_mb": 1.82,
|
||||
"files": [
|
||||
"03_snapshot_fragment_problem_cases.json",
|
||||
"04_samples_SpisanieSRaschetnogoScheta.json",
|
||||
"05_samples_RealizaciyaTovarovUslug.json",
|
||||
"06_samples_PostuplenieTovarovUslug.json",
|
||||
"07_samples_DocumentJournals.json",
|
||||
"08_samples_NDS_registers.json",
|
||||
"09_samples_key_fields_Recorder_Ref_Supplier_Buyer_Responsible.json"
|
||||
]
|
||||
},
|
||||
"full_monthly_snapshot_corpus": {
|
||||
"path": "X:/1C/NDC_1C/docs/ARCH/2020_monthly_company_asof_full/_tmp_ndjson",
|
||||
"files_total": 12,
|
||||
"total_bytes": 7059009054,
|
||||
"total_mb": 6732,
|
||||
"average_file_mb": 561
|
||||
},
|
||||
"live_mcp_channel_defaults": {
|
||||
"proxy_url_default": "http://127.0.0.1:6003",
|
||||
"channel_default": "default",
|
||||
"feature_flag_default": false
|
||||
},
|
||||
"conclusion": "large_gap_between_available_snapshot_volume_and_runtime_loaded_snapshot_volume_confirmed"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user