feat(intelligence): add Namespace Overview#2964
Conversation
|
Caution Review failedFailed to post review comments 📝 WalkthroughWalkthroughThis PR implements a Namespace Overview feature: deterministic aggregation of graph relations by namespace, an API wrapper, container loader component, presentational panel with loading/error/empty states and truncation, Intelligence page tab integration, tests, and translations across 14 locales. ChangesNamespace Overview Feature
Sequence DiagramsequenceDiagram
participant UI as NamespaceOverviewTab
participant API as loadNamespaceOverview
participant Panel as NamespaceOverviewPanel
UI->>API: loadNamespaceOverview()
API-->>UI: NamespaceOverviewReport / Error
UI->>Panel: pass report, loading, error, onRetry
Panel->>UI: onRetry() (user)
UI->>API: loadNamespaceOverview() (retry)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
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. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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
# Conflicts: # app/src/lib/i18n/chunks/ar-1.ts # app/src/lib/i18n/chunks/bn-1.ts # app/src/lib/i18n/chunks/de-1.ts # app/src/lib/i18n/chunks/en-1.ts # app/src/lib/i18n/chunks/es-1.ts # app/src/lib/i18n/chunks/fr-1.ts # app/src/lib/i18n/chunks/hi-1.ts # app/src/lib/i18n/chunks/id-1.ts # app/src/lib/i18n/chunks/it-1.ts # app/src/lib/i18n/chunks/ko-1.ts # app/src/lib/i18n/chunks/pt-1.ts # app/src/lib/i18n/chunks/ru-1.ts # app/src/lib/i18n/chunks/zh-CN-1.ts # app/src/lib/i18n/en.ts # app/src/pages/Intelligence.tsx
# Conflicts: # app/src/pages/Intelligence.tsx
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