Skip to content

feat(intelligence): add Namespace Overview#2964

Open
aashir-athar wants to merge 1 commit into
tinyhumansai:mainfrom
aashir-athar:feat/namespace-overview
Open

feat(intelligence): add Namespace Overview#2964
aashir-athar wants to merge 1 commit into
tinyhumansai:mainfrom
aashir-athar:feat/namespace-overview

Conversation

@aashir-athar
Copy link
Copy Markdown
Contributor

@aashir-athar aashir-athar commented May 29, 2026

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

  • Pure & deterministic (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; collision-free JSON.stringify triple keys; sorted by factCount desc, namespace asc, with the un-namespaced bucket last (relation-order-invariant).
  • Zero new core surface: reuses only 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.
  • Container/presentational split; the container guards the load with a monotonic request token; summary tiles (namespaces / facts / entities) + a ranked per-namespace bar list (facts bar + entity count), capped at 50 with a truncation note. i18n across all 13 locales.

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 — clean
  • eslint — 0 errors
  • prettier --check — clean
  • i18n coverage gate — EXIT 0, no unused namespaceOverview.* keys

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added "Namespaces" tab to the Intelligence view displaying namespace overview with statistics for facts and entity counts per namespace, including loading and error states
    • Extended multi-language support for the new feature across 12+ languages

Review Change Stack

@aashir-athar aashir-athar requested a review from a team May 29, 2026 17:33
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

Warning

Review limit reached

@aashir-athar, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1454acc9-e456-4990-ab9b-d99c9487531b

📥 Commits

Reviewing files that changed from the base of the PR and between a3ce2a6 and bcd4be6.

📒 Files selected for processing (23)
  • app/src/components/intelligence/NamespaceOverviewPanel.test.tsx
  • app/src/components/intelligence/NamespaceOverviewPanel.tsx
  • app/src/components/intelligence/NamespaceOverviewTab.test.tsx
  • app/src/components/intelligence/NamespaceOverviewTab.tsx
  • 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/lib/memory/namespaceOverview.test.ts
  • app/src/lib/memory/namespaceOverview.ts
  • app/src/pages/Intelligence.tsx
  • app/src/services/api/namespaceOverviewApi.test.ts
  • app/src/services/api/namespaceOverviewApi.ts
📝 Walkthrough

Walkthrough

Adds 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.

Changes

Namespace Overview Feature

Layer / File(s) Summary
Core namespace aggregation logic and types
app/src/lib/memory/namespaceOverview.ts, app/src/lib/memory/namespaceOverview.test.ts
computeNamespaceOverview aggregates graph relations by namespace, filters non-string fields, de-duplicates facts and entities, and returns a sorted NamespaceOverviewReport with per-namespace counts and totals. Comprehensive tests cover aggregation, deduplication, shared entities, deterministic sorting, malformed relation filtering, and order invariance.
API service layer for namespace overview loading
app/src/services/api/namespaceOverviewApi.ts, app/src/services/api/namespaceOverviewApi.test.ts
loadNamespaceOverview fetches all graph relations via memoryGraphQuery, logs the count, and returns the computed overview report. Tests verify full-graph fetching, empty array handling, error propagation, and API shape.
Container component with data loading and state management
app/src/components/intelligence/NamespaceOverviewTab.tsx, app/src/components/intelligence/NamespaceOverviewTab.test.tsx
NamespaceOverviewTab loads the overview on mount, manages report/loading/error state, uses a monotonic request token to ignore stale responses, and delegates rendering to NamespaceOverviewPanel. Tests verify successful render on mount, loader call counts, and error alert display.
Presentational UI component with loading, error, and empty states
app/src/components/intelligence/NamespaceOverviewPanel.tsx, app/src/components/intelligence/NamespaceOverviewPanel.test.tsx
NamespaceOverviewPanel renders the namespace overview UI with early-return paths for loading (skeleton tiles), error (alert + retry button), and empty states, or the main UI showing summary tiles (namespaces/facts/entities counts), a ranked list of namespaces with proportional fact bars, entity counts, and an optional truncation notice. Tests verify all state paths, UI headings, namespace labels, unnamespaced marker, and retry callback.
Integration into Intelligence page tab system
app/src/pages/Intelligence.tsx
Imports NamespaceOverviewTab, extends the IntelligenceTab union to include 'namespaces', adds a tab entry labeled via i18n key memory.tab.namespaces, and conditionally renders NamespaceOverviewTab when the tab is active.
Multilingual i18n support across 11+ languages
app/src/lib/i18n/chunks/en-1.ts, 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/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
Adds namespace overview translations: tab label (memory.tab.namespaces) and overview section (namespaceOverview.*) covering title, intro text, loading/error/empty/retry messaging, metric labels (namespaces, facts, entities), headings, unnamespaced label, and truncation count formatting.

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()
Loading

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

feature, memory, working

Suggested reviewers

  • graycyrus

Poem

🐰 A namespace garden grows, with facts arranged by row,
Each relation sorted, by its story to bestow,
The overview shows the whole—a tapestry so neat,
With bars and counts and names in every language sweet!
Hop skip and jump through graphs, the memory takes flight. 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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 'feat(intelligence): add Namespace Overview' directly and accurately summarizes the main change: adding a namespace overview feature to the intelligence module.
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.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added feature Net-new user-facing capability or product behavior. memory Memory store, memory tree, recall, summarization, and embeddings in src/openhuman/memory/. working A PR that is being worked on by the team. labels May 29, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 29, 2026
@sanil-23 sanil-23 self-assigned this May 29, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Net-new user-facing capability or product behavior. memory Memory store, memory tree, recall, summarization, and embeddings in src/openhuman/memory/. working A PR that is being worked on by the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants