fix: 标明工作流扫描与分析证据完整性

保留不完整扫描中的既有告警指纹,并展示分页和分析证据不足。
This commit is contained in:
gitea committed 2026-10-30 17:37:05 +08:00
1 parent c6d71843b7
commit c813498da2
8 files changed
+84 -22

No files matched your search

@@ -172,6 +172,19 @@ describe("workflow draft state machine", () => {
rmSync(dir, { recursive: true, force: true });
});
it("preserves previously observed alerts when a scan is incomplete", () => {
const dir = mkdtempSync("hose-workflow-alert-partial-");
const file = join(dir, "alerts.json");
const store = new WorkflowAlertStore(file);
const alert = { id: "corp:platform:wf-1", pipelineId: "wf-1", platformId: "platform-1", pipelineName: "测试流程", errorCount: 1, state: 0, observedAt: 1 };
expect(store.observe([alert]).newAlerts).toHaveLength(1);
store.observe([], { complete: false });
expect(store.observe([{ ...alert, observedAt: 2 }], { complete: false }).newAlerts).toHaveLength(0);
store.observe([], { complete: true });
expect(store.observe([alert]).newAlerts).toHaveLength(1);
rmSync(dir, { recursive: true, force: true });
});
it("tracks dirty revisions and commits the server snapshot", () => {
let state = createWorkflowDraft(workflow());
state = patchWorkflowDraft(state, (current) => ({ ...current, label: "已修改" }), ["label"]);