Commit Graph
257 Commits
Author SHA1 Message Date
robbond 8432ed45d4 fix(confidence-engine): keep episode reasoning server-side 2026-09-01 11:24:48 +01:00
robbond 650877e5bf feat(confidence-engine): wire authoritative Done-for-now episode reconsideration
Adopt executeEpisodeDone orchestration as the canonical path for
'Done for now' activity boundary: one user Done triggers exactly
prepareCompletedEpisode -> reconsiderCompletedEpisode -> applyValidatedProposal
-> Current Understanding synthesis -> leave focused workspace.

Production changes (components/scenario-form.jsx):
- Add prepareCompletedEpisode, reconsiderCompletedEpisode, applyValidatedProposal imports
- Export executeEpisodeDone({params}) with all 4 domain functions as named
  parameters (defaults to module exports) for deterministic test wiring
- Rewrite handleDoneForNowPromotion(targetNodeId) as async: delegates to
  executeEpisodeDone pipeline; CU synthesis installed only on success
- Add doneInProgressRef useRef(false) for exactly-once Done enforcement
- On synthesis failure: KEEP updated graph, KEEP Findings, KEEP existing CU
- Retire produceFindingInformedSummary from ScenarioForm (legacy CU writer)
- Remove legacy idempotence guard and Evidence:[] regex dedup

Test changes (tests/ui/scenario-form-episode-done.test.jsx):
- 9 tests verifying orchestration pipeline correctness:
  1. Successful path order: prepare -> reconsider -> apply -> synthesis
  2. Correct prepared episode input parameters
  3. Structured application evidence (no answer fields in context)
  4. nextGraph used for synthesis (not stale result state)
  5. Reasoning failure: apply not called, CU synthesis not called
  6. Application failure: CU synthesis not called, graph not replaced
  7. Synthesis failure: nextGraph remains installed (no rollback)
  8. Exactly-once per call for each domain function
  9. Legacy Done writer retired (pipeline does not produce deterministic summary)
2026-09-01 10:05:12 +01:00
robbond c89cc51ae6 feat(confidence-engine): add completed episode reasoning seam 2026-09-01 09:28:02 +01:00
robbond ab655e2222 fix(confidence-engine): scope episode closure authority 2026-09-01 08:55:38 +01:00
robbond 0752c53a25 feat(confidence-engine): accept episode evidence at graph application 2026-09-01 08:30:26 +01:00
robbond 6b77e32771 feat(confidence-engine): accept completed episode reasoning input 2026-09-01 06:59:04 +01:00
robbond efa39f52de feat(confidence-engine): prepare completed episode evidence 2026-09-01 06:48:55 +01:00
robbond b270aa5624 feat(confidence-engine): case/update synthesis — dedicated reconstruction per update (v0.50)
Architecture: after successful /api/cases/update, derive explicit nextGraph +
nextFindings, call synthesizeFromFindings exactly once, replace Current
Understanding with reconstruction result.

Key invariants:
- outcome.summary retired as final CU authority → always synthesis reconstruction
- Explicit derived state (no React-state reread) for graph and findings
- Previous CU preserved on synthesis failure (no fallback to outcome.summary)
- Graph and Findings NOT lost on synthesis failure
- saveInvestigation persistence uses currentUnderstanding, not outcome.summary

Deterministic regression: 7 tests (Cases A-E + 2 edges) covering all rules.

Files: components/scenario-form.jsx, tests/ui/scenario-form-case-update-synthesis.test.jsx
2026-08-31 09:22:50 +01:00
robbond 989b88a4a1 feat(confidence-engine): synthesize restored findings 2026-08-31 08:18:44 +01:00
robbond addec52461 feat(confidence-engine): synthesize not relevant findings 2026-08-31 08:03:24 +01:00
robbond 5fb32e628c feat(confidence-engine): synthesize corrected findings 2026-08-31 07:48:29 +01:00
robbond 8e941b0c7b fix(confidence-engine): resolve synthesis model configuration 2026-08-31 07:32:04 +01:00
robbond 75f7c6bafd feat(confidence-engine): synthesize understanding from focused findings 2026-08-30 19:27:30 +01:00
robbond ff1119b4d5 feat(confidence-engine): establish current understanding synthesis seam 2026-08-30 18:48:38 +01:00
robbond bdb234262c fix(confidence-engine): close workspace after done for now 2026-08-30 12:06:33 +01:00
robbond 16cab4645a fix(confidence-engine): workspace control cleanup — rename close button, remove 'Back to open questions' from navigation 2026-08-30 11:35:15 +01:00
robbond 922f58a49f fix(confidence-engine): project processing indicator to active follow-up block
Repair LOCATION-A defect where processing feedback rendered near the
completed narrative instead of inside the active follow-up block.

Changes:
  - components/reasoning-workspace.jsx: three targeted edits using a single
    spinner component with conditional rendering; hasActiveFollowUp routes
    ownership to the correct container
  - tests/open-questions-vs-assumptions.test.jsx: regression test confirming
    exactly one indicator, DOM child of follow-up-block, ownership separation

Accepted criteria met:
   Exactly one processing indicator during follow-up processing
   Indicator is a DOM child of follow-up-block
   Top-level indicator suppressed when follow-up active
   Initial answer flow preserved (top-level when no follow-up)
   Successful follow-up promotion intact
   All existing context retained
   No new state/lifecycle changes/error redesign
2026-08-30 11:09:24 +01:00
robbond bf7629691f fix(confidence-engine): preserve follow-up context while processing 2026-08-30 10:43:57 +01:00
robbond ae1201bb27 fix(confidence-engine): simplify active follow-up presentation 2026-08-30 08:51:18 +01:00
robbond 8bded90094 fix(confidence-engine): preserve follow-up progression ownership 2026-08-30 08:28:29 +01:00
robbond 17c6048047 fix(confidence-engine): preserve completed-narrative when selecting follow-up + reverse prior-contribs display
Two presentation fixes (no reasoning-engine changes):

