Post-F: зафиксировать VAT materialization и приоритет явного контрагента

This commit is contained in:
2026-04-23 23:39:55 +03:00
parent 92cd272efc
commit 2f282f1479
6 changed files with 159 additions and 24 deletions
@@ -5177,6 +5177,8 @@ describe("address recipe catalog counterparty filtering", () => {
expect(plan.query).toContain("РегистрНакопления.НДСЗаписиКнигиПокупок");
expect(plan.query).toContain("VAT_BOOK_SALES");
expect(plan.query).toContain("VAT_BOOK_PURCHASES");
expect(plan.query).toContain("ДАТАВРЕМЯ(2019, 12, 31, 23, 59, 59)");
expect(plan.query).not.toContain("ДАТАВРЕМЯ(2000, 1, 1, 0, 0, 0) КАК Период");
});
it("keeps inventory-on-hand phrasing in address lane", () => {
@@ -133,6 +133,50 @@ describe("assistant MCP discovery turn input adapter", () => {
expect(result.reason_codes).not.toContain("mcp_discovery_payout_signal_detected");
});
it("prefers the explicit current-turn counterparty over stale organization-scoped carryover in net follow-up discovery", () => {
const result = buildAssistantMcpDiscoveryTurnInput({
userMessage: "какое нетто по деньгам с Группа СВК за 2020 год: сколько получили и сколько заплатили?",
assistantTurnMeaning: {
asked_domain_family: "counterparty_value",
asked_action_family: "net_value_flow",
explicit_entity_candidates: ["Альтернатива Плюс"],
explicit_organization_scope: "ООО Альтернатива Плюс",
explicit_date_scope: "2020",
unsupported_but_understood_family: "counterparty_bidirectional_value_flow_or_netting",
stale_replay_forbidden: true
},
predecomposeContract: {
entities: { counterparty: "Группа СВК" },
period: { period_from: "2020-01-01", period_to: "2020-12-31" }
},
followupContext: {
previous_intent: "counterparty_activity_lifecycle",
previous_filters: {
organization: "ООО Альтернатива Плюс",
counterparty: "Альтернатива Плюс",
period_from: "2020-01-01",
period_to: "2020-12-31"
},
previous_anchor_type: "organization",
previous_anchor_value: "ООО Альтернатива Плюс"
}
});
expect(result.adapter_status).toBe("ready");
expect(result.should_run_discovery).toBe(true);
expect(result.turn_meaning_ref).toMatchObject({
asked_domain_family: "counterparty_value",
asked_action_family: "net_value_flow",
explicit_entity_candidates: ["Группа СВК"],
explicit_organization_scope: "ООО Альтернатива Плюс",
explicit_date_scope: "2020",
unsupported_but_understood_family: "counterparty_bidirectional_value_flow_or_netting",
stale_replay_forbidden: true
});
expect(result.turn_meaning_ref?.metadata_scope_hint).toBeUndefined();
expect(result.data_need_graph?.subject_candidates).toEqual(["Группа СВК"]);
});
it("captures monthly aggregation as part of bidirectional value-flow meaning", () => {
const result = buildAssistantMcpDiscoveryTurnInput({
userMessage: "какое нетто по деньгам с Группа СВК за 2020 год по месяцам: сколько получили и сколько заплатили помесячно?",