Skip to content

feat(web): render conclusion provenance from Honcho 3.2.0 source_ids - #108

Open
twistedgrim wants to merge 1 commit into
offendingcommit:mainfrom
twistedgrim:feat/dream-source-ids
Open

twistedgrim wants to merge 1 commit into
offendingcommit:mainfrom
twistedgrim:feat/dream-source-ids

Conversation

@twistedgrim

Copy link
Copy Markdown

Summary

Honcho v3.2.0 serves conclusion attribution natively (source_ids, times_derived). The premises/reasoning_tree fields this UI has been waiting on were never shipped upstream, so the dream premise tree has always rendered empty. This change makes the tree real against Honcho >= 3.2.0 while preserving graceful behavior on older deployments.

Changes

API schema

  • Regenerated src/api/schema.d.ts from live Honcho 3.2.0 openapi.json — adds level, source_ids, times_derived to Conclusion, and the typed GET /v3/workspaces/{workspace_id}/conclusions/{conclusion_id} route
  • The 3.2.0 schema inlines $defs blocks in the two /chat responses which openapi-typescript cannot resolve; they are hoisted into components/schemas during regeneration

Premise tree (src/lib/dreams.ts)

  • conclusionSourceIds(): native source_ids first, legacy premises alias as fallback
  • hasPremiseTree(): cheap pre-check the detail view uses to decide whether to offer expansion
  • expandPremiseTree(): children now source from source_ids; reasoning_tree retains precedence (harmless, nothing serves it, but avoids regressing any deployment that piped it in)
  • ExtendedConclusion re-declares level via Omit + widened string | null — Honcho may add levels at any time and unknown levels must classify as explicit, not drop rows

Data flow

  • DreamList builds a workspace-wide premise index and passes it to DreamDetail: a deductive conclusion's source_ids frequently point at explicit conclusions clustered into a different dream, which the old dream-local index could never resolve
  • Cross-dream premises missing from the loaded pages still show the existing "premise not in current page" node — lazy per-id fetching is a natural follow-up now that the single-conclusion GET route is typed

New required request fields (schema fallout)

  • dialectic chat calls send include_evidence: false
  • schedule_dream sends rebuild: false

Test environment

  • node 26 ships an experimental localStorage that is undefined without --localstorage-file; that undefined bleeds through the environment compat layer and clobbers jsdom's Storage, breaking the entire suite (115 failures on main before any of my changes). setup.ts now installs an in-memory Storage shim when real storage is absent, and vitest.config.ts pins the jsdom URL as an opaque-origin guard

Verification

  • pnpm typecheck clean
  • pnpm test: 123 passed (19 files), including 7 new tests covering source_ids-native walking, source_ids-over-premises precedence, legacy fallback, and the hasPremiseTree/conclusionSourceIds contracts
  • pnpm lint clean
  • pnpm build succeeds
  • Verified against live Honcho 3.2.0: conclusion payloads carry source_ids/times_derived (direct observations have source_ids: null, times_derived: 1)

Honcho v3.2.0 serves conclusion attribution natively (source_ids,
times_derived); the legacy premises/reasoning_tree fields were never
shipped upstream, so the dream premise tree has always been empty.

- regenerate api schema against live Honcho 3.2.0 (level, source_ids,
  times_derived, GET /conclusions/{id}); hoist the chat $defs blocks
  the 3.2.0 schema inlines so openapi-typescript can resolve them
- dreams.ts: conclusionSourceIds() prefers native source_ids with the
  legacy premises alias as fallback; hasPremiseTree() pre-check;
  ExtendedConclusion re-declares level as widened string (Omit) because
  Honcho may add unknown levels
- walk() sources children from source_ids, keeping reasoning_tree
  precedence for older forks that served it
- DreamList builds a workspace-wide premise index and passes it to
  DreamDetail so a deductive conclusion can resolve sources grouped
  into a different dream
- dialectic chat calls send include_evidence: false (new required field)
- schedule_dream sends rebuild (new required field)

Test environment fixes (needed to run the suite on node 26):
- node 26's experimental localStorage is undefined without
  --localstorage-file and clobbers jsdom's Storage through the compat
  layer; setup.ts installs an in-memory Storage shim
- vitest environmentOptions pins jsdom url (opaque-origin guard)

Tests: 123 pass (22 in dreams.test.ts, +7 new for source_ids semantics)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant