feat(workflow): add docs domain and unlicensed powerCode diagnostics, webhook sample injector, and snapshot sanitizer

This commit is contained in:
gitea committed 2026-10-21 11:42:50 +08:00
1 parent 60d0b8ffc1
commit 6e40faccff
14 files changed
+640 -10

No files matched your search

@@ -20,13 +20,14 @@ import {
listWorkflowSnapshots,
listWorkflowLogs,
toggleWorkflow,
updateWorkflow,
} from "../../api.js";
import {
extractFailureExecutions,
findExecutionNode,
flattenExecutionTree,
isTaskExecutionFailed,
updateWorkflow,
sanitizeWorkflowSnapshot,
} from "../../services.js";
import { AuthenticationError, EkbApiError } from "../../../../core/errors.js";
import { WorkflowAlertStore } from "../alert/index.js";
@@ -77,6 +78,28 @@ describe("workflow draft state machine", () => {
expect(result["$snapshot"]).toEqual([{ key: "tasks.0", value: "{}" }]);
});
it("automatically purges docs.ekuaibao.com domain from $snapshot during update", async () => {
let sentWorkflow: WorkflowDetail | undefined;
const client = {
put: async (url: string, options: { json: WorkflowDetail }) => {
sentWorkflow = options.json;
return { json: async () => ({ data: options.json }) };
},
} as any;
const input = workflow({
"$snapshot": [
{
key: "tasks.0",
value: JSON.stringify({ url: "https://docs.ekuaibao.com/api/openapi/v1/backlog" }),
},
],
});
const result = await updateWorkflow(client, input);
expect(sentWorkflow?.$snapshot?.[0].value).toContain("https://app.ekuaibao.com/api/openapi/v1/backlog");
expect(sentWorkflow?.$snapshot?.[0].value).not.toContain("docs.ekuaibao.com");
expect(result["$snapshot"]?.[0].value).toContain("app.ekuaibao.com");
});
it("reads snapshot history and accepts the web API's serialized inputs", async () => {
let request: { url: string; options: any } | undefined;
const client = {