test(confidence-engine): expose current understanding experiment output

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
2026-10-08 10:16:34 +01:00
co-authored by Claude Code
parent ce7df91a42
commit 8d9df8c939
3 changed files with 190 additions and 23 deletions
@@ -45,6 +45,10 @@ function parseArgs(argv) {
} else {
args.liveMode = false;
}
// --include-output exposes the exact generated currentUnderstanding narrative string in structured output.
args.includeOutput = argv.includes("--include-output");
return args;
}
@@ -91,7 +95,7 @@ async function createLiveProvider() {
// ── Main experiment execution ──
async function runCUExperiment(fixturePath, liveMode) {
async function runCUExperiment(fixturePath, liveMode, includeOutput) {
const fixture = JSON.parse(fs.readFileSync(fixturePath, "utf-8"));
// Deep-clone for immutability verification — never mutate input
@@ -139,7 +143,7 @@ async function runCUExperiment(fixturePath, liveMode) {
const elapsedMs = Date.now() - startMs;
return {
const baseResult = {
success: true,
mode: liveMode ? "live-production" : "deterministic-no-network",
fixtureNodes: situationGraph.nodes ? situationGraph.nodes.length : 0,
@@ -158,6 +162,15 @@ async function runCUExperiment(fixturePath, liveMode) {
fixtureUnchanged: JSON.stringify(fixture) === JSON.stringify({ situationGraph: situationGraph, findings: findings }),
},
};
if (includeOutput && result.currentUnderstanding) {
return {
...baseResult,
currentUnderstanding: result.currentUnderstanding,
};
}
return baseResult;
}
// ── CLI entry ──
@@ -166,7 +179,7 @@ if (require.main === module) {
(async function () {
try {
const args = parseArgs(process.argv);
const result = await runCUExperiment(args.fixturePath, args.liveMode);
const result = await runCUExperiment(args.fixturePath, args.liveMode, args.includeOutput);
console.log(JSON.stringify(result, null, 2));
process.exit(0);
} catch (e) {