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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ project adheres to [Semantic Versioning](https://semver.org/).
- Playwright setup note in the Quick start section of `README.md`.

### Fixed
- `runAct` now rejects a domain other than `refund` or `inventory` before it
spawns the rail CLI. Any other value was passed through as the demo
command.
- An act result that explicitly reports `fault: null` is stored as null. The
report used to replace that null with the requested fault, so a cleared
fault was recorded as `duplicate` when `--fault duplicate` was passed.
Expand Down
3 changes: 3 additions & 0 deletions bin/aas.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@ export function runAct(
domain = "refund",
} = {},
) {
if (!DEMO_DOMAINS.has(domain)) {
throw new Error("act domain must be refund or inventory");
}
const crctl = join(depsDir, "consequence-rail", "cmd", "crctl.js");
if (runner === runCapture && !existsSync(crctl)) {
throw missingChildTool("act CLI (deps/consequence-rail/cmd/crctl.js)");
Expand Down
13 changes: 13 additions & 0 deletions test/stack.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1838,6 +1838,19 @@ test("runAct targets the requested rail demo domain", () => {
assert.equal(seen[0][2], "inventory");
});

test("runAct rejects an unknown domain before spawning the rail CLI", () => {
let called = false;
assert.throws(() => runAct("none", {
depsDir: "deps",
domain: "payments",
runner: () => {
called = true;
return { status: 0, stdout: '{"outcome":"settled","state":"CLOSED","fault":"none","action_id":"a"}\n', stderr: "", error: null };
},
}), /act domain must be refund or inventory/);
assert.equal(called, false);
});

test("runDecide rejects an unknown domain instead of loading the refund policy", () => {
let called = false;
assert.throws(() => runDecide("unused", {
Expand Down
Loading