Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bin/aas.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ export function runAct(
cwd: join(depsDir, "consequence-rail"),
});
if (result.status !== 0) throw childProcessError("act", result);
return { ok: true, raw: parseJsonOutput(result.stdout, "act"), status: 0 };
const payload = parseJsonOutput(result.stdout, "act");
if (!payload || typeof payload !== "object" || Array.isArray(payload)
|| ![null, "settled", "compensated", "disputed"].includes(payload.outcome)) {
throw new Error("act did not return a valid outcome");
}
return { ok: true, raw: payload, status: 0 };
}

export function runProve(
Expand Down
11 changes: 11 additions & 0 deletions test/stack.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { loadComponentLock, inspectDependencyDirectory, npmInvocation } from "..
import {
persistRunBundle,
resolveComponentProvenance,
runAct,
runDemo,
writeAtomicFile,
} from "../bin/aas.mjs";
Expand Down Expand Up @@ -128,6 +129,16 @@ test("Windows npm commands run through the npm JavaScript entrypoint", () => {
);
});

test("act rejects a zero-exit payload without a valid outcome", () => {
assert.throws(
() => runAct("none", {
depsDir: tempRoot(),
runner: () => ({ status: 0, stdout: "{}\n", stderr: "", error: null }),
}),
/valid outcome/,
);
});

test("pass bundle contains stage status, provenance, and only current artifacts", async () => {
const outputRoot = tempRoot();
const result = await runDemo(["--response", "pass"], stubOptions(outputRoot, { runId: "pass-run" }));
Expand Down
Loading