Files
confidence-engine/app/investigations/[id]/page.jsx
T
robbond 01e141aa66 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
2026-09-03 19:02:37 +01:00

53 lines
1.8 KiB
React

"use client";
import React from "react";
import { loadInvestigation } from "@/lib/storage/investigation-storage";
import ScenarioForm from "@/components/scenario-form";
import Link from "next/link";
import { useParams, useRouter } from "next/navigation";
import { useEffect, useState } from "react";
export default function InvestigationPage({ params }) {
const router = useRouter();
const routeId = typeof params?.id === "string" ? params.id : "";
const [existing, setExisting] = useState(null);
useEffect(() => {
if (!routeId) return;
setExisting(loadInvestigation(routeId));
}, [routeId]);
return (
<main className="mx-auto max-w-[1600px] px-6 py-12">
{/* Page-level navigation — owned by route, not ReasoningWorkspace */}
<nav className="mb-4 flex gap-3">
<Link
href="/"
className="rounded-lg border border-teal-600 bg-white px-4 py-2 text-sm font-medium text-teal-700 hover:bg-teal-50 transition"
>
Back to portfolio
</Link>
</nav>
<h1 className="mb-2 text-3xl font-bold tracking-tight">Confidence Engine</h1>
<p className="mb-8 text-sm text-gray-500">
Experimental prototype: enter a scenario and send it to a local LLM for
evidence-based structured reconstruction. This is a technical vertical
slice not a production system.
</p>
{existing ? (
<ScenarioForm
investigationId={routeId}
existingSnapshot={existing}
onNavigateToReport={() => router.push(`/investigations/${routeId}/report`)}
/>
) : (
<ScenarioForm
investigationId={routeId}
onNavigateToReport={() => router.push(`/investigations/${routeId}/report`)}
/>
)}
</main>
);
}