Embedded engine: off-executor SQL, KV read/write symmetry, KV conformance (#75) - #77
Conversation
…s spell keys the way writes do (tinyhumansai#75) Every Memory-trait method on UnifiedMemory that ran synchronous rusqlite work inline now hops to spawn_blocking, the same idiom the adapter's profile and episodic families always used: bodies extracted into synchronous associated fns, parameters owned before the move, join failures contexted. recall's two synchronous fts5 fetches hop the same way with join faults folded into their existing non-fatal arms; forget is split — only its lookup is synchronous, delete_document awaits internally and stays put. The adapter's offloading claims stop being aspirational, and the two Cargo.toml comments are narrowed to the families that actually hop (the KV/graph accessors go through the client shim inline). TinycortexProvider::kv_get and kv_list now canonicalize the caller key and prefix through the same canonical_identifier the write-path shim applies, restoring put→get and put→list symmetry — kv_delete always went through the shim, which is exactly the incoherent split that let a rewritten key be stored, deleted, but never read. Prefix matching is documented as over canonical stored keys. The conformance suite grows assert_kv_round_trip: put → get → list-by-prefix → delete → gone, with one leg keyed by a formatted national-ID shape the canonicalizer provably rewrites (guarded by assert_ne! so predicate drift fails loudly, not silently) — the KV family previously had zero conformance coverage, which is how the asymmetry stayed invisible. Adapter-level tests pin the same symmetry under a rewritten namespace as well. Closes the embedded batch of tinyhumansai#75.
|
Warning Review limit reachedYour included review limit has been reached. You’re in a promotional period — use the checkbox below to run this review for free:
On-demand reviews are free for the next 30 days. After that, they cost $0.25 per reviewed file. How can I continue?Run this review now using the option above, or comment You can also wait for the limit to reset (next review available in 42 minutes), then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
How this change flows2 changed behaviours across 10 relationships. 6 surrounding behaviours are shown (60 graph nodes walked). 42 further behaviours left out to keep the diagram readable. flowchart LR
n0["assert_awkward_content_round_trips<br/>changed"]:::changed
n1["assert_provider<br/>changed"]:::changed
n2["fresh_mem"]:::impacted
n3["ns"]:::impacted
n4["...es_external_sync_taint_for_origin_upgrade"]:::impacted
n5["iter"]:::impacted
n6["cleanup"]:::impacted
n7["recall"]:::impacted
n0 -->|calls| n3
n0 -->|calls| n5
n0 -->|calls| n6
n1 -->|calls| n0
n4 -->|calls| n2
n4 -->|tests| n2
n4 -->|calls| n5
n4 -->|tests| n5
n4 -->|calls| n7
n4 -->|tests| n7
classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Green: changed behaviour. Grey: surrounding behaviour. Arrows name the call, use, implementation, or test relationship. Orange: has findings. Red: has a finding that blocks the merge. |
Summary
The embedded-engine batch of #75 — both machine-verified findings plus the coverage gap that hid one of them.
Memory-trait method onUnifiedMemorythat ran synchronous rusqlite inline now hops tospawn_blocking, copying the profile/episodic families' exact idiom (extracted sync bodies, owned params, contexted joins).recall's two synchronous fts5 fetches hop the same way;forgetis split (sync lookup wrapped, internally-awaitingdelete_documentuntouched). The repo documented this offloading in three places while the hot path did the opposite — the claims are now true, and the two Cargo.toml comments are narrowed to the families that actually hop.kv_get/kv_listcanonicalize the caller key/prefix through the samecanonical_identifierthe write-path shim applies — put→get and put→list stop missing rewritten keys whilekv_delete(always shim-routed) worked, the incoherent split Remote + embedded audit at v1.1.0: Supermemory re-store 400s (PATCH drops containerTag), keyed-seam gaps, and verified adapter defects #75 flagged. Prefix matching documented as over canonical stored keys.assert_kv_round_tripjoins the suite (put → get → list-by-prefix → delete → gone), one leg keyed by a formatted national-ID shape the canonicalizer provably rewrites, guarded byassert_ne!so predicate drift fails loudly. The KV family had zero conformance coverage — how the asymmetry survived. Adapter tests pin symmetry under a rewritten namespace too.Deliberate scope choices: the spec's Luhn digit-run fixture would have been vacuous (bare digit runs are deliberately outside the strict PII gate — the #1201 Luhn-FP history), so the fixture is a shape the gate really rewrites, machine-checked. A keyed KV record fetch (to stop
kv_get's namespace listing) needsupdated_atfrom the vendored tinycortex's keyed getters, which don't return it — deferred until a tinycortex-side additive change exists.Public API and behavior changes
Additive only:
assert_kv_round_tripis a new public conformance case (wired intoassert_provider, capability-gated onas_graph()). Behavior: embedded Memory calls no longer block executor threads; KV reads find canonicalizer-rewritten keys (previously permanently unreadable).Validation
cargo fmt --all -- --check— cleancargo clippy --all-targets --all-features -- -D warnings— zerocargo build --all-targets --all-features— cleancargo test --all-features— green; red-proof: reverting the engine fix reds 3 tests (both adapter KV tests + the suite case through the full provider)Companion PRs: #76 (remote adapter batch, same issue). Closes the embedded-batch checkboxes of #75.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TVSoZqKtJzAqTnYk4WBuEV