test(repo): load more resources to delete - #9367
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 9afaa7f The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe weekday E2E cleanup workflow now runs every two hours. User and organization cleanup queries now use a limit of 500 instead of 150. A Changeset marks a patch release. Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/e2e-cleanups.yml:
- Around line 5-6: Add a concurrency configuration to the workflow containing
the “0 */2 * * 1-5” schedule, using a stable group identifier shared by
scheduled and manually dispatched runs so only one cleanup run can execute at a
time. Configure the group to cancel or otherwise prevent overlapping runs
according to the intended cleanup behavior.
In `@integration/cleanup/cleanup.setup.ts`:
- Around line 54-60: Update the cleanup queries using
clerkClient.users.getUserList and clerkClient.organizations.getOrganizationList
to paginate with offset, repeatedly fetching batches of up to 500 until no
results remain. Accumulate or process every page so all matching stale users and
organizations are deleted, not just the first page.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 410c4a90-a3d9-47d5-88ef-f39efbcdeea8
📒 Files selected for processing (3)
.changeset/clever-lions-work.md.github/workflows/e2e-cleanups.ymlintegration/cleanup/cleanup.setup.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
clerk/clerk_go(manual)clerk/dashboard(manual)clerk/accounts(manual)clerk/backoffice(manual)clerk/clerk(manual)clerk/clerk-docs(manual)clerk/cloudflare-workers(manual)clerk/clerk-ios(auto-detected)clerk/cli(auto-detected)clerk/clerk-android(auto-detected)
| # run every 2 hours on every weekday | ||
| - cron: '0 */2 * * 1-5' |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 12 \
'concurrency:|cancel-in-progress|timeout-minutes|test:integration:cleanup|playwright test' \
.github/workflows/e2e-cleanups.ymlRepository: clerk/javascript
Length of output: 1505
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- workflow ---'
cat -n .github/workflows/e2e-cleanups.yml
printf '%s\n' '--- workflow-level concurrency and cleanup references ---'
rg -n -C 4 \
'e2e-cleanups|integration-tests|INTEGRATION_INSTANCE_KEYS|test:integration:cleanup|concurrency:|cancel-in-progress|TIMEOUT_MINUTES_NORMAL' \
.github package.json pnpm-workspace.yaml 2>/dev/null || true
printf '%s\n' '--- repository-local cleanup locks ---'
rg -n -i -C 3 \
'cleanup.*lock|lock.*cleanup|mutex|concurrency|cancel-in-progress' \
.github scripts packages tests 2>/dev/null || trueRepository: clerk/javascript
Length of output: 40631
Add a concurrency group for cleanup runs.
The workflow has no concurrency control. GitHub Actions can start another scheduled or manually dispatched run while the first is active.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/e2e-cleanups.yml around lines 5 - 6, Add a concurrency
configuration to the workflow containing the “0 */2 * * 1-5” schedule, using a
stable group identifier shared by scheduled and manually dispatched runs so only
one cleanup run can execute at a time. Configure the group to cancel or
otherwise prevent overlapping runs according to the intended cleanup behavior.
| limit: 500, | ||
| }); | ||
|
|
||
| const { data: usersWithPhoneNumber } = await clerkClient.users.getUserList({ | ||
| orderBy: '-created_at', | ||
| query: '55501', | ||
| limit: 150, | ||
| limit: 500, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 12 \
'getUserList|getOrganizationList|totalCount|offset|limit: 500|delete' \
integration/cleanup/cleanup.setup.tsRepository: clerk/javascript
Length of output: 6439
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- cleanup.setup.ts (relevant sections) ---'
sed -n '1,145p' integration/cleanup/cleanup.setup.ts
printf '%s\n' '--- call sites and pagination symbols ---'
rg -n -C 6 'getUserList|getOrganizationList|offset|usersToDelete|orgsToDelete|limit' integration/cleanup/cleanup.setup.ts
printf '%s\n' '--- standalone structural check ---'
python3 - <<'PY'
from pathlib import Path
import re
path = Path("integration/cleanup/cleanup.setup.ts")
text = path.read_text()
calls = re.findall(
r'(?P<api>getUserList|getOrganizationList)\s*\(\s*\{(?P<body>.*?)\}\s*\)',
text,
flags=re.S,
)
for api, body in calls:
print(f"{api}: limit_500={bool(re.search(r'\\blimit\\s*:\\s*500\\b', body))}, "
f"offset_present={bool(re.search(r'\\boffset\\s*:', body))}")
print("pagination_identifiers_present:",
bool(re.search(r'\\b(offset|totalCount|lastPage|hasNextPage|nextPage)\\b', text)))
PYRepository: clerk/javascript
Length of output: 8637
Add pagination to cleanup queries.
getUserList and getOrganizationList fetch only the first 500 results. If more than 500 stale objects match, later pages remain undeleted. Use offset to process all pages.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@integration/cleanup/cleanup.setup.ts` around lines 54 - 60, Update the
cleanup queries using clerkClient.users.getUserList and
clerkClient.organizations.getOrganizationList to paginate with offset,
repeatedly fetching batches of up to 500 until no results remain. Accumulate or
process every page so all matching stale users and organizations are deleted,
not just the first page.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Description
This PR increases the requested users/orgs from 150 to 500 to account for there being more than 150 objects since the last cleanup operation. It also increases the frequency at which we run cleanup of stale objects.
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change