perf: cut D1 rows-read on admin and metadata paths#352
Conversation
Batch admin workspace org summaries, use COUNT aggregates, INTERSECT metadata multi-filters, batch reaper hydration, and add indexes for cross-workspace metadata lookup and minting-user revoke.
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (2)
🚫 Excluded labels (none allowed) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
uploads-api | ed4b731 | Commit Preview URL Branch Preview URL |
Jul 21 2026, 05:25 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
uploads-auth | ed4b731 | Commit Preview URL Branch Preview URL |
Jul 21 2026, 05:25 PM |
Extend /internal/memberships with org name and optional slug filter so member-gated routes avoid loading every membership. Add GET /me/workspaces/:name/summary and /people for the rail and people tab, and wire the web clients to those combined payloads.
Follow-up: dashboard endpoint batchingAlso landed on this PR:
Existing list/members/usage endpoints remain for other callers. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
uploads-web | ed4b731 | Commit Preview URL Branch Preview URL |
Jul 21 2026, 05:25 PM |
Tighten helpers and comments after the perf work: shared canManage/role projection, invitesForOrg on admin, single-pass reaper processing, and mapMyWorkspace for list/summary clients.
findObjectsByMetadata multi-filter queries now use INTERSECT; update the MCP suite's in-memory D1 stand-in so find_files AND-filter tests still match.
In plain terms
D1 bills primarily on rows read. Admin and account dashboards were doing more work than needed: N org-summary round-trips, counting by loading every member id, over-reading metadata multi-filters, and (on the account shell) reloading the full workspace list just to show one workspace's role and usage.
This keeps the same UI behavior while reading fewer rows and making fewer AUTH/API round-trips.
What it does
Query / index optimizations
GET /internal/orgs/summaries(three aggregate D1 queries) instead of N×3 per workspaceCOUNT(*)instead of selecting every member/invite idINTERSECTgetMetadataForKeysper workspacefile_metadata (meta_key, meta_value), partialauth_tokens (minting_user_id)invitation (organization_id, status)New / extended endpoints (dashboard batching)
GET /internal/memberships?userId=&slug=— optional single-org membership +organizationNameon rowsmemberWorkspaceOr404uses a slug-scoped lookup (one join), not the full list + N org fetchesGET /me/workspaces/:name/summary— membership + public URL + usage (workspace rail)GET /me/workspaces/:name/people— members + invites + role (people tab)Existing list/members/usage endpoints remain for other callers.
What it is not
How to try it
After deploy + D1 migrations for api + auth:
/adminworkspaces list still shows member/invite counts/summary)/people)Test plan