A. Follow-up answer continuity — selectFollowUpQuestion clears focused.answer,
   which previously caused the completed-narrative framing ('Previously answered'
   and 'Your response') to disappear mid-investigation. The guard now treats
   a non-null result as sufficient evidence of a completed-context state, so the
   user's verbatim answer and derived findings remain visible while a follow-up is
   being formulated.

B. Prior-contributions chronology — display order in 'Previous learning' panels
   has been reversed at the presentation boundary (newest → oldest). This means
   users see the most recently learned evidence first, without modifying data-order
   anywhere else. Applies to both PriorContributionsSummary and
   SecondaryPreviousLearning.
2026-08-29 19:04:06 +01:00
robbond 890a18c5a7 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
2026-08-29 18:45:55 +01:00
robbond 88d9768276 fix(confidence-engine): distinguish completed focused result 2026-08-29 18:09:26 +01:00
robbond b9c0b6f6f7 fix(confidence-engine): show focused investigation activity 2026-08-29 15:15:28 +01:00
robbond 0f4dfcbb17 fix(confidence-engine): show canonical findings in previous learning 2026-08-29 14:38:04 +01:00
robbond a8539e2494 fix(confidence-engine): restore finding controls on reopen 2026-08-28 13:25:24 +01:00
robbond 10cbcbdd05 fix(confidence-engine): preserve investigation activity across turns
ThreadContributionsBadge, PriorContributionsSummary, and
SecondaryPreviousLearning all filtered contributions via
c.targetNodeId === nodeId. Multi-turn follow-up Contributions carry a
different immediate targetNodeId while the canonical origin remains on
Findings (originatingTargetNodeId).

Repaired: all contribution filters now match on EITHER
c.targetNodeId === nodeId || c.originatingTargetNodeId === nodeId.
handleDeconstructSubmit carries originatingTargetNodeId from
focusedPresentationItemId as provenance for cold-return recovery.
2026-08-28 11:56:31 +01:00
robbond 556acfb156 feat(confidence-engine): render INVESTIGATING cue on Open Question cards with focused history
- ThreadContributionsBadge (rendered per-node on OpenQuestionsPanel
  cards and Done-for-now cards) now shows an amber INVESTIGATING
  indicator when the node has matching contributions via targetNodeId
  identity match.
- UNCLEAR and INVESTIGATING cues coexist independently on the same
  card — UNCLEAR is epistemic state, INVESTIGATING is activity cue.
- Deterministic test suite added: focused-investigation-history (11
  tests) covering identity matching, zero-contrib edge cases,
  multiple-contrib coalescing, done-for-now retention, and uncoupling
  from UNCLEAR state.
- All 57 tests pass.
2026-08-28 11:25:40 +01:00
robbond f1bd91faf8 feat(confidence-engine): promote focused learning on done 2026-08-28 10:48:45 +01:00
robbond e221bd3bf8 feat(confidence-engine): isolate finding-informed understanding 2026-08-28 08:16:37 +01:00
robbond 166ee91698 feat(confidence-engine): persist canonical investigation state 2026-08-27 16:21:41 +01:00
robbond bc35e05253 refactor(confidence-engine): migrate scenario persistence to storage provider 2026-08-27 15:44:58 +01:00
robbond ba956eeb3a refactor(confidence-engine): add investigation storage provider 2026-08-27 15:24:38 +01:00
robbond 22e1d7484b feat(confidence-engine): support finding corrections 2026-08-27 13:43:23 +01:00
robbond 5c926154cd feat(confidence-engine): support not-relevant findings 2026-08-27 12:08:11 +01:00
robbond 7858650334 feat(confidence-engine): expose correlated findings to focused presentation 2026-08-27 09:23:51 +01:00
robbond ca7d8e5384 feat(confidence-engine): correlate focused result with contribution 2026-08-27 08:37:23 +01:00
robbond 061ea364b3 feat(confidence-engine): derive findings from focused contributions 2026-08-27 06:44:07 +01:00
robbond abeb3fcb03 feat(confidence-engine): add focused investigation overlay workspace 2026-08-26 19:22:54 +01:00
robbond 3235c35cf0 feat(confidence-engine): add focused finding handoff plumbing 2026-08-26 16:07:21 +01:00
robbond cb707c0192 test(confidence-engine): capture tentative mapping regression 2026-08-26 14:06:51 +01:00
robbond fdb173d0e9 feat(confidence-engine): anchor focused frontier to investigation relevance 2026-08-26 12:16:41 +01:00
robbond cfd463d8b3 test(confidence-engine): capture structural frontier priority regression 2026-08-26 12:10:07 +01:00
robbond fd02be0f29 fix(confidence-engine): render focused investigation in current presentation 2026-08-26 11:52:18 +01:00
robbond 6288ef1031 fix(confidence-engine): keep focused investigation in current presentation 2026-08-26 11:30:59 +01:00
robbond 81dda77392 fix(confidence-engine): reopen completed focused investigation 2026-08-26 10:20:45 +01:00
robbond 42a7e82d88 feat(confidence-engine): tighten focused relationship attribution 2026-08-26 07:56:27 +01:00
robbond 3ca37b0918 test(confidence-engine): checkpoint focused deconstruction regression cases 2026-08-26 07:34:22 +01:00
robbond 112739b8e5 feat(confidence-engine): checkpoint focused deconstruction reasoning 2026-08-25 15:10:09 +01:00
robbond 9d670822a3 feat(confidence-engine): preserve focused deconstruction semantic fidelity 2026-08-24 10:11:06 +01:00