Уточнить subject-оси Autonomy Core 1С

This commit is contained in:
2026-05-23 18:32:36 +03:00
parent 4d1b25cca7
commit 624e0cdf26
8 changed files with 224 additions and 16 deletions
@@ -336,6 +336,37 @@ describe("assistant MCP discovery data need graph", () => {
]);
expect(result.reason_codes).toContain("data_need_graph_open_scope_total_without_subject");
});
it("routes broad-overview one-sided incoming totals to value-flow instead of company overview", () => {
const result = buildAssistantMcpDiscoveryDataNeedGraph({
semanticDataNeed: "business overview evidence with bounded analyst interpretation",
rawUtterance:
"А всего сколько денег пришло в ООО Альтернатива Плюс за 2020, без топов и без контрагентов?",
turnMeaning: {
asked_domain_family: "business_overview",
asked_action_family: "broad_evaluation",
unsupported_but_understood_family: "broad_business_evaluation",
explicit_date_scope: "2020",
explicit_organization_scope: "ООО Альтернатива Плюс"
}
});
expect(result.business_fact_family).toBe("value_flow");
expect(result.action_family).toBe("turnover");
expect(result.comparison_need).toBeNull();
expect(result.ranking_need).toBeNull();
expect(result.clarification_gaps).toEqual([]);
expect(result.decomposition_candidates).toEqual([
"collect_scoped_movements",
"aggregate_checked_amounts",
"probe_coverage"
]);
expect(result.reason_codes).toContain("data_need_graph_open_scope_total_without_subject");
expect(result.reason_codes).toContain(
"data_need_graph_business_overview_one_sided_money_total_routed_to_value_flow"
);
});
it("treats a generic incoming total as an understood open-scope ask that still needs organization", () => {
const result = buildAssistantMcpDiscoveryDataNeedGraph({
semanticDataNeed: "counterparty value-flow evidence",
@@ -157,6 +157,68 @@ describe("assistant MCP discovery planner", () => {
expect(result.evidence_plan.evidence_axes.missing_axes).not.toContain("all_time_scope");
});
it("uses graph subject candidates to satisfy the selected subject evidence axis", () => {
const result = planAssistantMcpDiscovery({
dataNeedGraph: {
schema_version: "assistant_data_need_graph_v1",
policy_owner: "assistantMcpDiscoveryDataNeedGraph",
subject_candidates: ["SVK"],
business_fact_family: "value_flow",
action_family: "net_value_flow",
aggregation_need: null,
time_scope_need: "explicit_period",
comparison_need: "incoming_vs_outgoing",
ranking_need: null,
proof_expectation: "coverage_checked_fact",
clarification_gaps: [],
decomposition_candidates: [],
forbidden_overclaim_flags: ["no_raw_model_claims"],
reason_codes: ["data_need_graph_built"]
},
turnMeaning: {
asked_action_family: "net_value_flow",
explicit_date_scope: "2020"
}
});
expect(result.selected_chain_id).toBe("value_flow_comparison");
expect(result.evidence_plan.evidence_axes.required_axes).toContain("counterparty");
expect(result.evidence_plan.evidence_axes.provided_axes).toContain("business_entity");
expect(result.evidence_plan.evidence_axes.provided_axes).toContain("counterparty");
expect(result.evidence_plan.evidence_axes.missing_axes).not.toContain("counterparty");
});
it("does not coerce inventory item subjects into counterparty evidence axes", () => {
const result = planAssistantMcpDiscovery({
dataNeedGraph: {
schema_version: "assistant_data_need_graph_v1",
policy_owner: "assistantMcpDiscoveryDataNeedGraph",
subject_candidates: ["Столешница 600"],
business_fact_family: "inventory_purchase_provenance",
action_family: "purchase_provenance",
aggregation_need: null,
time_scope_need: null,
comparison_need: null,
ranking_need: null,
proof_expectation: "coverage_checked_fact",
clarification_gaps: [],
decomposition_candidates: [],
forbidden_overclaim_flags: ["no_raw_model_claims"],
reason_codes: ["data_need_graph_built"]
},
turnMeaning: {
asked_action_family: "purchase_provenance"
}
});
expect(result.selected_chain_id).toBe("inventory_purchase_provenance");
expect(result.evidence_plan.evidence_axes.required_axes).toContain("item");
expect(result.evidence_plan.evidence_axes.provided_axes).toContain("business_entity");
expect(result.evidence_plan.evidence_axes.provided_axes).toContain("item");
expect(result.evidence_plan.evidence_axes.provided_axes).not.toContain("counterparty");
expect(result.evidence_plan.evidence_axes.missing_axes).not.toContain("item");
});
it("keeps representative graph-selected chains aligned with top catalog template matches", () => {
const graph = (
businessFactFamily: string,