Skip to content

feat(module): serve the complete TinyMemory API - #10

Merged
senamakel merged 3 commits into
mainfrom
drop-tiny-crates
Aug 12, 2026
Merged

feat(module): serve the complete TinyMemory API#10
senamakel merged 3 commits into
mainfrom
drop-tiny-crates

Conversation

@senamakel

@senamakel senamakel commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary

  • move all thirteen TinyMemory capability families behind the compiled TinyBus module
  • keep embeddings, chat, NLP, memory events, and error reporting host-owned through typed TinyBus callbacks
  • expose the module-owned high-level store client needed by document, graph, tree, source, and maintenance operations

Validation

  • cargo clippy --manifest-path crates/tinymemory-module/Cargo.toml --all-targets -- -D warnings
  • cargo test --manifest-path crates/tinymemory-module/Cargo.toml
  • release module E2E capability and manifest checks

Summary by CodeRabbit

  • New Features
    • Expanded TinyMemory capabilities for documents, ingestion, graphs, entities, goals, tool rules, sources, snapshots, and maintenance.
    • Added chat integration through the configured TinyBus service.
    • Added runtime event, error, and NLP service integration.
    • Added configurable memory, AI, provider, model, language, and source settings.
    • Added top-entity queries with mention counts and recency ranking.
    • Added local-AI memory client creation and broader memory provider support.
  • Bug Fixes
    • Improved validation and error reporting for unsupported operations and invalid inputs.

Co-authored-by: Medulla <medulla@tinyhumans.ai>
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@senamakel, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b06eee1f-44fe-4d96-8403-e2156a8a63f5

📥 Commits

Reviewing files that changed from the base of the PR and between cc0525a and bbffe68.

📒 Files selected for processing (5)
  • core/src/store/entities.rs
  • crates/tinymemory-module/src/lib.rs
  • crates/tinymemory-module/src/provider.rs
  • crates/tinymemory-module/src/service/mod.rs
  • crates/tinymemory-module/src/service/test.rs
📝 Walkthrough

Walkthrough

The PR expands TinyMemory from mandatory capabilities to the complete capability surface. It adds module-owned provider implementations, TinyBus forwarding methods, chat and runtime hosts, shared client construction, configuration fields, and end-to-end capability checks.

Changes

TinyMemory capability expansion

Layer / File(s) Summary
Core contracts and client construction
api/src/host/events.rs, core/src/store/client.rs, core/src/store/entities.rs, core/src/store/factories.rs
Event types now support Serde. MemoryClient can wrap shared UnifiedMemory. The public top_entities query and local-AI client factory are added.
Module configuration and host wiring
crates/tinymemory-module/Cargo.toml, crates/tinymemory-module/src/config.rs, crates/tinymemory-module/src/chat.rs, crates/tinymemory-module/src/host.rs, crates/tinymemory-module/src/lib.rs
Module configuration gains runtime settings. Bus-backed chat and runtime hosts are added. Setup installs both hosts and serves the module-owned provider.
Module memory provider
crates/tinymemory-module/src/provider.rs
ModuleMemoryProvider implements memory, ingestion, documents, trees, entities, graphs, key-value storage, relations, goals, tool rules, sources, snapshots, and maintenance operations.
Complete TinyBus API surface
crates/tinymemory-module/src/service/mod.rs, crates/tinymemory-module/src/lib.rs
The service forwards all capability families through guarded provider accessors and maps provider failures to bus errors.
Complete capability validation
crates/tinymemory-module/tests/module_e2e.rs
End-to-end checks now require all capability families and the expanded method list.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TinyBus
  participant MemoryService
  participant ModuleMemoryProvider
  participant MemoryClient
  participant UnifiedMemory
  TinyBus->>MemoryService: Send capability request
  MemoryService->>ModuleMemoryProvider: Validate capability and delegate
  ModuleMemoryProvider->>MemoryClient: Execute operation
  MemoryClient->>UnifiedMemory: Read or update memory
  UnifiedMemory-->>MemoryClient: Return operation result
  MemoryClient-->>ModuleMemoryProvider: Return converted result
  ModuleMemoryProvider-->>MemoryService: Return response or error
  MemoryService-->>TinyBus: Return bus response
Loading

Poem

I’m a rabbit with a bus to ride,
Through memory paths both far and wide.
Chat and runtime hosts now sing,
While every capability takes wing.
Serde carrots bounce in the queue! 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the module exposing the complete TinyMemory API, which is the pull request's main change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/tinymemory-module/src/lib.rs (1)

106-108: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Validate before claiming the process setup slot.

Line 107 sets the permanent claim before line 108 can return a validation error. A malformed first configuration prevents every later valid setup request in the same process. Validate the configuration before calling claim_process_setup.

