feat(confidence-engine): v0.54b integrate Investigation Overview UI seam + bounded scroll cleanup

- Wire transient overview state from ScenarioForm to ReasoningWorkspace
- Inline rendering of investigation overview below milestone invitation
- Remove obsolete scrollIntoView after overview request (scrolled away from rendered content)
- All four overview props consumed in ReasoningWorkspace render path
- Targeted Vitest: 9/9 PASS (tests/ui/investigation-overview-ui.test.jsx)
- Production build: compiles successfully
This commit is contained in:
2026-09-02 15:14:20 +01:00
parent 83818c0c71
commit 745026f0a0
4 changed files with 307 additions and 14 deletions
+39
View File
@@ -285,6 +285,10 @@ export default function ScenarioForm() {
const [mockScenario, setMockScenario] = useState("");
const [hideFacilitatorOnLanding, setHideFacilitatorOnLanding] = useState(false);
/* ── v0.54b — investigation overview transient state ────── */
const [overviewState, setOverviewState] = useState(null);
const [overviewLoading, setOverviewLoading] = useState(false);
/* ── in-flight gate for episode reconsideration on Done ──── */
const doneInProgressRef = useRef(false);
@@ -413,6 +417,36 @@ export default function ScenarioForm() {
}
}
/**
* v0.54b — request investigation overview via the established POST /api/cases/overview seam.
* Transient state only: never persists to SituationGraph or currentUnderstanding.
*/
async function handleRequestOverview() {
if (overviewLoading || !result?.situationGraph) return;
setOverviewLoading(true);
setOverviewState(null); // clear any previous overview before new request
try {
const res = await fetch("/api/cases/overview", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
situationGraph: result.situationGraph,
findings,
plausibleInterpretations: (result.situationGraph?.reconstruction || {}).plausibleInterpretations ?? [],
}),
}).then((r) => r.json());
if (res?.success && res?.understanding != null) {
setOverviewState(res);
}
// On failure: do not clear existing CU, do not block further attempts
} finally {
setOverviewLoading(false);
}
}
function appendFocusedContribution(contribution) {
// Derive a single stored contribution object and use it for BOTH
// contribution storage AND Finding derivation so the same identity
@@ -813,6 +847,11 @@ export default function ScenarioForm() {
updateStatus={updateStatus}
cuSynthesisLoading={cuSynthesisLoading}
currentUnderstanding={currentUnderstanding}
/* v0.54b investigation overview transient state */
overviewState={overviewState}
setOverviewState={setOverviewState}
overviewLoading={overviewLoading}
handleRequestOverview={handleRequestOverview}
result={{
...(result || {}),
situationGraph: updateResult?.updatedSituationGraph ?? result?.situationGraph,