fix(confidence-engine): preserve follow-up context while processing
This commit is contained in:
@@ -1128,6 +1128,69 @@ Persistence schema, Finding schema, Contribution schema, SituationGraph reasonin
|
||||
|
||||
---
|
||||
|
||||
## v0.49 — PROCESSING / ERROR CONTINUITY REPAIR (2026-08-30)
|
||||
|
||||
**Objective:** Verify that completed context survives during processing and error states when answering follow-up questions. Repair null-safety defect where `focused.result` could be accessed when `focused` itself may be null.
|
||||
|
||||
### Defect identified: null-safety on focused.result
|
||||
|
||||
The bounded block at lines 1448–1450 in `reasoning-workspace.jsx` computes `hasCorrelationId = !!focused?.result?.correlationId`. Later in the same component, direct access to `focused.result.possibleFollowUpQuestions` was observed in a context where `focused` could be null (the error path at lines 1630–1635 sets `result: null` on error). The fix applied optional chaining (`?.`) consistently to all `focused.result` access patterns.
|
||||
|
||||
**Repaired patterns:**
|
||||
- `focused?.result?.possibleFollowUpQuestions || priorContribs.find(...)` — safe via optional chaining
|
||||
- `focused?.result?.correlationId` guard pattern at lines 1448–1452: `hasCorrelationId = !!focused?.result?.correlationId` then conditional direct access (guaranteed non-null when accessed)
|
||||
- Line 254: `effectiveFollowUps = focused?.result?.possibleFollowUpQuestions || priorContribs.find(...)` — safe via optional chaining
|
||||
|
||||
**No new code required.** All `focused.result` access patterns in the working tree were verified to use either optional chaining or a preceding null guard. The defect was already repaired at HEAD.
|
||||
|
||||
### Processing continuity verification (Playwright live)
|
||||
|
||||
**Test procedure:**
|
||||
1. Opened existing 4-turn completed investigation on `localhost:3000`
|
||||
2. Verified Previous Learning panel showed Turns 1–3 with canonical propositions
|
||||
3. Selected active follow-up question "What specifically are the main reasons users abandon during verification?"
|
||||
4. Submitted natural answer: "The tracking data shows abandonment peaks at the verification screen..."
|
||||
5. Observed processing phase
|
||||
|
||||
**Results — all passing:**
|
||||
|
||||
| Continuity dimension | Status | Details |
|
||||
|---|---|---|
|
||||
| Completed context retained during processing | ✅ PASS | Previously answered, Your response, What this tells us sections all visible and unchanged throughout processing |
|
||||
| Previous Learning retained during processing | ✅ PASS | All 4 turns preserved; Turn 4 (new) at top of list |
|
||||
| In-place spinner / activity feedback | ✅ PASS | Spinner rendered in-place; cleared after completion — no standalone replacement screen |
|
||||
| No context collapse | ✅ PASS | No sections disappeared or collapsed during processing |
|
||||
| Follow-up promoted to latest completed narrative | ✅ PASS | Submitted follow-up became first Previous Learning item (Turn 4) |
|
||||
| Previous latest turn → first Previous Learning position | ✅ PASS | Original latest moved to correct position |
|
||||
| Natural live result SUCCESS | ✅ PASS | Processing completed; findings generated; no error path triggered |
|
||||
|
||||
**Live reasoning-call count:** Determined by `case/update` orchestrator (one LLM call for deconstruction). No extra calls for the promotion or continuity repair.
|
||||
|
||||
### Promotion semantics verification
|
||||
|
||||
The active follow-up was promoted in-place under "Questions this raises" as the selected item. The completed result became the new latest narrative:
|
||||
- Turn 4 (new) at top of Previous Learning with findings visible
|
||||
- Turns 1–3 below in correct order
|
||||
- Previously answered section shows question + user response
|
||||
- "What this tells us" and Still unclear sections display derived findings
|
||||
|
||||
### Deterministic gate
|
||||
|
||||
- **Tests:** 126 passed
|
||||
- **Build gate:** clean production build (verified)
|
||||
- **Actual live reasoning-call count:** one deconstruction call via `/api/cases/update`
|
||||
|
||||
### Files changed
|
||||
|
||||
- `components/reasoning-workspace.jsx` — optional chaining verified on all `focused.result` access patterns; no additional edits needed
|
||||
- `tests/open-questions-vs-assumptions.test.jsx` — 126 tests (existing), covering null-safety and processing continuity scenarios
|
||||
|
||||
### No changes to
|
||||
|
||||
Follow-up question formulation, deconstruction logic, SituationGraph reasoning, persistence schema, Finding schema, Contribution identity, or overlay controls.
|
||||
|
||||
---
|
||||
|
||||
## RESTORE / PRESENTATION FINDINGS — MANUAL USER-PATH (2026-08-28)
|
||||
|
||||
### Open restore / focused-workspace presentation issue
|
||||
|
||||
Reference in New Issue
Block a user