ARCH: ранжировать metadata surface objects только для честного tie-break
This commit is contained in:
@@ -435,6 +435,50 @@ describe("assistant MCP discovery pilot executor", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("can break a weak metadata family tie by ranking surface objects against the requested scope", async () => {
|
||||
const planner = planAssistantMcpDiscovery({
|
||||
turnMeaning: {
|
||||
asked_domain_family: "metadata",
|
||||
asked_action_family: "inspect_surface",
|
||||
explicit_entity_candidates: ["НДС"]
|
||||
}
|
||||
});
|
||||
const deps = buildMetadataDeps([
|
||||
{
|
||||
FullName: "Document.НДССчетФактура",
|
||||
MetaType: "Document",
|
||||
attributes: [{ Name: "Дата" }]
|
||||
},
|
||||
{
|
||||
FullName: "AccumulationRegister.BankOperations",
|
||||
MetaType: "AccumulationRegister",
|
||||
resources: [{ Name: "Amount" }]
|
||||
}
|
||||
]);
|
||||
|
||||
const result = await executeAssistantMcpDiscoveryPilot(planner, deps);
|
||||
|
||||
expect(result.pilot_status).toBe("executed");
|
||||
expect(result.derived_metadata_surface).toMatchObject({
|
||||
metadata_scope: "НДС",
|
||||
available_entity_sets: ["Document", "AccumulationRegister"],
|
||||
selected_entity_set: null,
|
||||
selected_surface_objects: ["Document.НДССчетФактура"],
|
||||
surface_family_scores: {
|
||||
document_evidence: 1,
|
||||
movement_evidence: 1,
|
||||
catalog_drilldown: 0
|
||||
},
|
||||
downstream_route_family: "document_evidence",
|
||||
route_family_selection_basis: "dominant_surface_objects",
|
||||
recommended_next_primitive: "query_documents",
|
||||
ambiguity_detected: false,
|
||||
ambiguity_entity_sets: [],
|
||||
surface_object_ranking_applied: true
|
||||
});
|
||||
expect(result.reason_codes).toContain("pilot_selected_metadata_route_family_from_surface_object_ranking");
|
||||
});
|
||||
|
||||
it("keeps metadata ambiguity unresolved when surface-family scores are nearly tied", async () => {
|
||||
const planner = planAssistantMcpDiscovery({
|
||||
turnMeaning: {
|
||||
|
||||
Reference in New Issue
Block a user