Repository navigation
feat(#527,#528): /namespaces?with_counts=true + GET /recent endpoint - #530
Merged
Merged
Conversation
🔍 Cora AI Code Review🟡 Warning (1)
Review powered by cora-cli · BYOK · MIT |
#527 — GET /namespaces?with_counts=true Returns [{name, count}] per namespace instead of plain string array. Eliminates N× full-list fetches by clients just to get counts. Core: list_namespaces_with_counts() in tags.rs + operations.rs #528 — GET /recent?limit=20&namespace=X&offset=0 Returns most recent memories across all (or specified) namespaces. Thin GET wrapper over list() — leverages #526 cross-namespace fix. Params: limit (default 20), offset (default 0), namespace (optional)
ajianaz
force-pushed
the
feat/issue-527-namespaces-with-counts
branch
from
July 1, 2026 23:46
f9a8fe8 to
f00d485
Compare
| if with_counts { | ||
| match uteke.list_namespaces_with_counts() { | ||
| Ok(counts) => { | ||
| #[derive(serde::Serialize)] |
|
|
||
| // ── Recent (#528) ────────────────────────────────────────────── | ||
| (Method::Get, p) if p == "/recent" || p.starts_with("/recent?") => { | ||
| let ns = parse_query_namespace(&path); |
Namespace count query returned integer from SQLite but tried to deserialize as usize — rusqlite doesn't implement FromSql for usize. Use u32 which is safe for any realistic count and supported by rusqlite directly.
handlers.rs passed Option<String> ns to list() which expects Option<&str>. Use .as_deref() for the conversion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #527, Fixes #528
#527 — GET /namespaces?with_counts=true
Problem
No lightweight way to get per-namespace memory counts. Clients must fetch full memory arrays (limit:500) per namespace just to count them.
Solution
Enrich existing
/namespacesendpoint with optional query param:```
GET /namespaces → ["default", "cto", "kai"]
GET /namespaces?with_counts=true → [{"name":"default","count":432},{"name":"cto","count":28}]
```
Core: new
list_namespaces_with_counts()intags.rs+operations.rs.#528 — GET /recent
Problem
No endpoint for recent memories across all namespaces. Dashboard clients fan out N requests.
Solution
```
GET /recent?limit=20&offset=0&namespace=cto
```
Thin GET wrapper over
list()— leverages the cross-namespace fix from #526.Files changed
crates/uteke-core/src/memory/tags.rs—list_namespaces_with_counts()crates/uteke-core/src/operations.rs— expose new methodcrates/uteke-server/src/handlers.rs— enriched/namespaces+ new/recentDepends on
/recentto work correctly