feat(workflow): 显式化静态分析硬门禁与软建议边界、完善发布门禁与架构演进文档

This commit is contained in:
gitea committed 2026-10-20 13:30:23 +08:00
1 parent c1e94ce63e
commit 18da4cc066
9 files changed
+694 -438

No files matched your search

+58
View File
@@ -228,4 +228,62 @@ describe("CLI - workflow nodes 字典探针与灰度开通测试", () => {
expect(result.success).toBe(true);
expect(grantSpy).toHaveBeenCalled();
});
it("workflow analyze: 显式输出硬门禁与软建议边界,且支持 --fail 退出码门禁", async () => {
spies.push(
spyOn(helpers, "createClientsForCorp").mockResolvedValue({
ekbClient: {},
easoClient: {},
} as any),
spyOn(helpers, "createPiperClientForCorp").mockResolvedValue({} as any),
spyOn(services, "getWorkflowDetail").mockResolvedValue({
id: "wf-gate-test",
label: "门禁测试流程",
state: 0,
version: "1",
tasks: [
{
name: "bad_node",
type: "code-js2",
label: "未开通JS2节点",
code: "return 1;",
},
],
} as any),
spyOn(services, "getWorkflowAvailableNodes").mockResolvedValue({
allTypes: new Set(["http", "code"]),
catalog: { action: [], control: [], trigger: [] },
} as any)
);
// 1. 常规运行(无 --fail):展示门禁裁决,exitCode 为 0
const normalRes = await handleWorkflowCommand(
{
action: "analyze",
args: ["wf-gate-test"],
options: {},
raw: ["workflow", "analyze", "wf-gate-test"],
},
mockRuntime
);
expect(normalRes.exitCode).toBe(0);
expect(normalRes.stdout).toContain("门禁裁决");
expect(normalRes.stdout).toContain("硬门禁数");
expect(normalRes.stdout).toContain("软建议数");
expect(normalRes.stdout).toContain("⛔ 硬门禁");
expect(normalRes.stdout).toContain("💡 软建议");
expect(normalRes.stdout).toContain("PERMISSION_MISSING_NODE");
// 2. 带 --fail 运行:检测到硬门禁,exitCode 为 2
const failRes = await handleWorkflowCommand(
{
action: "analyze",
args: ["wf-gate-test"],
options: { fail: true },
raw: ["workflow", "analyze", "wf-gate-test", "--fail"],
},
mockRuntime
);
expect(failRes.exitCode).toBe(2);
});
});