Commit Graph
639 Commits
Author SHA1 Message Date
robbond 41ea2cb6b9 test(confidence-engine): add direct initial decomposition apparatus
Establishes reusable apparatus for asking: given scenario text X,
what structured initial decomposition does current production path produce?

- Direct curl/Postman via existing /api/cases/start route (no new API)
- Thin CJS helper at scripts/start-case-experiment-helper.cjs for Claude
  experiments (imports startCase directly, zero code duplication)
- Zero-live-call verification: all four seam checks confirmed by existing
  tests (cases-start-route.test.js, start-case-summary.test.js)
- No browser state, no persistence mutation, no Investigation ID required
  by the route itself

Files:
  + scripts/start-case-experiment-helper.cjs (new helper script)
  M docs/current-handoff.md (§v0.61 apparatus documentation)
2026-09-04 13:36:25 +01:00
robbond e6f2249413 docs(confidence-engine): close v0.60 multi-investigation work 2026-09-04 12:19:20 +01:00
robbond cc3a5dabd4 feat(confidence-engine): v0.60j preserve investigation on restart 2026-09-04 10:18:22 +01:00
robbond 4bc998ee3f test(confidence-engine): verify v0.60h report identity 2026-09-04 09:34:03 +01:00
robbond 2af5971987 feat(confidence-engine): v0.60h migrate report route to use route [id] identity 2026-09-04 08:17:01 +01:00
robbond df142ca76c feat(confidence-engine): v0.60g2 render investigation portfolio 2026-09-04 07:58:04 +01:00
robbond 7ba1771bcf feat(confidence-engine): v0.60g1 list investigation summaries
Recover to clean v0.60f then implement only the storage listing contract.

- Add listInvestigations() to provider: enumerate by prefix, project lightweight summary (id, scenario, updatedAt, investigationRevision, reportExists, reportGeneratedFromRevision), sort by updatedAt desc
- Add application-facing wrapper in investigation-storage.js
- Add 8 deterministic tests covering all listing invariants (coexistence, correct IDs, lightweight projection, legacy exclusion, unrelated exclusion, independent update, ordering, malformed skip)
- Fix MockStorageMap WebStorage API compatibility (.length + .key(i))
- Portfolio NOT migrated — that is v0.60g2
2026-09-04 06:45:26 +01:00
robbond 4b55ad1eae feat(confidence-engine): v0.60f allocate investigation identity on create
Replace Portfolio's static "+ Create new investigation" link (href:
/investigations/case-1) with a <button> that allocates an opaque
application-owned durable ID via crypto.randomUUID() and navigates
via router.push to /investigations/{id} without persisting any empty
Investigation.

INVESTIGATION_ID constant retained only for card links (Continue
investigation / View report) — not migrated in this increment.

Test: deterministic Create New activation test verifies UUID allocation,
navigation to generated ID route, and zero saveInvestigation calls.
2026-09-03 19:20:28 +01:00
robbond 01e141aa66 feat(confidence-engine): v0.60e route investigation identity
Migrate the Investigation page route to own durable investigation identity
via its route [id] segment, passing that ID through to ScenarioForm for
hydration and persistence.

- Remove hardcoded INVESTIGATION_ID constant from page.jsx
- Use params.id as routeId; loadInvestigation(routeId) loads by identity
- Pass investigationId prop into ScenarioForm in both branch paths
- Session restore calls loadInvestigation(investigationId)
- All 4 save call sites include id: investigationId in snapshot
- Missing identified Investigation starts clean (no singleton fallback)
- Legacy singleton is not migrated/fallback-loaded
- Portfolio remains unmigrated; Report remains unmigrated; Restart untouched

Deterministic tests: 34/34 pass (scenario-form-persistence + investigation-storage)
Build: PASS
Live Playwright: all criteria verified at /investigations/v060e-live
2026-09-03 19:02:37 +01:00
robbond 827411f254 refactor(confidence-engine): v0.60d clarify investigation storage identity
Replace bare re-export in investigation-storage.js with explicit wrapper
functions that own the canonical identity contract: snapshot.id is the sole
save identity authority. The provider never allocates or changes IDs.

