From d12615075ddc3b3b2bef738a44b2edd5383c33e4 Mon Sep 17 00:00:00 2001 From: robbond Date: Fri, 9 Oct 2026 13:47:54 +0100 Subject: [PATCH] feat(confidence-engine): expose focused-investigation inputs in composed checkpoint Add focusedInvestigationInput {targetDescription, question, answer} to composeDeepInvestigationCheckpoint() return object. These are the actual invocation values: targetDescription from situationGraph node, question is previousQuestion (NOT node.openQuestion), answer is function param. Deterministic verification: syntax check passed; source-inspection test assertions E10/E11 added and pass (0 failures). Call-count ownership: up to 3 live generateReconstruction calls (focusedDeconstruct + reconsiderCompletedEpisode + synthesizeCurrentUnderstanding). No provider, graph, or production behavior changed. Co-Authored-By: Claude Code --- docs/current-handoff.md | 10 ++++++++++ docs/uncertainty-led-investigation-hypothesis.md | 1 + ...e-update-experiment-helper-checkpoint.test.cjs | 4 ++++ tests/graph/live-update-experiment-helper.cjs | 15 +++++++++++---- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/docs/current-handoff.md b/docs/current-handoff.md index e989d26..b83ea9d 100644 --- a/docs/current-handoff.md +++ b/docs/current-handoff.md @@ -688,5 +688,15 @@ Ensure these remain visible and are not accidentally promoted to tester blockers Tested canonical uncertainty description as initial display instead of generated question. Changed `lib/presentation/facilitator-view-adapter.js` lines ~277–281 to prefer `description` over `openQuestion`. Deterministic tests: 54/54 PASS (including both adapter test files). Live Playwright verification confirmed: descriptions displayed, selection enters focused investigation correctly. Graph identity and reasoning-state ownership unchanged. What remains untested: semantic adequacy of descriptions across domains; whether generated questions are needed downstream for focused-investigation context quality. +### Experiment 2 — Apparatus Correction (focused-investigation checkpoint completeness) + +- **Change:** `composeDeepInvestigationCheckpoint()` return object now includes `focusedInvestigationInput: { targetDescription, question, answer }`. +- **`targetDescription`:** derived from `situationGraph.nodes.find(n => n.id === targetNodeId)?.description ?? ""`, declared as module-level `let` before deconstruction block. +- **`question`:** equals `previousQuestion ?? ""` — **NOT** `node.openQuestion`. Verified via source inspection: the argument to `focusedDeconstruct()` on line 350 is `previousQuestion ?? ""`. +- **`answer`:** direct function parameter value, no transformation. +- **Verification:** `node --check` passed; deterministic apparatus test (source-inspection assertions) 0 failures. New assertion E10/E11 added to existing test. +- **Call-count ownership:** `composeDeepInvestigationCheckpoint()` performs up to three live `generateReconstruction` calls: (1) focusedDeconstruct when triggered, (2) reconsiderCompletedEpisode in episode path, (3) synthesizeCurrentUnderstanding for CU synthesis. In non-episode path without contributions: exactly one call (focusedDeconstruct). Source references: helper lines 302, 393, 449. +- **What remains open:** Whether presenting canonical descriptions as initial focus improves user comprehension vs generated questions across domains; semantic adequacy of `description` field quality from reconstruction. + **Branch:** `experiment/uncertainty-led-investigation` **Commit:** pending verification complete. diff --git a/docs/uncertainty-led-investigation-hypothesis.md b/docs/uncertainty-led-investigation-hypothesis.md index d567e84..e55774c 100644 --- a/docs/uncertainty-led-investigation-hypothesis.md +++ b/docs/uncertainty-led-investigation-hypothesis.md @@ -94,5 +94,6 @@ Preserve existing graph relationships, stable identities, provenance, persistenc - HS-01 / HS-02: manufacturing-investment scenario; prompt-contract refinement and single-repeat observation. - HS-03A–D: four-scenario semantic-equivalence experiment; 6 faithful, 4 partial, 0 unfaithful initial-question transformations; all partial cases in HS-03C. - **Experiment 2 (2026-10-09):** Presentation-only change — adapter prioritises `description` over `openQuestion` for unresolved unknown display. Verified with deterministic tests (54/54) and live Playwright UI verification. Focused investigation entry still works correctly from description-based selection. `openQuestion` generation remains untouched. Graph identity, reasoning-state ownership, and resolved-unknown presentation unaffected. Hypothesis not proven — only one presentation direction tested against its fallback; semantic adequacy of descriptions untested across domains. +- **Experiment 2 apparatus correction (2026-10-09):** `composeDeepInvestigationCheckpoint()` now exposes `focusedInvestigationInput: { targetDescription, question, answer }` in its returned checkpoint object. These values are the actual invocation inputs — `targetDescription` derived from `situationGraph.nodes.find(n => n.id === targetNodeId)?.description`, `question` is `previousQuestion ?? ""` (NOT `node.openQuestion`), `answer` is the function parameter. Verification: syntax check passed, deterministic source-inspection assertions pass (0 failures across existing apparatus test). No provider calls changed; no graph behaviour altered; no production code modified. ## Decision state: OPEN (after iteration 2 evidence). diff --git a/tests/graph/live-update-experiment-helper-checkpoint.test.cjs b/tests/graph/live-update-experiment-helper-checkpoint.test.cjs index c5fb09e..eb3eb57 100644 --- a/tests/graph/live-update-experiment-helper-checkpoint.test.cjs +++ b/tests/graph/live-update-experiment-helper-checkpoint.test.cjs @@ -324,6 +324,10 @@ assert(helperSrc.includes("postEpisodeFindings: postEpisodeFindings"), "postEpis const extractResult = extractLiveExperimentCheckpoint(successResult(123, 456), successParams); assert(extractResult.providerGenerateCalls === 1, "providerGenerateCalls preserved from extraction path"); +// E10. Apparatus correction: focusedInvestigationInput field present in composed checkpoint (Iteration 2) +assert(helperSrc.includes("focusedInvestigationInput:"), "helper exposes focusedInvestigationInput in composed checkpoint output"); +assert(helperSrc.includes("targetDescription:") && helperSrc.includes("question:") && helperSrc.includes("answer,"), "focusedInvestigationInput contains targetDescription, question, answer fields"); + // ---- CONTRIBUTION SEAM VERIFICATION (Iteration 4 + Iteration 5 deconstruction) ────────────────────── console.log("\n=== CONTRIBUTION SEAM VERIFICATION ===\n"); diff --git a/tests/graph/live-update-experiment-helper.cjs b/tests/graph/live-update-experiment-helper.cjs index f92f73a..dde0db1 100644 --- a/tests/graph/live-update-experiment-helper.cjs +++ b/tests/graph/live-update-experiment-helper.cjs @@ -314,10 +314,8 @@ async function composeDeepInvestigationCheckpoint({ situationGraph, previousQues /* ── Production-equivalent focused-episode seam: targetNodeId triggers the same path as executeEpisodeDone → handleEpisodeMode ─── */ - /* ── Canonical deconstruction: use focusedDeconstruct for Contribution derivation ─── */ const effectiveContributions = contributions.length > 0 ? [...contributions] : []; - - /* ── Target-scoped filtering: only contributions belonging to the current target suppress fresh deconstruction ─── */ + let targetDescription = ""; let effectiveContributionsForTarget = effectiveContributions; if (targetNodeId && effectiveContributions.length > 0) { effectiveContributionsForTarget = effectiveContributions.filter( @@ -336,7 +334,7 @@ async function composeDeepInvestigationCheckpoint({ situationGraph, previousQues // Extract node context for deconstruction prompt const targetNode = situationGraph.nodes.find(n => n.id === targetNodeId); const targetLabel = targetNode?.label ?? ""; - const targetDescription = targetNode?.description ?? ""; + targetDescription = targetNode?.description ?? ""; const centralStatement = situationGraph.centralStatement ?? ""; // Call production-focused deconstruct — exactly one provider generation @@ -510,6 +508,15 @@ async function composeDeepInvestigationCheckpoint({ situationGraph, previousQues /* ── Answer meaning (from production result) ─── */ userSupportedMeaning: episodeResult?.proposal?.answerMeaning?.userSupportedMeaning ?? null, possibleInference: episodeResult?.proposal?.answerMeaning?.possibleInference ?? null, + + /* ── Focused-investigation input values (apparatus correction) ─── */ + focusedInvestigationInput: (previousQuestion != null || answer != null) + ? { + targetDescription: targetDescription ?? "", + question: previousQuestion ?? "", + answer, + } + : null, }; }