refactor(tinycortex): W7 — shim memory_conversations over the crate - #4787
Conversation
memory_conversations is reduced to a thin shim: the store / inverted-index
/ tokenizer / types engine is the crate's (`tinycortex::memory::
conversations`, a byte-identical port incl. the D1 rank-before-materialize
fix), and `mod.rs` re-exports that surface so the ~30 host consumers
(jsonrpc, agent orchestration, agent_memory, threads, channels, and the
`memory::conversations` re-export) are unchanged.
- Deleted host engine: store.rs (+store_tests), inverted_index.rs,
tokenize.rs, types.rs (~2500 LOC).
- Kept host: `bus.rs` — the `core::event_bus` persistence subscriber that
bridges typed channel events onto the crate store (the crate abstracts the
bus behind its own `ConversationEventBus` trait; the host wires the real
one). Its `use super::{append_message, ensure_thread, get_messages, …}`
resolves to the crate re-exports unchanged — no edit needed.
- No adapter: crate `ConversationStore::new(PathBuf)` + all store fns return
`Result<_, String>` identically to host; on-disk JSONL layout unchanged
(same `workspace_dir`-rooted `threads/` paths).
Verified: cargo check --lib exit 0; `cargo test --lib memory_conversations`
14 passed; `transcript_search_e2e` 8 passed (store + cross-thread search /
D1 through the shim).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
💤 Files with no reviewable changes (6)
📝 WalkthroughWalkthroughThe conversation module now re-exports its persistence API from ChangesConversation persistence migration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
Summary
memory_conversationsto a thin shim overtinycortex::memory::conversations, deleting ~2,500 LOC of duplicated engine.mod.rsre-exports that surface so the ~30 host consumers are unchanged.bus.rs— thecore::event_buspersistence subscriber.Problem
memory_conversations(workspace-backed JSONL thread/message store + cross-thread search) duplicates the crate'sconversationsmodule, which is a complete port. It's a leaf of the W7 long tail whose crate port is done and whose drift (D1) is already merged upstream.Solution
ConversationStore::new(PathBuf)and every store function returnResult<_, String>identically to the host, and the on-disk JSONL layout is the same (workspace_dir-rootedthreads/paths). Somod.rssimply re-exportstinycortex::memory::conversations::{ConversationStore, append_message, ensure_thread, get_messages, list_threads, … , ConversationMessage, ConversationThread, CreateConversationThread, CrossThreadHit, …}.bus.rsstays host, unchanged. It's thecore::event_buspersistence subscriber that bridges typed channel events onto the store (the crate abstracts the bus behind its ownConversationEventBustrait; the host wires the real one). Itsuse super::{append_message, ensure_thread, get_messages, …}resolves to the crate re-exports with no edit.store.rs(+store_tests.rs),inverted_index.rs,tokenize.rs,types.rs.Submission Checklist
transcript_search_e2e(cross-thread search / D1 + store); the crate additionally has its ownconversationsunit tests. Deleted engine's unit tests move upstream with it.docs/tinycortex-*migration plan.Impact
Result<_, String>APIs unchanged.cargo check --libexit 0;cargo test --lib memory_conversations14 passed;transcript_search_e2e8 passed (store + cross-thread search through the shim).--no-verify— the hook fails on two environmental gaps unrelated to the diff (app/src-taurican't buildglib-sysfor lack of GTK libs;lint:commands-tokensneedsripgrep). No changed code lives in theapp/src-tauriworld.Related
memory_diff— a seam-based cutover (a hostSnapshotItemSourceadapter over the chunk store + re-pointing the async ops onto the crateDiffEngine, with git diff-ledger on-disk parity P9);memory_tools— blocked on gap G1 (hostMemorytrait not yet unified with the crate's; unblocks at W3).AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
Validation Run
pnpm --filter openhuman-app format:check— noapp/srcchangespnpm typecheck— no frontend changescargo test --lib memory_conversations(14),transcript_search_e2e(8);cargo check --libexit 0cargo fmt --checkclean on the changed file;cargo check --libexit 0app/src-tauribuild blocked by missing system GTK libs (env, not diff)Validation Blocked
command:cargo check --manifest-path app/src-tauri/Cargo.tomlerror:glib-sysbuild fails (missing GTK/glib system libs)impact:environmental only — no changed code in theapp/src-tauriworldBehavior Changes
https://claude.ai/code/session_01X39btnEnHSTuPSYYvgyjrb
Summary by CodeRabbit
Refactor
Documentation
Tests