吸收数字员工跨设备策略冲突视图

This commit is contained in:
baiyanyun
2026-06-12 21:48:33 +08:00
parent b3f21adecb
commit 8a5d5d6474
13 changed files with 643 additions and 9 deletions

View File

@@ -1655,6 +1655,41 @@ describe("digital employee sync service", () => {
},
},
});
insertEventEntity("event-risk-policy-pull", "digital_workday_pull_risk_approval_policy", {
metadata: {
action: "pull_risk_approval_policy",
source: "management-api",
ok: true,
risk_approval_policy: {
enabled: true,
source: "remote",
version: "risk-policy-v2",
approval_required_risk_levels: ["high", "critical"],
approval_required_actions: ["managed_service.restart.*"],
auto_reject_actions: ["service.stop.*"],
remote_updated_at: "2026-06-07T08:10:00.000Z",
last_pulled_at: "2026-06-07T08:11:00.000Z",
},
},
});
insertEventEntity("event-route-policy-pull", "digital_workday_pull_route_decision_policy", {
metadata: {
action: "pull_route_decision_policy",
source: "management-api",
ok: true,
route_decision_policy: {
enabled: true,
source: "remote",
version: "route-policy-v3",
auto_create_governance_commands: false,
blocked_intents: ["delete"],
approval_required_intents: ["restart_service"],
preferred_route_kinds: ["PlanStepDispatch"],
remote_updated_at: "2026-06-07T08:12:00.000Z",
last_pulled_at: "2026-06-07T08:13:00.000Z",
},
},
});
insertEventEntity("event-risk-approval", "risk_approval_required", {
action_kind: "managed_service.restart.crm-sync",
action_label: "重启 CRM 同步服务",
@@ -1701,6 +1736,8 @@ describe("digital employee sync service", () => {
{ entity_type: "event", entity_id: "event-approval-subscriptions" },
{ entity_type: "event", entity_id: "event-plan-step-policy" },
{ entity_type: "event", entity_id: "event-plan-step-policy-pull" },
{ entity_type: "event", entity_id: "event-risk-policy-pull" },
{ entity_type: "event", entity_id: "event-route-policy-pull" },
{ entity_type: "event", entity_id: "event-risk-approval" },
],
}),
@@ -1990,27 +2027,58 @@ describe("digital employee sync service", () => {
expect(businessView("event-approval-subscriptions")).not.toHaveProperty("state");
expect(businessView("event-approval-subscriptions")).not.toHaveProperty("approvalSubscriptionPreferences");
expect(businessView("event-plan-step-policy")).toMatchObject({
category: "dispatch",
category: "policy_snapshot",
policy_kind: "dispatch",
policy_key: "dispatch",
action: "update_plan_step_dispatch_policy",
policy_enabled: false,
enabled: false,
max_per_sweep: 1,
auto_dispatch_ready_steps: false,
updated_at: "2026-06-07T08:07:00.000Z",
policy_version: "2026-06-07T08:07:00.000Z",
});
expect(businessView("event-plan-step-policy")).not.toHaveProperty("state");
expect(businessView("event-plan-step-policy")).not.toHaveProperty("planStepDispatchPolicy");
expect(businessView("event-plan-step-policy-pull")).toMatchObject({
category: "dispatch",
category: "policy_snapshot",
policy_kind: "dispatch",
policy_key: "dispatch",
action: "pull_plan_step_dispatch_policy",
source: "management-api",
pull_ok: false,
pull_error: "policy service unavailable",
policy_enabled: true,
enabled: true,
max_per_sweep: 2,
auto_dispatch_ready_steps: true,
remote_updated_at: "2026-06-07T08:08:00.000Z",
last_pulled_at: "2026-06-07T08:09:00.000Z",
});
expect(businessView("event-risk-policy-pull")).toMatchObject({
category: "policy_snapshot",
policy_kind: "risk_approval",
policy_key: "risk_approval",
policy_version: "risk-policy-v2",
policy_source: "management-api",
enabled: true,
approval_required_risk_levels: ["high", "critical"],
approval_required_actions: ["managed_service.restart.*"],
auto_reject_actions: ["service.stop.*"],
remote_updated_at: "2026-06-07T08:10:00.000Z",
last_pulled_at: "2026-06-07T08:11:00.000Z",
});
expect(businessView("event-route-policy-pull")).toMatchObject({
category: "policy_snapshot",
policy_kind: "route_decision",
policy_key: "route_decision",
policy_version: "route-policy-v3",
policy_source: "management-api",
enabled: true,
auto_create_governance_commands: false,
blocked_intents: ["delete"],
approval_required_intents: ["restart_service"],
preferred_route_kinds: ["PlanStepDispatch"],
remote_updated_at: "2026-06-07T08:12:00.000Z",
last_pulled_at: "2026-06-07T08:13:00.000Z",
});
expect(businessView("event-risk-approval")).toMatchObject({
category: "approval",
action_kind: "managed_service.restart.crm-sync",