feat(confidence-engine): v0.60f allocate investigation identity on create

Replace Portfolio's static "+ Create new investigation" link (href:
/investigations/case-1) with a <button> that allocates an opaque
application-owned durable ID via crypto.randomUUID() and navigates
via router.push to /investigations/{id} without persisting any empty
Investigation.

INVESTIGATION_ID constant retained only for card links (Continue
investigation / View report) — not migrated in this increment.

Test: deterministic Create New activation test verifies UUID allocation,
navigation to generated ID route, and zero saveInvestigation calls.
This commit is contained in:
2026-09-03 19:20:28 +01:00
parent 01e141aa66
commit 4b55ad1eae
3 changed files with 98 additions and 8 deletions
+9 -3
View File
@@ -3,10 +3,12 @@
import React from "react";
import { loadInvestigation, clearInvestigation } from "@/lib/storage/investigation-storage";
import Link from "next/link";
import { useRouter } from "next/navigation";
const INVESTIGATION_ID = "case-1";
function Portfolio() {
const router = useRouter();
const [existing, setExisting] = React.useState(null);
const [showRestartConfirm, setShowRestartConfirm] = React.useState(false);
@@ -132,12 +134,16 @@ function Portfolio() {
</section>
)}
<Link
href={`/investigations/${INVESTIGATION_ID}`}
<button
onClick={(e) => {
e.preventDefault();
const id = crypto.randomUUID();
router.push(`/investigations/${id}`);
}}
className="rounded-lg border-[2.5px] border-dashed border-teal-400 px-6 py-3 text-sm font-medium text-teal-700 hover:bg-teal-50 transition"
>
+ Create new investigation
</Link>
</button>
</main>
);
}