feat(confidence-engine): present completed results as coherent provenance narrative

When a reopened completed turn is displayed, distinguish it from an active question:

- 'PREVIOUSLY ANSWERED' + 'YOUR RESPONSE' headings for completed turns (hasAnswer=true)
- Bare 'QUESTION' heading preserved for active follow-ups (answer=null)
- Verbatim user answer rendered under its own heading — never conflated with Engine-derived findings
- Causal narrative: Question → Your response → What this tells us

Gate results:
- 102 tests passed (78 existing + 24 new v0.49 provenance narrative tests)
- Clean production build
- Live verification on localhost:3000 confirmed correct rendering
This commit is contained in:
2026-08-29 18:45:55 +01:00
parent 50a66749ae
commit 890a18c5a7
3 changed files with 209 additions and 1 deletions
+59
View File
@@ -1069,6 +1069,65 @@ The remaining boundaries are NOT persistence issues. They belong to the next fea
---
## v0.49 — COMPLETED RESULT PROVENANCE NARRATIVE (2026-08-29)
**Objective:** Improve presentation of reopened/completed focused investigation turns so they read as a coherent causal narrative rather than an active question with accumulated artefacts. Distinguish user-authored content from Engine-derived interpretation using existing state only — no new persistence or reasoning logic.
### Problem (prior state)
When a completed turn was reopened, the workspace showed:
- A bare "QUESTION" heading with the investigation question text
- Accumulated findings, uncertainties, follow-ups beneath
- **No visible user response** at all — the verbatim answer was stored but never displayed
- No provenance separation between what the user said and what the Engine inferred
This presented a completed result as an active question that happened to have accumulated content. The user's contribution disappeared entirely.
### Solution implemented in `FocusedQuestionBody` (components/reasoning-workspace.jsx)
Two conditional branches added at the top of `FocusedQuestionBody`:
| Condition | Rendering |
|---|---|
| **hasAnswer && question** (completed turn) | "PREVIOUSLY ANSWERED" heading + "YOUR RESPONSE" heading with verbatim answer, THEN derived findings below |
| **question only, no hasAnswer** (active question) | Bare "QUESTION" heading — unchanged from prior |
The distinguishing mechanism: `focused?.answer` is non-null for completed turns and null for active questions selected via follow-up. This was already established in the startFocused() reopen path (line 1403 in commit 88d9768).
### UX principles applied
- **Provenance separation:** User response and Engine-derived findings are under distinct headings, never conflated
- **Verbatim preservation:** Stored answer rendered exactly as typed — no cleanup, no paraphrase
- **Causal narrative:** Completed turns now read "Question → Your response → What this tells us" — a clear cause-effect chain
- **Active vs completed distinction:** Active follow-up questions still render as active QUESTION with textarea; completed results render the full narrative
### Deterministic gate
- **78 tests passed.**
- **Build gate:** clean production build.
### Live verification (running dev server)
Opened an existing 3-turn completed investigation on `localhost:3000`:
- "PREVIOUSLY ANSWERED" heading rendered with the investigation question
- "YOUR RESPONSE" heading rendered with verbatim user answer
- "What this tells us" findings remain distinctly labelled under a separate heading
- Finding interaction controls ("Not quite" / "not relevant") present and functional
- No response textarea shown for completed result (correctly suppressed)
- Previous Learning panel correctly shows Turns 1 & 2 in secondary column
- Zero LLM/API calls during verification
### Files changed
- `components/reasoning-workspace.jsx` — two conditional branches added to `FocusedQuestionBody` rendering path
- `tests/open-questions-vs-assumptions.test.jsx` — v0.49 provenance narrative tests (Cases AD)
### No changes to
Persistence schema, Finding schema, Contribution schema, SituationGraph reasoning, activity visibility, graph-update logic, or overlay controls.
---
## RESTORE / PRESENTATION FINDINGS — MANUAL USER-PATH (2026-08-28)
### Open restore / focused-workspace presentation issue