test(workflows): cover coding optional gates

This commit is contained in:
gsxdsm
2026-06-28 23:45:32 -07:00
parent d4b8032f28
commit d1caa3bdbf
4 changed files with 23 additions and 7 deletions

View File

@@ -86,6 +86,11 @@ describe("built-in workflows", () => {
expect(ir.nodes.some((n) => n.id === "plan-review" && n.kind === "optional-group")).toBe(true);
expect(ir.edges.some((edge) => edge.from === "plan" && edge.to === "plan-review")).toBe(true);
expect(ir.edges.some((edge) => edge.from === "plan-review" && edge.to === "parse")).toBe(true);
expect(ir.nodes.some((n) => n.id === "browser-verification" && n.kind === "optional-group")).toBe(true);
expect(ir.nodes.some((n) => n.id === "code-review" && n.kind === "optional-group")).toBe(true);
expect(ir.edges.some((edge) => edge.from === "steps" && edge.to === "browser-verification" && edge.condition === "success")).toBe(true);
expect(ir.edges.some((edge) => edge.from === "browser-verification" && edge.to === "code-review" && edge.condition === "success")).toBe(true);
expect(ir.edges.some((edge) => edge.from === "code-review" && edge.to === "review" && edge.condition === "success")).toBe(true);
const foreach = ir.nodes.find((n) => n.kind === "foreach");
expect(foreach).toBeDefined();
const template = (
@@ -130,6 +135,15 @@ describe("built-in workflows", () => {
expect(template.edges.some((edge) => edge.kind === "rework")).toBe(false);
});
it("all coding built-ins expose Browser Verification as an optional group", () => {
for (const workflowId of ["builtin:coding", "builtin:legacy-coding", "builtin:stepwise-coding"]) {
const workflow = getBuiltinWorkflow(workflowId)!;
const browserVerification = workflow.ir.nodes.find((node) => node.id === "browser-verification");
expect(browserVerification?.kind, workflowId).toBe("optional-group");
expect(browserVerification?.config?.defaultOn, workflowId).toBe(false);
}
});
it("includes the PR lifecycle built-in wiring the PR nodes end to end (U9)", () => {
const pr = getBuiltinWorkflow("builtin:pr-workflow");
expect(pr).toBeDefined();

View File

@@ -287,7 +287,7 @@ describe("WorkflowGraphTaskRunner (CU-U2)", () => {
const calls: string[] = [];
const getWorkflowDefinition = vi.fn(async () => undefined);
const store: WorkflowGraphRunnerStore = {
getTaskWorkflowSelection: () => ({ workflowId: "builtin:coding", stepIds: [] }),
getTaskWorkflowSelection: () => ({ workflowId: "builtin:legacy-coding", stepIds: [] }),
getWorkflowDefinition,
};
const runner = new WorkflowGraphTaskRunner({
@@ -299,8 +299,10 @@ describe("WorkflowGraphTaskRunner (CU-U2)", () => {
const result = await runner.run(task, flagOn);
expect(result.disposition).toBe("completed");
// U6: the coding built-in no longer carries a `workflow-step` seam; its
// pre-merge browser-verification optional-group is default-OFF and bypassed.
// FNXC:WorkflowBuiltins 2026-06-28-23:29:
// Use Legacy coding here because default Coding is now stepwise and requires
// parse/foreach task-step context. This still proves built-in registry fallback
// works when the store intentionally does not return a persisted definition.
expect(calls).toEqual(["planning", "execute", "review", "merge"]);
expect(result.reason).toBeUndefined();
expect(getWorkflowDefinition).not.toHaveBeenCalled();