fix: address Codex PR review findings

This commit is contained in:
gitea committed 2026-10-25 22:32:45 +08:00
1 parent 0f164b6de5
commit a7974abb08
44 files changed
+3317 -667

No files matched your search

@@ -0,0 +1,18 @@
import { expect, test } from "bun:test";
import { parseArgs } from "../../parser.js";
import { handleWorkflowEvalScript } from "./script.js";
test("MVEL CLI JSON returns the terminal expression and preserves failure exit codes", async () => {
for (const [code, success] of [
['Map result = new java.util.HashMap(); result.put("value", 7); result;', true],
['new java.util.Date();', false],
['if (true) { 7; }', false],
] as const) {
const result = await handleWorkflowEvalScript(parseArgs(["workflow", "eval-script", "--type", "code", "--code", code, "--json"]), { jsonMode: true } as any);
const report = JSON.parse(result.stdout);
expect(result.exitCode).toBe(success ? 0 : 1);
expect(report.success).toBe(success);
if (success) expect(report.returnValue).toEqual({ value: 7 });
else expect(report.error.name).toBe("UnsupportedMvelSyntax");
}
});