Skip to content

perf(dashboard): bulk permissions endpoint eliminates N+1 API calls (#359) - #360

Merged
vybe merged 3 commits into
mainfrom
feature/359-bulk-permissions-endpoint
Apr 17, 2026
Merged

vybe merged 3 commits into
mainfrom
feature/359-bulk-permissions-endpoint

Conversation

@vybe

@vybe vybe commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds GET /api/agents/permissions-edges bulk endpoint returning all permission edges in a single query
  • Filters edges by accessible agents at SQL level (security: no info leak of hidden agent names)
  • Frontend fetchPermissionEdges() now makes 1 API call instead of N per-agent calls

Changes

  • src/backend/db/permissions.py — get_all_permission_edges() with SQL-level filtering
  • src/backend/database.py — Expose method on db object
  • src/backend/routers/agents.py — GET /permissions-edges endpoint (before /{name} catch-all)
  • src/frontend/src/stores/network.js — Replace N fetches with 1 bulk call
  • tests/test_agent_permissions.py — 5 tests for bulk endpoint

Expected Impact

  • API calls: 12+ → 1 (92% reduction)
  • Load time: ~15s → ~3-5s estimated
  • Data transfer: Eliminates redundant available_agents payload

Test Plan

  • pytest tests/test_agent_permissions.py::TestBulkPermissionEdges -v
  • Manual: Open Dashboard with 10+ agents, verify load completes in <5s
  • Manual: Verify permission edges display correctly on graph

Closes #359

🤖 Generated with Claude Code

vybe and others added 3 commits April 16, 2026 18:05
…359)

Adds GET /api/agents/permissions-edges that returns all permission edges
in a single query, filtered by accessible agents at SQL level.

Frontend now makes 1 API call instead of N per-agent calls, reducing
dashboard load time from ~15s to ~3-5s with 12+ agents.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Updates fetchPermissionEdges() documentation to reflect new bulk
GET /api/agents/permissions-edges endpoint replacing N per-agent calls.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Updates test-runner.md with TestBulkPermissionEdges (5 tests):
- Structure, empty case, granted permissions, edge fields, auth

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: Bulk permissions endpoint to eliminate N+1 API calls on Dashboard load

1 participant