Skip to content

feat(rbac/ui): gate Graph tab on any-KB-readable + add follow-up spec#1576

Closed
sriaradhyula wants to merge 1 commit into
prebuild/feat/rbac-data-source-mcp-tool-typesfrom
prebuild/feat/rbac-graph-tab-gate
Closed

feat(rbac/ui): gate Graph tab on any-KB-readable + add follow-up spec#1576
sriaradhyula wants to merge 1 commit into
prebuild/feat/rbac-data-source-mcp-tool-typesfrom
prebuild/feat/rbac-graph-tab-gate

Conversation

@sriaradhyula
Copy link
Copy Markdown
Member

Summary

PR 5 of the 2026-05-27 fine-grained KB ReBAC plan (see docs/docs/specs/2026-05-27-fine-grained-rbac-for-withauth-routes/plan.md).

Closes out the Knowledge sidebar work and documents the remaining RAG-server effort needed for true per-KB ontology filtering.

Graph tab gate

/knowledge-bases/graph now consults useKbTabGates (the PR 2 hook). Non-admins with zero readable KBs see the NoKbAccessEmpty empty state instead of the global graph. Behaviour mirrors Search / Data Sources / MCP Tools.

Info banner

New GraphInfoBanner is rendered whenever the tab is visible, reminding users (and org admins under PR 1's super-grant) that the ontology graph is currently global — it lives in Neo4j keyed only by _datasource_id today. When kb_count >= 0 the banner also surfaces "you have read access to N knowledge bases" so non-admins know exactly what their scope is.

Per-KB filtering follow-up spec

New spec docs/docs/specs/2026-05-27-per-kb-ontology-graph-filtering/spec.md tracks the RAG-server work needed for true per-KB ontology filtering: a kb_ids query filter on /v1/graphrag/* plus an OpenFGA-driven membership probe in the BFF. This intentionally lives outside the PR 5 code change because it's a multi-week server-side effort.

Stacked on

This PR is the tip of the stack:

Base branch is prebuild/feat/rbac-data-source-mcp-tool-types. Merge order: 1 → 2 → 3 → 4 → 5.

Test plan

  • npx jest --testPathPatterns "knowledge-bases/graph" — 4 passed.
  • Manual: as a non-admin with zero KBs, visit /knowledge-bases/graph, confirm NoKbAccessEmpty is rendered.
  • Manual: as a non-admin with at least one KB, confirm the banner shows "you have read access to N knowledge bases".
  • Manual: as an org admin, confirm the banner appears with no (read access to N) suffix and the global graph renders.

Assisted-by: Claude:claude-opus-4-7

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

🧪 CAIPE UI Test Results

All tests passed

🟠 Overall Coverage: 55%

Coverage
lines
statements
functions
branches

📊 Detailed Coverage

Metric Covered Total Percentage
Lines 24574 41406 59.34%
Statements 26159 45462 57.54%
Functions 4408 8320 52.98%
Branches 15774 32544 48.46%

✅ Test Suites

  • ✅ auth-guard.test.tsx - Route protection & authorization
  • ✅ token-expiry-guard.test.tsx - Token expiry handling
  • ✅ a2a-sdk-client.test.ts - A2A streaming SDK
  • ✅ auth-utils.test.ts - Authentication utilities (100% coverage)
  • ✅ auth-config.test.ts - OIDC configuration
📈 Coverage Thresholds
Threshold Target Current Status
Minimum 40% 55% ✅ Pass
Good 60% 55% ⚠️ Below target
Excellent 80% 55% ⚠️ Below target
⚠️ Areas Needing Tests

High Priority:

  • hooks/use-a2a-streaming.ts - Core streaming functionality
  • store/chat-store.ts - Chat state management
  • store/agent-skills-store.ts - Agent skills
  • lib/api-client.ts - API communication
  • lib/storage-mode.ts - MongoDB/localStorage switching

Medium Priority:

  • components/chat/ChatPanel.tsx - Main chat interface
  • components/agent-builder/* - Agent builder UI
  • lib/mongodb.ts - MongoDB integration

💡 Run locally: make caipe-ui-tests
📦 Full report: Check workflow artifacts

@caipe-ci-build
Copy link
Copy Markdown

caipe-ci-build Bot commented May 27, 2026

Prebuild Artifacts for `d46da36` (archived)

Prebuild Artifacts for d46da36

Branch: prebuild/feat/rbac-graph-tab-gate
Commit: d46da36

Docker Images

Artifact Image Tag Status CI
caipe-ui - - Failed CI

These prebuild artifacts will be automatically cleaned up when the PR is closed or merged.

PR 5 of the 2026-05-27 fine-grained KB ReBAC plan. Closes out the
sidebar work and documents the remaining RAG-server effort needed for
true per-KB ontology filtering.

- `/knowledge-bases/graph` now consults `useKbTabGates` (the PR 2
  hook). Non-admins with zero readable KBs see the `NoKbAccessEmpty`
  empty state instead of the global graph.
- New `GraphInfoBanner` is rendered whenever the tab is visible,
  reminding users (and org admins under PR 1's super-grant) that the
  ontology graph is currently global. When `kb_count >= 0` the banner
  also surfaces "you have read access to N knowledge bases" so non-
  admins know exactly what their scope is.
- `__tests__/page.test.tsx` covers: org-admin sees the banner;
  non-admin with reads sees the banner; non-admin with zero reads sees
  the empty state instead of the graph; banner stays hidden until the
  BFF responds (fails closed).
- New spec `docs/docs/specs/2026-05-27-per-kb-ontology-graph-filtering/spec.md`
  tracks the RAG-server work needed for true per-KB filtering (a
  `kb_ids` filter on `/v1/graphrag/*` plus an OpenFGA-driven membership
  probe in the BFF). This intentionally lives outside the PR 5 code
  change because it is a multi-week server-side effort.
- RBAC architecture / file-map updated to describe the gate, banner,
  and the follow-up spec.

Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Sri Aradhyula <sraradhy@cisco.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@sriaradhyula sriaradhyula force-pushed the prebuild/feat/rbac-graph-tab-gate branch from d46da36 to 48c350d Compare May 27, 2026 12:21
@caipe-ci-build
Copy link
Copy Markdown

Prebuild Artifacts for 48c350d

Branch: prebuild/feat/rbac-graph-tab-gate
Commit: 48c350d

Docker Images

Artifact Image Tag Status CI
caipe-ui ghcr.io/cnoe-io/prebuild/caipe-ui feat-rbac-graph-tab-gate-2 Published CI
Docker pull commands
docker pull ghcr.io/cnoe-io/prebuild/caipe-ui:feat-rbac-graph-tab-gate-2

These prebuild artifacts will be automatically cleaned up when the PR is closed or merged.

@sriaradhyula
Copy link
Copy Markdown
Member Author

Superseded by collapsed replacement PR #1584.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant