feat(confidence-engine): v0.60j preserve investigation on restart

This commit is contained in:
2026-09-04 10:18:22 +01:00
parent 4bc998ee3f
commit cc3a5dabd4
7 changed files with 551 additions and 7 deletions
+50
View File
@@ -665,6 +665,56 @@ v0.60h: Migrate Report route to use route `[id]` for all identity operations (in
---
## v0.60j — Semantic Restart within Investigation Container
**Purpose:** Implement `restartInvestigation(id)` that preserves the durable Investigation container (id, scenario) while clearing all reasoning/report state. Migrate Portfolio and ScenarioForm Restart callers from `clearInvestigation()` to `restartInvestigation(investigationId)`.
### What was implemented
| File | Change |
|---|---|
| `lib/storage/providers/local-storage.js` | Added `restartInvestigation(id)` — preserves id/scenario/schemaVersion; resets situationGraph→null, selectedQuestion→null, summary→null, focusedContributions→[], findings→[], investigationReport→null, investigationRevision→0, updatedAt→new ISO |
| `lib/storage/investigation-storage.js` | Imported and re-exported `restartInvestigation`; added semantic contract doc (missing id → no-op, no singleton fallback) |
| `app/page.jsx` | Portfolio card Restart: replaced `clearInvestigation(summary.id)` with `restartInvestigation(summary.id)` — preserves container, clears reasoning |
| `components/scenario-form.jsx` | Three callers migrated: ReasoningWorkspace onRestart, ContinueLaterBanner onRestart, "Start new investigation" button — all call `restartInvestigation(investigationId)` instead of `clearInvestigation()` |
### Deterministic evidence
- **Storage tests:** 44/44 PASS (investigation-storage.test.js)
- **UI contract tests:** 7/7 PASS (v060j-restart-contract.test.jsx)
- **Exact command:** `npx vitest run tests/storage/investigation-storage.test.js tests/ui/v060j-restart-contract.test.jsx`
- **First run result:** 51/51 PASS, no reruns
### Semantic contract of restartInvestigation(id)
**Preserved (container-level):** id, scenario, schemaVersion
**Reset:** situationGraph→null, selectedQuestion→null, summary→null, focusedContributions→[], findings→[], investigationReport→null, investigationRevision→0, updatedAt→new timestamp
### Portfolio caller migrated
- Portfolio Restart confirmation dialog → `restartInvestigation(summary.id)`
- No longer calls `clearInvestigation()`
- Card id passed correctly (inv-a, inv-b verified by UI test)
### ScenarioForm three callers migrated
| Path | Location | Contract | Observability |
|---|---|---|---|
| 1 — ReasoningWorkspace onRestart | line ~949 | `restartInvestigation(investigationId)` | Source-inspected (PATH 1 NOT DIRECTLY OBSERVABLE IN BOUNDED APPARATUS) |
| 2 — ContinueLaterBanner onRestart | line ~971 | `restartInvestigation(investigationId)` | **Directly exercised** by UI test |
| 3 — "Start new investigation" button | line ~979 | `restartInvestigation(investigationId)` | **Directly exercised** by UI test |
### UI apparatus
- ScenarioForm direct caller assertions added: YES (2 directly observable via ContinueLaterBanner and StartNew buttons)
- ReasoningWorkspace onRestart confirmed by bounded source inspection
- No localStorage used, no provider imported, no module-cache manipulation
- All mocks at application-facing boundary only
### Live verification pending
---
## Next restart point
Consult `docs/design-evolution/README.md` for progressive loading of product reasoning and provenance chronology; load the relevant chapter only when a specific historical question requires it.