Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR fixes a correctness bug where admin user searches missed older users that fell outside the previous 500–5 000 user bounded scan window, replacing
Confidence Score: 4/5
|
There was a problem hiding this comment.
Pull request overview
This PR updates the admin user search behavior so that when a search query is provided it scans the full users dataset (rather than a bounded “recent users” window), while keeping the empty-query admin listing capped by limit. It also updates tests to prevent regressions where older matching users are missed.
Changes:
- Switch admin search path from bounded
take(...)scanning to full-tablecollect()scanning when a search query is present. - Keep empty-query listing behavior capped by
limit. - Update/add regression coverage to ensure older matching users are included in results.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| convex/users.ts | Changes admin list/search query behavior to collect() all users when searching. |
| convex/users.test.ts | Updates regression tests to assert full-list search behavior and preserve empty-query cap behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
convex/users.ts
Outdated
| } | ||
|
|
||
| const scannedUsers = await orderedUsers.take(computeUserSearchScanLimit(args.limit)); | ||
| const scannedUsers = await orderedUsers.collect(); |
There was a problem hiding this comment.
MAX_USER_SEARCH_SCAN/MIN_USER_SEARCH_SCAN are now unused after removing computeUserSearchScanLimit. With noUnusedLocals: true in tsconfig, this will fail TypeScript compilation; remove these constants or reintroduce usage (e.g., as a cap for the search scan).
| const scannedUsers = await orderedUsers.collect(); | |
| const scanLimit = clampInt(args.limit, MIN_USER_SEARCH_SCAN, MAX_USER_SEARCH_SCAN); | |
| const scannedUsers = await orderedUsers.take(scanLimit); |
| } | ||
|
|
||
| const scannedUsers = await orderedUsers.take(computeUserSearchScanLimit(args.limit)); | ||
| const scannedUsers = await orderedUsers.collect(); | ||
| const result = buildUserSearchResults(scannedUsers, normalizedSearch); |
There was a problem hiding this comment.
Calling orderedUsers.collect() for every non-empty search performs an unbounded full-table scan of the users table. This will scale linearly with user count and may hit Convex execution/response limits as the dataset grows; consider adding a bounded/paginated scan strategy or a dedicated search/index-based approach instead of collecting all users at once.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 146e2bb3b1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
convex/users.ts
Outdated
| } | ||
|
|
||
| const scannedUsers = await orderedUsers.take(computeUserSearchScanLimit(args.limit)); | ||
| const scannedUsers = await orderedUsers.collect(); |
There was a problem hiding this comment.
Restore bounded scan for admin user search
Changing queryUsersForAdminList from a bounded take(...) to collect() makes every non-empty admin search read the entire users table, which can hit Convex query limits (document/bytes read caps, including the 32K-doc ceiling) as the user base grows. In that state, searchInternal/list with a search term will error instead of returning matches, so this is a functional regression plus a significant bandwidth/cost increase.
Useful? React with 👍 / 👎.
Summary
Admin user search was only scanning a recent slice of users when a query was present. That meant an older existing account could be missing from the admin Users page even when the search text matched exactly.
This PR changes searched admin listings to scan the full ordered user set, while keeping the default non-search listing capped by
limit. It also adds a regression test covering an older matching user outside the previous recent scan window.Testing
Not run locally in this environment because
bunis unavailable.