7 new deterministic tests prove: identified snapshots persist under their
own id key, explicit competing id arguments are ignored, A/B remain
independently addressable, unknown IDs return null, and legacy singleton
compatibility is preserved for unmigrated callers.

No application callers modified. UI/routes not migrated.
2026-09-03 18:29:00 +01:00
robbond 8c85120b1c feat(confidence-engine): v0.60c identity-aware investigation storage
- loadInvestigation(id) selects by durable ID when provided, null for unknown
- saveInvestigation(snapshot, id) persists under provider-chosen key derived from id
- clearInvestigation(id) removes specific investigation by identity when provided
- localStorage representation: confidence-engine-investigation:<durable-id>
- Backward-compatible singleton path preserved for existing unmigrated callers
- 6 new targeted tests proving two independently addressable Investigations
2026-09-03 18:09:03 +01:00
robbond f23d442eb3 docs(confidence-engine): resolve v0.60 investigation creation ownership 2026-09-03 17:44:17 +01:00
robbond 06a200bb03 docs(confidence-engine): define v0.60 investigation storage contract 2026-09-03 17:35:55 +01:00
robbond 2df026d024 fix(confidence-engine): align portfolio report freshness layout 2026-09-03 16:41:18 +01:00
robbond ede5d54e36 fix(confidence-engine): v0.59c-layout — stack freshness beneath View report
Replace flex-row View report + status with flex-col stack so the
freshness label sits below the button and no longer floats between
actions on the Portfolio.
2026-09-03 15:50:52 +01:00
robbond f06138de32 feat(confidence-engine): v0.59b-c — report freshness on Report page + Portfolio
v0.59b — Report page freshness UI:
- Shows Current / Update available beside the generated report
- Manual Update report action with duplicate prevention guard
- Explanation copy about investigation changes since generation
- Persists generatedFromRevision during update flow

v0.59c — Portfolio Report freshness state:
- Surfaces Current / Update available alongside existing View report link
- Derives solely from revision provenance (zero model calls)
- No Update report action on Portfolio (manual update owned by Report page)
- Neither state shown when no Report exists
- Updated makeSnapshot with investigationRevision for realistic test data
2026-09-03 14:41:02 +01:00
robbond 99b3d26817 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.
2026-09-03 13:39:40 +01:00
robbond 37a9a12f93 docs(confidence-engine): route design evolution provenance through archive index 2026-09-03 11:56:36 +01:00
robbond fb2384cff1 docs(confidence-engine): promote design evolution archive index 2026-09-03 11:49:42 +01:00
robbond 2ed91468ed docs(confidence-engine): complete design evolution archive extraction 2026-09-03 11:42:40 +01:00
robbond c33bcdbefa docs(confidence-engine): checkpoint design evolution archive tranche seven 2026-09-03 11:34:04 +01:00
robbond 53cb99ee8f docs(confidence-engine): checkpoint design evolution archive tranche six 2026-09-03 11:19:05 +01:00
robbond bb3da3d197 docs(confidence-engine): checkpoint design evolution archive tranche five 2026-09-03 11:10:03 +01:00
robbond 37b1892d86 docs(confidence-engine): checkpoint design evolution archive tranche four 2026-09-03 11:02:11 +01:00
robbond 1f3b26c983 docs(confidence-engine): checkpoint design evolution archive tranche three 2026-09-03 10:55:03 +01:00
robbond e611283e3e docs(confidence-engine): checkpoint design evolution archive tranche two 2026-09-03 10:45:12 +01:00
robbond 83a66560ae docs(confidence-engine): checkpoint design evolution archive tranche one 2026-09-03 10:35:07 +01:00
robbond 577781eff8 docs(confidence-engine): consolidate current context and provenance 2026-09-03 09:37:04 +01:00
robbond 7db28c8611 feat(confidence-engine): generate investigation report on demand 2026-09-03 09:18:29 +01:00
robbond 99b75dca4e feat(confidence-engine): confirm destructive investigation restart 2026-09-03 07:36:43 +01:00
robbond 0da7b63e30 refine(confidence-engine): clarify portfolio investigation actions 2026-09-03 07:01:18 +01:00
robbond 32e1b01767 feat(confidence-engine): separate investigation report routes 2026-09-03 06:39:35 +01:00
robbond 745026f0a0 feat(confidence-engine): v0.54b integrate Investigation Overview UI seam + bounded scroll cleanup
- Wire transient overview state from ScenarioForm to ReasoningWorkspace
- Inline rendering of investigation overview below milestone invitation
- Remove obsolete scrollIntoView after overview request (scrolled away from rendered content)
- All four overview props consumed in ReasoningWorkspace render path
- Targeted Vitest: 9/9 PASS (tests/ui/investigation-overview-ui.test.jsx)
- Production build: compiles successfully
2026-09-02 15:14:20 +01:00
robbond 83818c0c71 feat(confidence-engine): add investigation overview synthesis seam 2026-09-02 14:34:32 +01:00
robbond 194a742772 docs(confidence-engine): checkpoint empty done and reopen 2026-09-02 13:51:05 +01:00
robbond f2c9e4c0b2 fix(confidence-engine): align empty done and reopen state
- Empty Done immediate transition now sets node.status to resolved
  alongside resolvedNodeIds/doneForNowIds — same canonical parked
  shape as populated Done (no server call required)
