ГЛОБАЛЬНЫЙ РЕФАКТОРИНГ АРХИТЕКТУРЫ - Рефакторинг этапов Stage 3.7 ХВОСТЫ фикс маршрутов по домену задолжностей
This commit is contained in:
+136
-1
@@ -2453,13 +2453,148 @@ Implemented in current pass (Stage 3.6 route arbitration hardening + followup is
|
||||
- Targeted regression pack: `4` files / `318` tests passed (`assistantLivingRouter`, `assistantLivingChatMode`, `addressQueryRuntimeM23`, `assistantSoftPolicyReply`).
|
||||
- Type build: `npm --prefix llm_normalizer/backend run build` passed.
|
||||
|
||||
Implemented in current pass (Stage 3.7 real-run regression hardening, 2026-04-11):
|
||||
1. Added a dedicated regression pack from real failing runs:
|
||||
- New test file:
|
||||
- `llm_normalizer/backend/tests/assistantWave17RunRegression20260411.test.ts`
|
||||
2. Covered two production run cohorts directly:
|
||||
- `assistant-stage1-aXaATwBpP6` (2026-04-11 14:59 local run family)
|
||||
- `assistant-stage1-RAvQiKIFKX` (2026-04-11 17:51 local run family)
|
||||
3. Locked critical route/answer protections from these runs:
|
||||
- data-heavy prompts remain in address lane (no accidental chat drift);
|
||||
- short follow-up style prompts (`без воды?`, `и коротко?`, `прям сейчас?`) stay in deep fallback when predecompose is unsupported (no generic chat fallback);
|
||||
- slang data-scope wording (`по каким конторам можем общаться?`) remains in chat meta/data-scope mode;
|
||||
- open-contract request with stale deep follow-up context keeps address lane priority;
|
||||
- unsupported aggregate answers use soft-refusal structure and no longer rely on old rigid phrase (`Сейчас этот тип вопроса вне поддерживаемого контура адресного режима...`).
|
||||
4. Validation snapshot:
|
||||
- New regression file: `1` file / `5` tests passed.
|
||||
- Extended focused suite: `6` files / `66` tests passed (`assistantWave17RunRegression20260411`, `assistantLivingRouter`, `assistantLivingChatMode`, `assistantSoftPolicyReply`, `assistantBoundaryFallbackReply`, `assistantAnswerPolicyV11`).
|
||||
|
||||
Implemented in current pass (Stage 3.8 manual-comment wave hardening, 2026-04-11):
|
||||
1. Added manual-comment regression pack based on unresolved GUI annotations:
|
||||
- New test file:
|
||||
- `llm_normalizer/backend/tests/assistantWave18ManualCommentsRegression.test.ts`
|
||||
- Scope:
|
||||
- 18 unresolved manual comments from:
|
||||
- `assistant-stage1-UMKkFYfg2L`
|
||||
- `assistant-stage1-ywEyJgFkC4`
|
||||
- `assistant-stage1-ZL97weIIRG`
|
||||
2. Hardened intent recognition for weakly-structured real phrasing in address lane:
|
||||
- `llm_normalizer/backend/src/services/addressIntentResolver.ts`
|
||||
- Improvements:
|
||||
- supplier-tail wording (`не закрывают счета`, `больше месяца`) now maps to supported payables/open-items intent;
|
||||
- receivables latency wording (`не платят несколько месяцев`, payment-vs-shipment imbalance, negative saldo risk) now maps to supported receivables intent;
|
||||
- stuck advances wording (`зависшие авансы`, `пора закрыть`, `перепривязать`, `списывать`) now maps to settlement-gap/open-contracts intent.
|
||||
3. Hardened orchestration tool-gate against false capability drift on data requests:
|
||||
- `llm_normalizer/backend/src/services/assistantService.ts`
|
||||
- Improvements:
|
||||
- retrieval-action/object detection expanded for imperative finance requests (`проверь` + `аванс/отгруз/долг` objects);
|
||||
- tool-gate now uses both raw and repaired message variants for classifier/intent signals to avoid false negatives from over-repair.
|
||||
4. Updated reason-code expectations in route regressions after new intent-signal source:
|
||||
- `llm_normalizer/backend/tests/assistantWave17RunRegression20260411.test.ts`
|
||||
- `llm_normalizer/backend/tests/assistantLivingRouter.test.ts`
|
||||
5. Validation snapshot:
|
||||
- Focused regression pack: `4` files / `58` tests passed:
|
||||
- `assistantWave17RunRegression20260411.test.ts`
|
||||
- `assistantWave18ManualCommentsRegression.test.ts`
|
||||
- `assistantLivingRouter.test.ts`
|
||||
- `assistantLivingChatMode.test.ts`
|
||||
- Build validation:
|
||||
- `npm run build` (backend) passed.
|
||||
|
||||
Implemented in current pass (Stage 3.9 anti-template risk-lane stabilization, 2026-04-11):
|
||||
1. Removed hard `missing_anchor` gate for broad open-items scans:
|
||||
- `llm_normalizer/backend/src/services/addressQueryService.ts`
|
||||
- `open_items_by_counterparty_or_contract` can now run as a broad risk scan without mandatory counterparty/contract anchor.
|
||||
2. Stopped wrong-domain leakage in risk intents:
|
||||
- `llm_normalizer/backend/src/services/addressRecipeCatalog.ts`
|
||||
- switched to strict account scope for:
|
||||
- `list_payables_counterparties` (`60/76`)
|
||||
- `list_receivables_counterparties` (`62/76`)
|
||||
- `list_open_contracts` (`60/62/76`)
|
||||
3. Added future-date guard for risk replies:
|
||||
- `llm_normalizer/backend/src/services/addressQueryService.ts`
|
||||
- rows far beyond analysis/reference date (e.g., synthetic `2030-*`) are excluded from factual reply assembly for risk intents.
|
||||
4. Expanded anchor-recovery behavior for risk lanes:
|
||||
- when initial slice has raw rows but zero rows after strict account scope, runtime can auto-expand live limit for recovery (instead of silent fallback to irrelevant rows).
|
||||
5. Reworked factual composer for risk intents to reduce repeated templates:
|
||||
- `llm_normalizer/backend/src/services/address_runtime/composeStage.ts`
|
||||
- for payables/receivables/open-items/open-contracts now builds counterparty risk ranking (sum + ops + last period) before raw row fallback.
|
||||
6. Regression updates:
|
||||
- `llm_normalizer/backend/tests/addressQueryRuntimeM23.test.ts`
|
||||
- updated open-items no-anchor expectation to match new broad-scan contract;
|
||||
- added checks for strict scope and anti-leak behavior in receivables/open-contract intents.
|
||||
7. Validation snapshot:
|
||||
- `npm.cmd run test -- --run tests/addressQueryRuntimeM23.test.ts` -> `271 passed`
|
||||
- `npm.cmd run test -- --run tests/addressQueryRuntimeM23.test.ts tests/assistantWave17RunRegression20260411.test.ts` -> `274 passed`
|
||||
- `npm run build` (backend) passed.
|
||||
|
||||
Implemented in current pass (Stage 3.10 debt-lifecycle routing for reviewer comment AUTO-004, 2026-04-11):
|
||||
1. Added explicit intent arbitration for debt-longevity customer phrasing:
|
||||
- `llm_normalizer/backend/src/services/addressIntentResolver.ts`
|
||||
- New signal `hasCounterpartyDebtLongevitySignal(...)` routes queries like
|
||||
`Сколько заказчиков ... долгожителями по задолженностям` to
|
||||
`counterparty_activity_lifecycle` instead of `open_items_by_counterparty_or_contract`.
|
||||
2. Prevented open-items override for this class of queries:
|
||||
- Open-items branch now skips debt-longevity customer wording, preserving lifecycle route.
|
||||
3. Expanded lifecycle recipe to support year-based ranking:
|
||||
- `llm_normalizer/backend/src/services/addressRecipeCatalog.ts`
|
||||
- `COUNTERPARTY_ACTIVITY_LIFECYCLE_QUERY_TEMPLATE` now includes yearly aggregate marker
|
||||
`CP_CUSTOMER_ACTIVITY_YEAR` (counterparty x year).
|
||||
4. Reworked lifecycle composer for debt-longevity question style:
|
||||
- `llm_normalizer/backend/src/services/address_runtime/composeStage.ts`
|
||||
- Added deterministic top-10 output by:
|
||||
- number of active years,
|
||||
- operation frequency,
|
||||
- period span;
|
||||
- Response now explicitly provides `лет в базе` and year list.
|
||||
5. Added regression coverage:
|
||||
- `llm_normalizer/backend/tests/addressQueryRuntimeM23.test.ts`
|
||||
- new checks for:
|
||||
- resolver mapping of debt-longevity wording to lifecycle intent;
|
||||
- address runtime route + recipe selection;
|
||||
- factual reply contains top ranking by years.
|
||||
6. Validation snapshot:
|
||||
- `npm.cmd run test -- --run tests/addressQueryRuntimeM23.test.ts` -> `274 passed`
|
||||
- `npm.cmd run test -- --run tests/assistantWave17RunRegression20260411.test.ts tests/assistantLivingRouter.test.ts tests/assistantLivingChatMode.test.ts` -> `55 passed`
|
||||
- `npm run build` (backend) passed.
|
||||
|
||||
Implemented in current pass (Stage 3.11 unresolved manual-comment routing hardening, 2026-04-11):
|
||||
1. Expanded semantic routing for overdue receivables and settlement-gap phrasing from unresolved reviewer cases:
|
||||
- `llm_normalizer/backend/src/services/addressIntentResolver.ts`
|
||||
- Added overdue-deadline cue support (`сроки ... прошли`) for non-payment receivables wording.
|
||||
- Added settlement-gap signals for:
|
||||
- payments without settlement closure (`оплаты без закрытия взаиморасчетов`);
|
||||
- shipments without closing docs (`отгрузки без документов для закрытия`);
|
||||
- closing without supporting docs (`закрытие счетов без подтверждающих документов`).
|
||||
2. Locked new routing with regression coverage:
|
||||
- `llm_normalizer/backend/tests/addressQueryRuntimeM23.test.ts`
|
||||
- Added resolver + runtime checks for the exact unresolved wave wording above.
|
||||
3. Stabilized Wave18 regression harness against annotation-state drift:
|
||||
- `llm_normalizer/backend/tests/assistantWave18ManualCommentsRegression.test.ts`
|
||||
- Removed brittle hard dependency on `resolved=false` for all fixed keys.
|
||||
- Kept live runtime assertions on unresolved subset and increased explicit timeout for integration path.
|
||||
4. Validation snapshot:
|
||||
- Stage 3 focused suite:
|
||||
- `tests/addressQueryRuntimeM23.test.ts`
|
||||
- `tests/assistantWave18ManualCommentsRegression.test.ts`
|
||||
- `tests/assistantWave17RunRegression20260411.test.ts`
|
||||
- `tests/assistantLivingRouter.test.ts`
|
||||
- `tests/assistantLivingChatMode.test.ts`
|
||||
- `tests/assistantSoftPolicyReply.test.ts`
|
||||
- `tests/assistantBoundaryFallbackReply.test.ts`
|
||||
- `tests/assistantAnswerPolicyV11.test.ts`
|
||||
- `tests/assistantSemanticExtractionContract.test.ts`
|
||||
- Result: `9 files / 354 tests passed`.
|
||||
- `npm run build` (backend) passed.
|
||||
|
||||
Acceptance (Stage 3):
|
||||
1. LLM outputs strictly validated schema for extraction/decomposition (no free-form).
|
||||
2. Deterministic guards can block or downgrade answers when evidence insufficient.
|
||||
3. False route drifts and generic responses reduced in regression packs.
|
||||
4. Manual markup shows increase in “correct/grounded” labels.
|
||||
|
||||
Status: Planned
|
||||
Status: In validation (functional gates green; manual re-markup trend confirmation pending)
|
||||
|
||||
## Stage 4 (P2): Human-Centric Answer Layer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user