Архитектура: централизовать inventory pivot flags и carryover target intent в continuity policy

This commit is contained in:
2026-04-19 12:53:15 +03:00
parent 15662cfe4f
commit d1ad8e2c1b
6 changed files with 207 additions and 76 deletions
@@ -12,6 +12,8 @@ import {
resolveAddressDebugContextFacts,
resolveAddressDebugAnchorContext,
resolveDisplayedEntityFollowupRetarget,
resolveFollowupTargetIntent,
resolveInventoryFollowupPivotFlags,
resolveAssistantOrganizationAuthority
} from "../src/services/assistantContinuityPolicy";
@@ -254,6 +256,45 @@ describe("assistantContinuityPolicy organization authority", () => {
});
});
it("resolves inventory root pivots through one shared helper", () => {
const flags = resolveInventoryFollowupPivotFlags(
{ intent: "inventory_on_hand_as_of_date" },
"inventory_purchase_documents_for_item",
"inventory_drilldown",
false,
false,
true,
false,
false,
false,
false,
false,
(intent) => String(intent ?? "") === "inventory_purchase_documents_for_item",
(intent) => String(intent ?? "") === "inventory_on_hand_as_of_date"
);
expect(flags).toEqual({
rootScopedPivot: true,
explicitInventorySameDatePivot: false
});
});
it("resolves follow-up target intent precedence through one shared helper", () => {
const targetIntent = resolveFollowupTargetIntent(
false,
null,
null,
"customer_revenue_and_payments",
"carry_root_context",
"inventory_on_hand_as_of_date",
"list_contracts_by_counterparty",
"customer_revenue_and_payments",
false
);
expect(targetIntent).toBe("inventory_on_hand_as_of_date");
});
it("applies organization carryover precedence from historical to shared authority to navigation and clarification", () => {
const filters = applyOrganizationCarryoverFilters(
{},