Skip to content

test(e2e): stop machine auth tests from hitting BAPI rate limits - #10642

Merged
alexcarpenter merged 3 commits into
mainfrom
carp/machine-tests-flakes
Nov 4, 2026
Merged

alexcarpenter merged 3 commits into
mainfrom
carp/machine-tests-flakes

Conversation

@alexcarpenter

Copy link
Copy Markdown
Member

Description

The machine integration job keeps failing on 429 Too Many Requests from the Backend API. All 21 failed job logs I pulled (from 30 failed machine jobs in the last 150 CI runs) show it. Most of the 429s come from createFakeMachineNetwork in beforeAll, and the rest from creating and deleting OAuth apps.

Two things cause it:

  • beforeAll runs once per worker. The machine auth describe blocks use mode: 'parallel'. In that mode Playwright runs beforeAll in every worker that picks up a test from the block, so each block boots several apps and creates several sets of machines and tokens against the shared with-api-keys instance. Each CI retry runs it again. A local test with Playwright 1.62.1 and 4 workers ran beforeAll 4 times in parallel mode and once in default mode.
  • No backoff on 429. createTestUtils already wraps its client in withRetry (integration/testUtils/index.ts), but createMachineClient and createOAuthClient created plain clients, so one 429 failed the whole block.

This PR:

  • Switches the machine auth describe blocks in machineAuthHelpers.ts and next-machine.test.ts to mode: 'default'. Each block now sets up once, and blocks still run in parallel across workers.
  • Wraps createMachineClient and createOAuthClient in the existing withRetry.

Not yet verified: the machine suite hasn't been run against the real instances. This PR's CI run will be the first check.

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: test reliability

Run each machine auth describe block in default mode so beforeAll runs
once per block instead of once per worker, and wrap the machine and
OAuth Clerk clients in withRetry so 429s back off instead of failing.
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Nov 4, 2026 3:12pm UTC
swingset Ready Ready Preview Nov 4, 2026 3:12pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a765c9d

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

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The machine and OAuth Clerk test clients now use withRetry. Five machine-related Playwright test groups change from parallel to default mode. The CI integration-test command adds --force for the machine test case; the Electron command remains unchanged. The changeset file adds empty frontmatter and declares no package, release type, or description.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: wobsoriano, austincalvelage

Merge Risk: Low · previous review 61e28

Machine and OAuth setup retries could leave duplicate resources or make cleanup fail after an ambiguous server error. This is a low-risk, non-blocking concern for the test infrastructure.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preventing machine authentication end-to-end tests from triggering BAPI rate limits.
Description check Passed The description directly explains the reported 429 failures and the changes to Playwright execution mode and retry handling.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files. (1 skipped: 1 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Linked repositories: Some configured repositories could not be included in this review. Cross-repository analysis may be incomplete. Please check linked-repository access and settings.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 4b1fec7 and 61e28dd.

Files selected for processing: 1
  • .github/workflows/ci.yml
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Limit details: You’ve used all 4 included reviews currently available.

@pkg-pr-new

pkg-pr-new Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@10642

@clerk/expo-google-signin

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

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@10642

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@10642

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: a765c9d

@blacksmith-sh

blacksmith-sh Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Matches Machine auth blocks set up once, still parallel across blocks

Each M2M block now runs beforeAll once on its own worker instead of 3 times across 3 workers, cutting mock BAPI writes from 64 to 24 with all 12 tests passing and the two blocks still on separate workers.

Merge-base

Setup per worker

This PR a765c9dd

Setup once per block

Also checked · 1 match · 1 not run

Blocked Machine suite against real instances · Blocked
Matches Machine and OAuth clients retry a 429

Important

Blocked on missing secrets

  • Machine suite against real instances: Running the real machine suite against the with-api-keys instance needs INTEGRATION_INSTANCE_KEYS, which the sandbox lacks. The PR's CI run is the check for this.

Proof on a765c9dd · Did Proof get it right? Yes · No

View full Proof report

@wobsoriano wobsoriano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving since all tests are passing 🧪

@alexcarpenter
alexcarpenter merged commit ffb1f2b into main Nov 4, 2026
57 checks passed
@alexcarpenter
alexcarpenter deleted the carp/machine-tests-flakes branch November 4, 2026 16:41

This branch was successfully deployed

2 active deployments
Preview – swingset — a765c9dd Deployed Nov 4, 2026 by vercel[bot]
Preview – clerk-js-sandbox — a765c9dd Deployed Nov 4, 2026 by vercel[bot]
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