Repository navigation
fix: doc list honors --namespace on CLI, HTTP, and MCP (#1268) - #1269
Merged
Merged
Conversation
The documents List surface silently ignored the namespace on every surface: the CLI variant had no namespace field at all (the global --namespace flag was parsed but never used by the dispatcher), the HTTP DocListParams struct lacked the field despite the main.rs help text advertising it, and the MCP tool had no namespace argument. All three returned byte-identical output regardless of the requested namespace, making per-namespace document inventory impossible. Changes: - core: add Store::list_documents_ns(namespace, limit) with an exact namespace match in SQL; list_documents stays as the legacy global wrapper; doc_list/doc_list_roots now take Option<&str> namespace - cli: doc list gains --namespace, falling back to the global --namespace flag; doc export stays global (None) - server: DocListParams.namespace (serde default) wired to the core call - matches the already-documented help text - mcp: uteke_doc_list accepts namespace - regression test: scoped/global/NULL-namespace visibility Verified: cargo check/test/clippy/fmt green (workspace 691 tests); E2E against a backup-API snapshot - global 20 docs, default 12, hermes 2, distinct outputs per namespace.
| namespace: Option<&str>, | ||
| limit: usize, | ||
| ) -> Result<Vec<DocumentSummary>, Error> { | ||
| let roots = self.store.list_root_documents(limit)?; |
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
doc_list_roots fetched the N most-recent global roots and filtered by namespace afterwards, so a scoped view could return short or empty results when namespace matches fell outside the global top-N. Move the filter into list_root_documents_ns SQL (parent_id IS NULL AND (namespace = ?1 OR ?1 IS NULL)) applied before LIMIT - same semantics as list_documents_ns.
ajianaz
added a commit
that referenced
this pull request
Sep 17, 2026
…1270) (#1271) * fix: unified recall scopes docs to namespace, reports honest scores (#1270) recall_unified_all (the default CLI recall path) leaked documents across namespaces and reported rank-derived scores that outranked every memory: - doc_search was called without a namespace (its ns param was _ns), so documents from any namespace - including NULL-namespace rows - appeared in every scoped recall - doc scores were (k+1)/(k+1+rank): rank-0 reported 1.000 for every query, a pure rank function that beat all memory fusion scores (~0.16-0.19), flooding short-query results with the same doc set - min_score was applied inside recall_hybrid against pre-boost rank-based scores (#1223), where it filters nothing meaningful Changes: - new Uteke::doc_search_in(query, limit, mode, namespace) retains only exact-namespace documents; NULL-namespace docs are global- view-only, matching the #1269 doc-list semantics - unified doc arm keeps hybrid mode (index rebuilds evict chunk: vectors per #1110 - semantic-only would hide docs on affected stores) but reports the raw hybrid RRF sum (~0.016-0.033), same rank-based family as memory fusion base scores, never a fake 1.0 - memory arm called with min_score 0.0; the caller's threshold is applied post-merge on reported scores so --min/--strict work - unified document results now carry their namespace Verified: fmt/clippy clean; workspace 691 tests pass; E2E on a PROD-snapshot store - short queries return only in-namespace memories with honest scores, and 'memory lifecycle' surfaces the ns=default chapter-6 document (0.016) instead of a cross-namespace 1.0 artifact. * fix: over-fetch before namespace filter in doc_search_in (cora alert) doc_search_in fetched the global top-limit results and only then retained the requested namespace, so scoped searches could silently return fewer results than exist when matching docs ranked below the global top-N. Fetch 4x when scoping (mirrors the entity/category post-filter heuristic on the memory path) and truncate to limit after the retain. * docs: correct stale comments on unified doc scoring (cora alert) The score comment still said 'real cosine from the semantic doc arm' from an earlier iteration of this change - it is the raw hybrid RRF sum, and the min_score filter comment claimed both scales were honest similarities. Spell out the actual caveat instead: both scales are rank-based with different magnitudes (memory fusion ~0.2 max vs doc hybrid ~0.033 max), so thresholds above ~0.033 filter all documents; use --type memory + a vector strategy when cosine-style thresholding is needed.
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.
What
doc listnow honors the namespace on all three surfaces:--namespaceflag ondoc list(+ falls back to the existing global--namespaceflag);doc exportstays globalDocListParamsgainsnamespace(serde default, back-compat) — matches whatmain.rshelp text already advertiseduteke_doc_listaccepts anamespaceargumentStore::list_documents_ns(namespace, limit)with exact-match SQL filter;list_documentsremains the legacy global wrapper;Uteke::doc_list/doc_list_rootstakeOption<&str>namespace (roots filtered in Rust — no(namespace, parent_id)index; the global view short-circuits theIS NULL ORpredicate in SQL)Closes #1268
Why
doc listreturned byte-identical output regardless of the namespace value on every surface: the CLI variant had no namespace field at all (the global flag was parsed but never used by the dispatcher), the HTTP struct lacked the field despite being advertised, and the MCP tool had no such argument. Per-namespace document inventory was impossible, and NULL-namespace docs leaked into every view — the same silent-ignore failure class fixed for v2 payloads in #1254.Testing
cargo check+cargo clippy --all-targets+cargo fmt --checkgreen on all 4 touched cratescargo test --workspace: 691 passed, 0 failed (3 consecutive runs, incl. the newtest_list_documents_namespace_scoped)--namespace default= 12,--namespace hermes= 2, md5 of outputs distinct per namespace