feat(confidence-engine): v0.60e route investigation identity

Migrate the Investigation page route to own durable investigation identity
via its route [id] segment, passing that ID through to ScenarioForm for
hydration and persistence.

- Remove hardcoded INVESTIGATION_ID constant from page.jsx
- Use params.id as routeId; loadInvestigation(routeId) loads by identity
- Pass investigationId prop into ScenarioForm in both branch paths
- Session restore calls loadInvestigation(investigationId)
- All 4 save call sites include id: investigationId in snapshot
- Missing identified Investigation starts clean (no singleton fallback)
- Legacy singleton is not migrated/fallback-loaded
- Portfolio remains unmigrated; Report remains unmigrated; Restart untouched

Deterministic tests: 34/34 pass (scenario-form-persistence + investigation-storage)
Build: PASS
Live Playwright: all criteria verified at /investigations/v060e-live
This commit is contained in:
2026-09-03 19:02:37 +01:00
parent 827411f254
commit 01e141aa66
3 changed files with 52 additions and 13 deletions
+10 -8
View File
@@ -4,18 +4,18 @@ import React from "react";
import { loadInvestigation } from "@/lib/storage/investigation-storage";
import ScenarioForm from "@/components/scenario-form";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useParams, useRouter } from "next/navigation";
import { useEffect, useState } from "react";
const INVESTIGATION_ID = "case-1";
export default function InvestigationPage() {
export default function InvestigationPage({ params }) {
const router = useRouter();
const routeId = typeof params?.id === "string" ? params.id : "";
const [existing, setExisting] = useState(null);
useEffect(() => {
setExisting(loadInvestigation());
}, []);
if (!routeId) return;
setExisting(loadInvestigation(routeId));
}, [routeId]);
return (
<main className="mx-auto max-w-[1600px] px-6 py-12">
@@ -37,12 +37,14 @@ export default function InvestigationPage() {
</p>
{existing ? (
<ScenarioForm
investigationId={routeId}
existingSnapshot={existing}
onNavigateToReport={() => router.push(`/investigations/${INVESTIGATION_ID}/report`)}
onNavigateToReport={() => router.push(`/investigations/${routeId}/report`)}
/>
) : (
<ScenarioForm
onNavigateToReport={() => router.push(`/investigations/${INVESTIGATION_ID}/report`)}
investigationId={routeId}
onNavigateToReport={() => router.push(`/investigations/${routeId}/report`)}
/>
)}
</main>