From 5878ce45ec112ae6c643ebc8475ad23fb96fd907 Mon Sep 17 00:00:00 2001 From: robbond Date: Sun, 6 Sep 2026 18:22:20 +0100 Subject: [PATCH] experiment(confidence-engine): add reconstruction-only helper flag --- scripts/start-case-experiment-helper.cjs | 15 ++++++++++++--- .../start-case-experiment-helper.test.js | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/scripts/start-case-experiment-helper.cjs b/scripts/start-case-experiment-helper.cjs index 6871dbf..1ea3c2b 100755 --- a/scripts/start-case-experiment-helper.cjs +++ b/scripts/start-case-experiment-helper.cjs @@ -8,6 +8,7 @@ * Usage: * node scripts/start-case-experiment-helper.cjs "" * node scripts/start-case-experiment-helper.cjs --file scenario.json + * node scripts/start-case-experiment-helper.cjs --reconstruction-only --file scenario.json * * Exit codes: * 0 — success (structured result printed to stdout) @@ -86,7 +87,7 @@ async function runStartCaseExperiment(scenarioInput, experimentInstruction, opti if (!startCase && isMock) { // Deterministic mode: skip environment checks and use inline test double. - startCase = async (body) => { + startCase = async (_body, dependencies) => { // Deterministic inline test double — no live model calls. const shouldFail = process.env.START_CASE_EXPERIMENT_HELPER_FORCE_FAIL === "1"; if (shouldFail) { @@ -98,7 +99,12 @@ async function runStartCaseExperiment(scenarioInput, experimentInstruction, opti assessment: { phase: "initial", progress: 0 }, selectedQuestion: null, summary: null, - diagnostics: { validationStatus: "mock", modelName: "inline-test-double", graphReferenceValidation: { valid: true, errors: [] } }, + diagnostics: { + validationStatus: "mock", + modelName: "inline-test-double", + reconstructionOnly: dependencies.reconstructionOnly === true, + graphReferenceValidation: { valid: true, errors: [] }, + }, }; }; } else if (!startCase) { @@ -197,7 +203,10 @@ if (require.main === module) { } const scenarioInput = readScenarioInput(process.argv); - const result = await runStartCaseExperiment(scenarioInput, experimentInstruction); + const reconstructionOnly = process.argv.includes("--reconstruction-only"); + const result = await runStartCaseExperiment(scenarioInput, experimentInstruction, { + reconstructionOnly, + }); console.log(JSON.stringify(result, null, 2)); process.exit(result.success ? 0 : 1); diff --git a/tests/scripts/start-case-experiment-helper.test.js b/tests/scripts/start-case-experiment-helper.test.js index b382ecd..e3d778f 100644 --- a/tests/scripts/start-case-experiment-helper.test.js +++ b/tests/scripts/start-case-experiment-helper.test.js @@ -141,6 +141,24 @@ describe("start-case-experiment-helper.cjs apparatus", () => { }); }); + describe("B.1 — reconstruction-only CLI option", () => { + it("passes reconstructionOnly through the startCase seam without selecting OpenAI", async () => { + const result = await runHelper(["--reconstruction-only", "Scenario text"]); + expect(result.exitCode).toBe(0); + const parsed = parseOutput(result); + expect(parsed.diagnostics).toMatchObject({ + modelName: "inline-test-double", + reconstructionOnly: true, + }); + }); + + it("composes reconstruction-only with file input", async () => { + const result = await runHelper(["--reconstruction-only", "--file", tmpFile]); + expect(result.exitCode).toBe(0); + expect(parseOutput(result).diagnostics.reconstructionOnly).toBe(true); + }); + }); + // ── C — Environment loading ───────────────────────────────────── describe("C — environment loading", () => {