Batch the admin joined connection read and key the email filter - #1580
Merged
Conversation
listSubjectsWithConnections issued one connection query per subject in the page, so a default page cost 100 sequential round trips in one request. It now batches the whole page into a single query. The ?email= filter was also applied after the read, pulling a full page of subjects and their connections to return one row. It now resolves the address to a principal id and reads that id directly.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | a70b792 | Commit Preview URL Branch Preview URL |
Aug 13 2026, 08:58 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-cloud | a70b792 | Aug 13 2026, 08:58 AM |
Contributor
Cloudflare previewTorn down — the PR is closed. |
@executor-js/codemode-core
@executor-js/runtime-quickjs
@executor-js/plugin-file-secrets
@executor-js/plugin-graphql
@executor-js/plugin-keychain
@executor-js/plugin-mcp
@executor-js/plugin-onepassword
@executor-js/plugin-openapi
@executor-js/cli
@executor-js/config
@executor-js/execution
@executor-js/sdk
executor
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/admin/users/with-connectionsissued about 100connection.findManyqueriesper request. Two separate causes, one per caller.
The paged read fanned out
admin.listSubjectsWithConnectionsread a page of subjects and then queriedconnections once per subject, sequentially. A default page is 100 subjects, so
one request made 100 round trips over a per-request socket. It now reads the
page and batches every subject's connections into a single query, so the cost
is two queries regardless of page size.
The batched
inpredicate carries the sameowner: "user"clause and the sametenant scoping the per-subject read had, so org-owned rows (whose
subjectisthe empty-string sentinel) and other tenants' rows stay out. A subject with no
connections still reports an empty array rather than dropping out of the page,
and ordering is unchanged: the query orders by
(integration, name)across thepage and grouping walks those rows in order.
The email filter ran after the read
?email=resolved the address to a principal id and then read a full page ofsubjects with their connections, only to keep the single row that matched. It
now reads that id directly through the keyed seam the single-user endpoint
already uses. An address the directory cannot resolve now costs no storage read
at all.
The same reordering applies to
/admin/users, so the two endpoints keep oneset of semantics rather than disagreeing on an edge case.
Contract note
?email=combined with?limit=/?offset=changes meaning: it is nowfilter-then-page (the window applies to the selected row, so one row at
offset: 0and empty beyond) rather than page-then-filter. Exact preservationof the old behaviour is not possible without the scan this removes, since it
depended on where the row happened to fall in the tenant ordering. No caller
combines the two parameters in practice. The contract comment is updated to
state the order explicitly.
Tests
New tests cover the reads over a recording
ExecutorAdmin(which storage callthe filter chooses) and the batched query over a real SQLite-backed platform
view (one connection query for a three-subject page, empty arrays preserved,
tenant and org-owned rows still excluded). Each was confirmed to fail against
the previous implementation before being kept.
format,lint,typecheck, the SDK, api, self-host and cloud-admin suitesall pass.