Proposed fix
 async fn setup(connection: Connection, mut config: ModuleConfig) -> BusResult<()> {
-    claim_process_setup()?;
     config.validate().map_err(setup_error)?;
+    claim_process_setup()?;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/tinymemory-module/src/lib.rs` around lines 106 - 108, In setup,
validate config with config.validate().map_err(setup_error)? before calling
claim_process_setup() so invalid configuration does not consume the process
setup slot; retain both existing error mappings and claim behavior for valid
configurations.
🧹 Nitpick comments (1)
crates/tinymemory-module/src/provider.rs (1)

448-506: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy lift

Use bounded store queries for KV and relation reads.

kv_get scans all typed records instead of using a typed direct lookup. kv_list filters and truncates after loading every record. relations fetches up to 300 rows per SQL query before truncating, and namespace: None merges two such result sets. Add store-side key, prefix, and limit parameters. The existing MemoryClient::kv_get returns only serde_json::Value, so preserve MemoryKvRecord.updated_at with a typed lookup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/tinymemory-module/src/provider.rs` around lines 448 - 506, Update the
provider methods kv_get, kv_list, and relations to use bounded store-side
queries: pass the key to the typed KV lookup, pass prefix and limit to KV
listing, and pass limit to graph_relations so each namespace query is bounded
before any merge. For kv_get, use the typed lookup needed to retain
MemoryKvRecord.updated_at rather than falling back to MemoryClient::kv_get,
which returns only serde_json::Value; preserve the existing conversion and error
handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/tinymemory-module/src/provider.rs`:
- Around line 921-971: Update accept_source_items so a put_doc failure records
the partial ingest outcome instead of immediately returning and discarding
previously written IDs. Preserve successful writes in outcome.written and
outcome.ids, capture the failed item’s error according to the existing
IngestOutcome/MemoryError contract, and either continue processing remaining
items or return the accumulated outcome alongside the error as supported by the
API.
- Around line 718-747: The entities method currently ignores its _namespace
argument and accesses global entity state, violating namespace scoping. Update
entities to use namespace-aware entity retrieval for both query and top-entity
paths; if the storage layer cannot scope these operations, return a named
unsupported error instead of reading global indexes. Rename the parameter from
_namespace and preserve the existing result mapping and error propagation.

In `@crates/tinymemory-module/src/service/mod.rs`:
- Around line 316-326: Apply the response-size guard consistently in
query_documents, query_source, entities, kv_list, and relations by generalizing
ensure_response_fits to accept and estimate any serializable response. Invoke it
before each method returns its retrieval payload, and return
wire::BUDGET_EXCEEDED when the serialized response would exceed the 16 MiB
TinyBus frame limit.

---

Outside diff comments:
In `@crates/tinymemory-module/src/lib.rs`:
- Around line 106-108: In setup, validate config with
config.validate().map_err(setup_error)? before calling claim_process_setup() so
invalid configuration does not consume the process setup slot; retain both
existing error mappings and claim behavior for valid configurations.

---

Nitpick comments:
In `@crates/tinymemory-module/src/provider.rs`:
- Around line 448-506: Update the provider methods kv_get, kv_list, and
relations to use bounded store-side queries: pass the key to the typed KV
lookup, pass prefix and limit to KV listing, and pass limit to graph_relations
so each namespace query is bounded before any merge. For kv_get, use the typed
lookup needed to retain MemoryKvRecord.updated_at rather than falling back to
MemoryClient::kv_get, which returns only serde_json::Value; preserve the
existing conversion and error handling.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d56892be-46e9-40d7-8a9c-f3a1252cfbd1

📥 Commits

Reviewing files that changed from the base of the PR and between ee606a1 and cc0525a.

⛔ Files ignored due to path filters (1)
  • crates/tinymemory-module/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • api/src/host/events.rs
  • core/src/store/client.rs
  • core/src/store/entities.rs
  • core/src/store/factories.rs
  • crates/tinymemory-module/Cargo.toml
  • crates/tinymemory-module/src/chat.rs
  • crates/tinymemory-module/src/config.rs
  • crates/tinymemory-module/src/host.rs
  • crates/tinymemory-module/src/lib.rs
  • crates/tinymemory-module/src/provider.rs
  • crates/tinymemory-module/src/service/mod.rs
  • crates/tinymemory-module/tests/module_e2e.rs

Comment thread crates/tinymemory-module/src/provider.rs Outdated
Comment thread crates/tinymemory-module/src/provider.rs
Comment thread crates/tinymemory-module/src/service/mod.rs
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel

Copy link
Copy Markdown
Member Author

Also addressed the review-body setup finding: configuration is validated before the permanent process setup slot is claimed.

Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel merged commit d92d451 into main Aug 12, 2026
11 checks passed
@senamakel
senamakel deleted the drop-tiny-crates branch August 12, 2026 15:05
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