refine(confidence-engine): clarify portfolio investigation actions

This commit is contained in:
2026-09-03 07:01:18 +01:00
parent 32e1b01767
commit 0da7b63e30
3 changed files with 94 additions and 12 deletions
+29
View File
@@ -499,3 +499,32 @@ Investigation Report
**Key insight for future work:** Portfolio's initial pre-hydration empty state (`No investigations yet.`) ≠ absence of persisted investigation. Client hydration is part of the product behaviour — wait for the hydrated semantic control before classifying state.
**Next restart point:** The empty-Done `no_episodic_content` 400. Implement and verify that a Done action taken when no episodic evidence exists produces the same user-facing state (CU refresh with appropriate messaging) without a 400 error.
### v0.56 — Portfolio existing-case actions semantics (verified)
**Objective:** Make one bounded portfolio UI correction — clarify that actions on an existing investigation card are distinct from creation of a new investigation.
**Changes applied:**
- `app/page.jsx`: Renamed card-level "Open investigation" → "Continue investigation"; replaced card-level "Create new investigation" link with "Restart investigation" button wired to `clearInvestigation()`; preserved portfolio-level "+ Create new investigation" below the card.
- `tests/ui/investigation-overview-ui.test.jsx`: Updated assertions for renamed links, added tests for "Continue investigation" presence, "Open investigation" absence, "Restart investigation" presence, and card-level duplicate creation control absence.
**Resulting Portfolio semantics:**
```
Existing-investigation card (when one persists):
View report → /investigations/:id/report (link)
Continue investigation → /investigations/:id (link)
Restart investigation → clearInvestigation() (button)
Portfolio-level (always visible below card):
+ Create new investigation → /investigations/:id (link)
```
**Restart investigation wiring:** Invokes `clearInvestigation()` from `lib/storage/providers/local-storage.js` which removes the canonical localStorage key. Note: this is a raw storage clear — it does not perform the in-memory state resets (`setStatus`, `setResult`, etc.) that scenario-form.jsx also performs as part of its complete restart flow (lines ~913/941). The button clears persisted data and navigates to the investigation page which detects empty state; the user sees "Your previous investigation state is still saved" with Restart/Start new options. A full confirmation dialog and/or unified restart seam is a future increment.
**Verification:**
- Targeted Vitest (`tests/ui/investigation-overview-ui.test.jsx`): 17/17 PASS
- Build: `npm run build` — compiles successfully, zero errors
- Playwright live verification: persisted card hydrated with View report + Continue investigation + Restart investigation; no "Open investigation"; no duplicate "Create new investigation" in card; exactly one portfolio-level "+ Create new investigation"; navigation to Investigation and Report pages verified; persisted state retained across navigate-back.
**Restart ownership:** Raw storage clear available via `lib/storage/providers/local-storage.js::clearInvestigation()`. Complete restart seam (storage + in-memory state resets) is owned by `scenario-form.jsx` lines ~913-941. No confirmation dialog currently exists for either seam — adding one is a future increment boundary.