feat(workflow): allow enabled workflow debugging with full security prompts instead of hard block

This commit is contained in:
gitea committed 2026-10-15 14:19:00 +08:00
1 parent f6227f277a
commit c507879896
3 files changed
+19 -89

No files matched your search

+8 -55
View File
@@ -678,7 +678,7 @@ describe("CLI - workflow job 执行详情与异常精准透视", () => {
expect(res.stdout).toContain("control_1");
});
it("blocks workflow test when pipeline is enabled in production without --force", async () => {
it("allows workflow test when pipeline is enabled in production with full security prompt", async () => {
const mockClient = {
get: (url: string) => {
if (url.includes("api/easo/pipelines/")) {
@@ -693,54 +693,6 @@ describe("CLI - workflow job 执行详情与异常精准透视", () => {
}),
};
}
return { json: async () => ({ code: 200, data: null }) };
},
post: () => ({ json: async () => ({ code: 200, data: null }) }),
};
spies.push(
spyOn(helpers, "createClientsForCorp").mockResolvedValue({
ekbClient: mockClient as any,
easoClient: mockClient as any,
corp: mockCorp,
} as any)
);
spies.push(
spyOn(helpers, "createPiperClientForCorp").mockResolvedValue(mockClient as any)
);
const res = await handleWorkflowCommand(
{
area: "workflow",
action: "test",
args: ["wf_prod_1"],
options: { flow: "ZJ-20261015-001387", platformId: "p1" },
raw: ["workflow", "test", "wf_prod_1", "--flow=ZJ-20261015-001387", "--platform-id=p1"],
},
mockRuntime
);
expect(res.exitCode).toBe(1);
expect(res.stderr).toContain("安全防御拦截");
expect(res.stderr).toContain("生产启用中");
expect(res.stderr).toContain("--force");
});
it("allows workflow test when pipeline is enabled in production with --force", async () => {
const mockClient = {
get: (url: string) => {
if (url.includes("api/easo/pipelines/")) {
return {
json: async () => ({
code: 200,
data: {
id: "wf_prod_1",
label: "生产自动审批工作流",
state: 1,
},
}),
};
}
if (url.includes("execution")) {
return {
json: async () => ({
@@ -761,7 +713,7 @@ describe("CLI - workflow job 执行详情与异常精准透视", () => {
json: async () => ({
code: 200,
data: {
id: "job_force_999",
id: "job_prod_999",
pipelineId: "wf_prod_1",
status: "COMPLETED",
runType: "DEBUG",
@@ -769,7 +721,7 @@ describe("CLI - workflow job 执行详情与异常精准透视", () => {
}),
};
},
post: () => ({ json: async () => ({ code: 200, data: "job_force_999" }) }),
post: () => ({ json: async () => ({ code: 200, data: "job_prod_999" }) }),
};
spies.push(
@@ -788,14 +740,15 @@ describe("CLI - workflow job 执行详情与异常精准透视", () => {
area: "workflow",
action: "test",
args: ["wf_prod_1"],
options: { flow: "ZJ-20261015-001387", force: true, platformId: "p1" },
raw: ["workflow", "test", "wf_prod_1", "--flow=ZJ-20261015-001387", "--force", "--platform-id=p1"],
options: { flow: "ZJ-20261015-001387", platformId: "p1" },
raw: ["workflow", "test", "wf_prod_1", "--flow=ZJ-20261015-001387", "--platform-id=p1"],
},
mockRuntime
);
expect(res.exitCode).toBe(0);
expect(res.stdout).toContain("生产调试警示");
expect(res.stdout).toContain("job_force_999");
expect(res.stdout).toContain("生产启用态调试安全提醒");
expect(res.stdout).toContain("特权调测通道");
expect(res.stdout).toContain("job_prod_999");
});
});