feat(confidence-engine): v0.59a — correct Investigation revision provenance

Semantic revision tracking ensures every meaningful persisted
Investigation change advances investigationRevision exactly once,
while Report generation records (but does not advance) the current
revision as generatedFromRevision for provenance integrity.

Corrections:
- updateFindingDisposition: add setInvestigationRevision(+1) for
  semantic transitions (eligible→not_relevant, restore)
- updateFindingProposition: add no-op guard + setInvestigationRevision(+1)
- onRestart/ContinueLaterBanner/reset button: add setInvestigationRevision(0)
- onSituationGraphChange (Re-open seam): already had revision +1 in dirty impl

Established behaviour preserved:
- Re-open via reopenResolvedUnknown → onSituationGraphChange → revision +1
- Empty Done via handleDoneForNowPromotion → revision +1
- Report generation records generatedFromRevision, advances by 0
- Autosave passes revision but does not increment it
- clearInvestigation() ownership intact

Tests: targeted Vitest suite (17 tests) covering all provenance boundaries.

Durable rule documented in current-handoff.md §v0.59a.
This commit is contained in:
2026-09-03 13:39:40 +01:00
parent 37a9a12f93
commit 99b3d26817
5 changed files with 437 additions and 12 deletions
+38 -3
View File
@@ -6,8 +6,8 @@
## Repository checkpoint
- **Branch:** `feature/investigation-report-v0.55`
- **HEAD:** `7db28c8` — first Report generation lifecycle verified
- **Working tree:** clean (documented)
- **HEAD:** `37a9a12` — route design evolution provenance through archive index
- **Working tree:** will be clean after v0.59a commit
## Current product architecture
@@ -71,6 +71,39 @@ RAW USER EVIDENCE
- Re-open returns the question to Open Questions and removes from `doneForNowIds`.
- Older stale development localStorage states (pre-v0.53 shape) may be discarded during current dev phase. No migration required.
### v0.59a — Investigation revision provenance rule
- Investigation has a semantic revision (`investigationRevision`).
- Meaningful persisted Investigation changes advance it by exactly 1.
- Persistence activity itself (autosave, save) does NOT advance revision.
- Report generation records `generatedFromRevision: investigationRevision`.
- Report generation advances revision by 0.
- Equal revisions mean Report reflects current Investigation.
- Different revisions mean the Investigation has changed since Report generation.
- Existing Report remains available (not invalidated).
- Report update/regeneration remains manual (user-triggered).
- Restart clears Investigation + Report via `clearInvestigation()` + `setInvestigationRevision(0)`.
- Report history/comparison remains deferred beyond MVP.
**Semantic transitions that advance revision:**
```
Episode Done (with content) → +1
Re-open (resolved → unknown) → +1
Finding proposition correction → +1
Eligible → not_relevant → +1
not_relevant → eligible (restore) → +1
First meaningful change → =1 (from initial 0)
```
**Transitions that do NOT advance revision:**
```
Autosave → 0
Report generation → 0
Hydration → 0 (reads value)
Empty proposition correction (no-op) → 0
null → null disposition (no-op) → 0
```
### Zero Open Questions milestone (v0.51)
When all unknowns are resolved and clarified questions exist: "You've now worked through all of the questions we surfaced. Would you like to see an overview of what we understand so far?" with "Review current understanding" button. This occupies the former Open Questions position. The invitation is a milestone, not a readiness/completion judgement.
@@ -103,9 +136,11 @@ Reconstruct CU when canonical meaning or eligible evidence set changes — NOT w
- Multi-investigation portfolio (search/tag/archive/group)
- Durable investigation identities beyond `case-1`
- Report freshness/versioning after investigation changes
- Visible Report freshness UI (revision comparison display — backend tracking in place)
- "Update report" action (manual regeneration only)
- Export/copy of Reports to Jira or external document
- Portfolio expansion beyond one canonical investigation
- Report history / comparison
**Known boundaries:**