吸收数字员工审批冲突与产物业务闭环

This commit is contained in:
baiyanyun
2026-06-12 16:29:01 +08:00
parent fffa0ebe50
commit 81d2797035
26 changed files with 2963 additions and 241 deletions

View File

@@ -1262,6 +1262,24 @@ describe("digital employee sync service", () => {
taskId: "task-1",
runId: "run-1",
});
insertEventEntity("event-approval-conflict-resolved", "approval_conflict_resolved", {
approval_id: "approval-conflict-1",
resolution: "keep_local",
status: "approved",
actor: "lead",
reason_codes: ["conflict_resolved"],
previous_reason: "terminal_status_mismatch",
previous_local_status: "approved",
previous_remote_status: "rejected",
resolved_at: "2026-06-07T08:00:00.000Z",
});
insertEventEntity("event-approval-conflict-rejected", "approval_conflict_resolution_rejected", {
approval_id: "approval-conflict-2",
resolution: "accept_remote",
status: "rejected",
actor: "lead",
reason_codes: ["remote_snapshot_missing"],
});
insertEventEntity("event-artifact", "artifact_retention_marked", {
artifact_id: "artifact-1",
action: "mark_keep",
@@ -1270,6 +1288,30 @@ describe("digital employee sync service", () => {
retention_status: "kept",
retention_until: "2026-07-01T00:00:00.000Z",
});
insertEventEntity("event-artifact-cleanup", "artifact_cleanup_executed", {
artifact_id: "artifact-1",
status: "deleted",
actor: "operator",
reason: "retention_expired",
reason_codes: ["retention_expired"],
deleted_at: "2026-06-07T08:06:00.000Z",
});
insertEventEntity("event-daily-report-send", "daily_report_send_recorded", {
report_id: "daily-report:2026-06-07:2026-06-07T08-00-00-000Z",
action: "send",
status: "sent",
actor: "operator",
endpoint: "management-console",
recorded_at: "2026-06-07T08:05:00.000Z",
});
insertEventEntity("event-daily-report-confirm", "daily_report_confirmed", {
report_id: "daily-report:2026-06-07:2026-06-07T08-00-00-000Z",
action: "confirm",
status: "confirmed",
actor: "management",
remote_id: "remote-report-1",
recorded_at: "2026-06-07T08:06:00.000Z",
});
insertEventEntity("event-skill", "skill_call_rejected", {
call_id: "call-1",
source: "qimingclaw-acp",
@@ -1569,7 +1611,12 @@ describe("digital employee sync service", () => {
{ entity_type: "event", entity_id: "event-route-intervention" },
{ entity_type: "event", entity_id: "event-approval" },
{ entity_type: "event", entity_id: "event-approval-decision" },
{ entity_type: "event", entity_id: "event-approval-conflict-resolved" },
{ entity_type: "event", entity_id: "event-approval-conflict-rejected" },
{ entity_type: "event", entity_id: "event-artifact" },
{ entity_type: "event", entity_id: "event-artifact-cleanup" },
{ entity_type: "event", entity_id: "event-daily-report-send" },
{ entity_type: "event", entity_id: "event-daily-report-confirm" },
{ entity_type: "event", entity_id: "event-skill" },
{ entity_type: "event", entity_id: "event-sandbox-audit" },
{ entity_type: "event", entity_id: "event-token-cost" },
@@ -1652,6 +1699,28 @@ describe("digital employee sync service", () => {
task_id: "task-1",
run_id: "run-1",
});
expect(businessView("event-approval-conflict-resolved")).toMatchObject({
category: "approval",
approval_id: "approval-conflict-1",
action: "conflict_resolution",
approval_conflict_resolution: "keep_local",
approval_conflict_resolution_actor: "lead",
approval_conflict_resolved_at: "2026-06-07T08:00:00.000Z",
status: "approved",
reason_codes: ["conflict_resolved"],
previous_reason: "terminal_status_mismatch",
previous_local_status: "approved",
previous_remote_status: "rejected",
});
expect(businessView("event-approval-conflict-rejected")).toMatchObject({
category: "approval",
approval_id: "approval-conflict-2",
action: "conflict_resolution",
approval_conflict_resolution: "accept_remote",
approval_conflict_resolution_actor: "lead",
status: "rejected",
reason_codes: ["remote_snapshot_missing"],
});
expect(businessView("event-artifact")).toMatchObject({
category: "artifact",
artifact_id: "artifact-1",
@@ -1661,6 +1730,31 @@ describe("digital employee sync service", () => {
retention_until: "2026-07-01T00:00:00.000Z",
actor: "operator",
});
expect(businessView("event-artifact-cleanup")).toMatchObject({
category: "artifact",
artifact_id: "artifact-1",
status: "deleted",
cleanup_status: "deleted",
cleanup_reason: "retention_expired",
deleted_at: "2026-06-07T08:06:00.000Z",
reason_codes: ["retention_expired"],
actor: "operator",
});
expect(businessView("event-daily-report-send")).toMatchObject({
category: "daily_report",
report_id: "daily-report:2026-06-07:2026-06-07T08-00-00-000Z",
action: "send",
status: "sent",
actor: "operator",
endpoint: "management-console",
});
expect(businessView("event-daily-report-confirm")).toMatchObject({
category: "daily_report",
report_id: "daily-report:2026-06-07:2026-06-07T08-00-00-000Z",
action: "confirm",
status: "confirmed",
remote_id: "remote-report-1",
});
expect(businessView("event-skill")).toMatchObject({
category: "skill",
call_id: "call-1",