Skip to content

Embedded engine: off-executor SQL, KV read/write symmetry, KV conformance (#75) - #77

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
YellowSnnowmann:fix/75-embedded-batch
Aug 21, 2026
Merged

Embedded engine: off-executor SQL, KV read/write symmetry, KV conformance (#75)#77
senamakel merged 1 commit into
tinyhumansai:mainfrom
YellowSnnowmann:fix/75-embedded-batch

Conversation

@YellowSnnowmann

Copy link
Copy Markdown
Contributor

Summary

The embedded-engine batch of #75 — both machine-verified findings plus the coverage gap that hid one of them.

  • Off-executor SQL: every Memory-trait method on UnifiedMemory that ran synchronous rusqlite inline now hops to spawn_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; forget is split (sync lookup wrapped, internally-awaiting delete_document untouched). 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 symmetry: kv_get/kv_list canonicalize the caller key/prefix through the same canonical_identifier the write-path shim applies — put→get and put→list stop missing rewritten keys while kv_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.
  • KV conformance: assert_kv_round_trip joins the suite (put → get → list-by-prefix → delete → gone), one leg keyed by a formatted national-ID shape the canonicalizer provably rewrites, guarded by assert_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) needs updated_at from 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_trip is a new public conformance case (wired into assert_provider, capability-gated on as_graph()). Behavior: embedded Memory calls no longer block executor threads; KV reads find canonicalizer-rewritten keys (previously permanently unreadable).

Validation

  • cargo fmt --all -- --check — clean
  • cargo clippy --all-targets --all-features -- -D warnings — zero
  • cargo build --all-targets --all-features — clean
  • cargo 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

…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.
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Your included review limit has been reached.

You’re in a promotional period — use the checkbox below to run this review for free:

  • Run 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 @coderabbitai review --use-credits.

You can also wait for the limit to reset (next review available in 42 minutes), then comment @coderabbitai review or push new commits to the PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 720372ad-0a27-447d-aa05-5f69515272fa

📥 Commits

Reviewing files that changed from the base of the PR and between 1d501fb and 8652870.

📒 Files selected for processing (6)
  • crates/tinymemory-conformance/src/lib.rs
  • crates/tinymemory-conformance/src/suite/mod.rs
  • crates/tinymemory-core/src/store/memory_trait.rs
  • crates/tinymemory-tinycortex/Cargo.toml
  • crates/tinymemory-tinycortex/src/engine/mod.rs
  • crates/tinymemory-tinycortex/tests/full_provider_conformance.rs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking. Approving.

$0.0000 · 0 in / 0 out · 718 embedded · openrouter/openai/text-embedding-3-small

@tinysweeper

tinysweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown

How this change flows

2 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
Loading

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.

tinysweeper 0.1.0

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Aug 21, 2026
@senamakel
senamakel merged commit 1d6b997 into tinyhumansai:main Aug 21, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants