Skip to content

test(repo): load more resources to delete - #9367

Merged
dstaley merged 2 commits into
mainfrom
ds.fix/cleanup-more
Aug 11, 2026
Merged

test(repo): load more resources to delete#9367
dstaley merged 2 commits into
mainfrom
ds.fix/cleanup-more

Conversation

@dstaley

@dstaley dstaley commented Aug 7, 2026

Copy link
Copy Markdown
Member

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 test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview Aug 11, 2026 3:26pm
swingset Ready Ready Preview Aug 11, 2026 3:26pm

Request Review

@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9afaa7f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When 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

@pkg-pr-new

pkg-pr-new Bot commented Aug 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@9367

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@9367

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@9367

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@9367

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@9367

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@9367

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@9367

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@9367

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@9367

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@9367

@clerk/express

npm i https://pkg.pr.new/@clerk/express@9367

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@9367

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@9367

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@9367

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@9367

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@9367

@clerk/react

npm i https://pkg.pr.new/@clerk/react@9367

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@9367

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@9367

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@9367

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@9367

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@9367

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@9367

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@9367

commit: 9afaa7f

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 80195e05-a3ac-480e-8b96-4619cf609fcf

📥 Commits

Reviewing files that changed from the base of the PR and between 9837f5c and 9afaa7f.

📒 Files selected for processing (3)
  • .changeset/clever-lions-work.md
  • .github/workflows/e2e-cleanups.yml
  • integration/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/cli (auto-detected)
  • clerk/clerk-ios (auto-detected)
  • clerk/clerk-android (auto-detected)
🚧 Files skipped from review as they are similar to previous changes (3)
  • .changeset/clever-lions-work.md
  • .github/workflows/e2e-cleanups.yml
  • integration/cleanup/cleanup.setup.ts

📝 Walkthrough

Walkthrough

The 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

  • clerk/javascript#9375: Updates pagination limits in cleanup.setup.ts, directly affecting the cleanup queries changed here.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes loading more resources for cleanup and matches the main pagination change.
Description check ✅ Passed The description accurately explains the increased pagination limits and more frequent cleanup schedule.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6100719 and b0b67e4.

📒 Files selected for processing (3)
  • .changeset/clever-lions-work.md
  • .github/workflows/e2e-cleanups.yml
  • integration/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)

Comment on lines +5 to +6
# run every 2 hours on every weekday
- cron: '0 */2 * * 1-5'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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.yml

Repository: 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 || true

Repository: 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.

Comment on lines +54 to +60
limit: 500,
});

const { data: usersWithPhoneNumber } = await clerkClient.users.getUserList({
orderBy: '-created_at',
query: '55501',
limit: 150,
limit: 500,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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.ts

Repository: 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)))
PY

Repository: 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.

@dstaley dstaley changed the title tests(repo): load more resources to delete test(repo): load more resources to delete Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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.

@dstaley
dstaley merged commit 02b556b into main Aug 11, 2026
50 checks passed
@dstaley
dstaley deleted the ds.fix/cleanup-more branch August 11, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants