feat(intelligence): add Namespace Overview#2964
Conversation
|
Warning Review limit reached
More reviews will be available in 3 minutes and 59 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (23)
📝 WalkthroughWalkthroughAdds a complete namespace overview feature to the Intelligence memory tab. Includes a data aggregation function that de-duplicates graph relations by namespace, an API layer to fetch and compute overviews, a container component managing load state, a presentational UI component with loading/error/empty states and a ranked namespace list, integration into the Intelligence page, and translations for 11+ languages. ChangesNamespace Overview Feature
Sequence Diagram(s)sequenceDiagram
participant User
participant Intelligence as Intelligence Page
participant Tab as NamespaceOverviewTab
participant API as loadNamespaceOverview
participant Panel as NamespaceOverviewPanel
User->>Intelligence: Navigate to Namespaces tab
Intelligence->>Tab: Render NamespaceOverviewTab
Tab->>Tab: Set loading=true
Tab->>API: load()
API->>API: memoryGraphQuery() fetch relations
API->>API: computeNamespaceOverview(relations)
API-->>Tab: NamespaceOverviewReport
Tab->>Tab: Set report, loading=false
Tab->>Panel: Pass report + loading + error + onRetry
Panel->>Panel: Render namespace list with bars
Panel-->>User: Display overview
User->>Panel: Click Retry button
Panel->>Tab: Call onRetry()
Tab->>API: load()
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes The PR introduces a complete feature with multiple layers (aggregation logic, API, container component, presentational component, page integration, and i18n), but each layer is straightforward and builds logically on the previous one. The aggregation logic includes solid test coverage, the components follow standard React patterns with clear state management, and i18n additions are uniform across languages. Reviewers need to understand the data flow and verify prop contracts between layers, but there is no complex business logic or tricky refactoring. Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
A new read-only "Namespaces" tab — the first lens whose primary axis is the namespace dimension. Shows how the user's knowledge is distributed across contexts: the distinct facts and entities recorded in each namespace, so lopsided or empty contexts are visible at a glance. - Pure deterministic engine (lib/memory/namespaceOverview.ts): groups relations by their namespace field (null = un-namespaced), counting distinct triples and distinct entities per namespace plus a global distinct-entity total. No clock, no RNG; sorted by factCount desc, namespace asc, with the un-namespaced bucket last. Collision-free triple keys. - Zero new core surface: reuses ONLY memoryGraphQuery (one all-namespaces call, grouped client-side). Read-only. No namespace selector — this view shows them all — so it needs no per-namespace re-query. - Container guards the load with a request token; summary tiles (namespaces / facts / entities) + a ranked per-namespace bar list, capped with a truncation note. i18n across all 13 locales. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
a3ce2a6 to
bcd4be6
Compare
Summary
Adds a new read-only "Namespaces" tab — the first lens whose primary axis is the namespace dimension. Every memory fact carries a namespace ("work", "personal", or null for un-namespaced); this view shows how the user's knowledge is distributed across those contexts — the distinct facts and entities recorded in each — so lopsided or empty contexts are visible at a glance.
Design
lib/memory/namespaceOverview.ts): groups relations by theirnamespacefield (null = un-namespaced), counting distinct triples and distinct entities per namespace, plus a global distinct-entity total. No clock, no RNG; collision-freeJSON.stringifytriple keys; sorted by factCount desc, namespace asc, with the un-namespaced bucket last (relation-order-invariant).memoryGraphQuery— one all-namespaces call, grouped client-side. Read-only. Notably it needs no namespace selector (this view is the namespace breakdown), so it makes a single query.Edge cases (tested)
Empty graph, multi-namespace aggregation, per-namespace triple de-dup, an entity shared across namespaces (counted per-namespace but once globally), the null/un-namespaced bucket sorting last, malformed rows dropped, and order-invariance.
Test plan
vitest— 17 tests (engine aggregation/dedup/global-dedup/null-bucket/order-invariance; api facade; panel states; container load + error)tsc --noEmit— cleaneslint— 0 errorsprettier --check— cleannamespaceOverview.*keys🤖 Generated with Claude Code
Summary by CodeRabbit