test(confidence-engine): extract focused target input for deterministic verification

This commit is contained in:
2026-10-09 16:44:09 +01:00
parent acf0665f23
commit a54b36a2b2
4 changed files with 140 additions and 5 deletions
+26 -5
View File
@@ -331,10 +331,9 @@ async function composeDeepInvestigationCheckpoint({ situationGraph, previousQues
/* ── Load production deconstruction seam (dynamic import to resolve ESM path aliases) ─── */
const { focusedDeconstruct } = await import("../../lib/graph/focused-investigation.js");
// Extract node context for deconstruction prompt
const targetNode = situationGraph.nodes.find(n => n.id === targetNodeId);
const targetLabel = targetNode?.label ?? "";
targetDescription = targetNode?.description ?? "";
// Extract node context for deconstruction prompt (reuses pure extraction function)
const { targetLabel, targetDescription: _td } = extractFocusedTargetInput(situationGraph, targetNodeId);
targetDescription = _td;
const centralStatement = situationGraph.centralStatement ?? "";
// Call production-focused deconstruct — exactly one provider generation
@@ -677,4 +676,26 @@ function saveFocusedInvestigationEvidence(checkpoint, identity, metadata, output
return { output_path: outputPath, verifiedEvidence: recovered };
}
module.exports = { runLiveExperiment, extractLiveExperimentCheckpoint, _extractReasoningState, composeDeepInvestigationCheckpoint, serializeFocusedInvestigationEvidence, saveFocusedInvestigationEvidence };
/**
* Extract the focused-investigation target-node input (label and description)
* from a situationGraph by node id.
*
* Pure function — no side effects, no I/O, no model calls.
* Mirrors exactly the lookup and fallback semantics used inside the
* guarded focused-deconstruction path of composeDeepInvestigationCheckpoint:
* - situationGraph.nodes.find(n => n.id === targetNodeId)
* - ?? "" (empty-string fallback when node not found)
*
* @param {object} situationGraph — SituationGraph input containing { nodes, centralStatement? }
* @param {string} targetNodeId — id of the focused-investigation target node
* @returns {{ targetLabel: string, targetDescription: string }}
*/
function extractFocusedTargetInput(situationGraph, targetNodeId) {
const targetNode = situationGraph.nodes.find(n => n.id === targetNodeId);
return {
targetLabel: targetNode?.label ?? "",
targetDescription: targetNode?.description ?? "",
};
}
module.exports = { runLiveExperiment, extractLiveExperimentCheckpoint, _extractReasoningState, composeDeepInvestigationCheckpoint, serializeFocusedInvestigationEvidence, saveFocusedInvestigationEvidence, extractFocusedTargetInput };