- Clarified-question Re-open removes target from doneForNowIds so
  the question visibly returns to Open Questions
- Immediate graph mutation creates new node objects immutably
  (React state semantics), touching only the target node
2026-09-02 13:37:15 +01:00
robbond 2b2096e41d fix(confidence-engine): scope focused presentation to active question
- FocusedQuestionBody derives thread-local contribution subset using
  targetNodeId || originatingTargetNodeId matching
- hasCompletedContext, latest completed contrib, and all effective
  presentation fallbacks use scoped collection only
- scenario-wide focusedContributions history preserved in memory
- Fresh Question B no longer bleeds Question A's content across
  every presentation surface (Previously answered, What this tells us,
  Still unclear, Questions this raises, Assumptions, Connections)
- Reopening or revisiting Question A still uses its own history
- Targeted regression: 3 new Vitest cases pass
- Handoff docs updated with v0.52 correction record
2026-09-02 12:46:50 +01:00
robbond a061428711 feat(confidence-engine): place zero-Open-Questions milestone at Open Questions position
Move the milestone invitation from after Clarified Questions to occupy
the same spatial position as Open Questions — between Current Understanding
and Questions we have clarified. Uses ternary: openUnknowns > 0 ? OpenQuestionsUI : milestoneAllowed ? MilestoneInvitation : null, followed by ClarifiedQuestionsUI unconditionally. No duplication of clarified cards or Re-open controls.
2026-09-02 12:02:55 +01:00
robbond 043ba5f264 feat(confidence-engine): clarify understanding during Done refresh 2026-09-02 07:53:45 +01:00
robbond b647236d44 fix(confidence-engine): constrain understanding to supported evidence 2026-09-01 18:17:26 +01:00
robbond 161527f66c docs(confidence-engine): record understanding refresh invariant 2026-09-01 16:37:42 +01:00
robbond cd895a33ff feat(confidence-engine): reopen clarified questions 2026-09-01 16:07:22 +01:00
robbond a23da2b727 refactor(confidence-engine): expose canonical graph replacement seam 2026-09-01 15:15:55 +01:00
robbond 9da0928453 feat(confidence-engine): retain clarified questions 2026-09-01 15:09:45 +01:00
robbond 76c6096905 fix(confidence-engine): resolve model for episode reasoning 2026-09-01 13:24:37 +01:00
robbond d22c992f60 fix(confidence-engine): avoid Done result shadowing 2026-09-01 12:17:32 +01:00
robbond 7177c7bb61 refactor(confidence-engine): make episode preparation server-owned 2026-09-01 11:54:02 +01:00
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