From 64497114aea82d8afa23d8565febf3d5a78d717b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 28 Sep 2026 16:36:27 +0000 Subject: [PATCH] Keep an explicit null act fault instead of the requested fault. A child result of fault null was stored as the --fault value, so a cleared fault was reported as duplicate. --- CHANGELOG.md | 3 +++ bin/aas.mjs | 2 +- test/stack.test.mjs | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d00c30..402fd4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ project adheres to [Semantic Versioning](https://semver.org/). - Playwright setup note in the Quick start section of `README.md`. ### Fixed +- 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. - The integrator example now removes its scratch directory when decide fails or policy refuses the response. `process.exit` skipped the cleanup, so each failed run left an `aas-integrator-` directory behind. diff --git a/bin/aas.mjs b/bin/aas.mjs index 871a48a..82a2489 100644 --- a/bin/aas.mjs +++ b/bin/aas.mjs @@ -1696,7 +1696,7 @@ export async function runDemo(args = [], options = {}) { status: stages.act.status, outcome, state: act.raw?.state ?? null, - fault: act.raw?.fault ?? fault, + fault: act.raw && Object.hasOwn(act.raw, "fault") ? act.raw.fault : fault, action_id: act.raw?.action_id ?? null, assurance_mode: act.raw?.assurance_mode ?? null, bundle_verification: act.raw?.bundle_verification ?? null, diff --git a/test/stack.test.mjs b/test/stack.test.mjs index abc47b7..9b2d8c2 100644 --- a/test/stack.test.mjs +++ b/test/stack.test.mjs @@ -1813,6 +1813,20 @@ test("demo rejects an unknown domain before running any stage", async () => { assert.equal(rejected.exitCode, 2); }); +test("an explicit null act fault stays null instead of becoming the requested fault", async () => { + const outputRoot = tempRoot(); + const cleared = await runDemo(["--fault", "duplicate"], stubOptions(outputRoot, { + runId: "null-fault", + runActFn: async () => ({ ok: true, raw: { outcome: "settled", state: "CLOSED", fault: null, action_id: "act-null" }, status: 0 }), + })); + assert.equal(cleared.report.stages.act.fault, null); + const omitted = await runDemo(["--fault", "duplicate"], stubOptions(outputRoot, { + runId: "omitted-fault", + runActFn: async () => ({ ok: true, raw: { outcome: "settled", state: "CLOSED", action_id: "act-omit" }, status: 0 }), + })); + assert.equal(omitted.report.stages.act.fault, "duplicate"); +}); + test("runAct targets the requested rail demo domain", () => { const seen = []; const runner = (bin, args) => {