Skip to content

ci(e2e): harden staging e2e against deterministic and flaky reds#8756

Merged
jacekradko merged 1 commit into
mainfrom
jacek/staging-e2e-resilience-p0
Jun 5, 2026
Merged

ci(e2e): harden staging e2e against deterministic and flaky reds#8756
jacekradko merged 1 commit into
mainfrom
jacek/staging-e2e-resilience-p0

Conversation

@jacekradko
Copy link
Copy Markdown
Member

@jacekradko jacekradko commented Jun 5, 2026

Fixing the deterministic failures in staging e2e.

Two always-failing tests simply cannot pass on staging today, and no retry helps. whatsapp-phone-code waits on a WhatsApp button the staging instance never renders (the channel isn't enabled there), and custom-pages "survives a parent rerender" validates an unreleased @clerk/react fix (#8604) while the staging leg installs published @latest. Both now skip only where they can't pass (staging, and E2E_SDK_SOURCE=latest respectively); PR CI still runs them against branch builds, so coverage there is unchanged.

The change that most deserves a look is concurrency. It was keyed on ref (effectively always main) with cancel-in-progress, so every new staging deploy cancelled the in-flight run and no commit could report its own result. It now keys on the clerk_go commit SHA, falling back to run_id for manual dispatches. The rest is a timeout bump above the 25-minute test step, plus a JSON Playwright report upload for later failure classification.

Deliberately out of scope and coming next: making validate-staging-instances actually gate, a small @smoke gating leg with the full suite informational, and reducing FAPI load on the shared with-email-codes instance.

Summary by CodeRabbit

  • Chores

    • Improved CI concurrency to avoid canceling distinct staging deploys and added a small changeset entry.
    • Made integration test timeouts configurable with a longer default for CI.
  • Tests

    • Enhanced CI test reporting by producing JSON reports for non-cancelled runs.
    • Made E2E tests more resilient: added environment-aware skips to avoid deterministic failures on staging and silenced related lint warnings.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 5, 2026

🦋 Changeset detected

Latest commit: 7b59e11

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jun 5, 2026 11:41am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 922e17d8-743e-415c-a5ef-e68ae29d3115

📥 Commits

Reviewing files that changed from the base of the PR and between fc18bdf and 7b59e11.

📒 Files selected for processing (5)
  • .changeset/staging-e2e-resilience-p0.md
  • .github/workflows/e2e-staging.yml
  • integration/playwright.config.ts
  • integration/tests/custom-pages.test.ts
  • integration/tests/whatsapp-phone-code.test.ts
✅ Files skipped from review due to trivial changes (1)
  • .changeset/staging-e2e-resilience-p0.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • integration/tests/whatsapp-phone-code.test.ts
  • integration/tests/custom-pages.test.ts
  • integration/playwright.config.ts
  • .github/workflows/e2e-staging.yml

📝 Walkthrough

Walkthrough

Staging E2E reliability: change workflow concurrency key to commit SHA, increase integration test timeout, upload Playwright JSON reports on non-cancelled runs, add CI reporter, and add env-gated skips and lint disables in Playwright tests.

Changes

E2E Staging Test Resilience

Layer / File(s) Summary
Workflow resilience: concurrency, timeout, and artifact reporting
.github/workflows/e2e-staging.yml, .changeset/staging-e2e-resilience-p0.md
concurrency.group now keys on clerk-go-commit-sha (with run_id fallback). Integration-tests timeout-minutes default uses vars.TIMEOUT_MINUTES_LONG or falls back to 30. Adds Upload Playwright JSON report step for playwright-report/results.json on non-cancelled runs. Changeset added.
Test reporting and environment-based skipping
integration/playwright.config.ts, integration/tests/custom-pages.test.ts, integration/tests/whatsapp-phone-code.test.ts
Playwright config emits dual reporters (list + JSON) in CI writing playwright-report/results.json. ESLint turbo/no-undeclared-env-vars disables added to tests. custom-pages test skips when E2E_SDK_SOURCE === 'latest'. WhatsApp phone-code suite is skipped on staging when E2E_STAGING === '1'.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

integration

Suggested reviewers

  • wobsoriano
  • nikosdouvlis
  • brkalow

Poem

🐰 I hopped through CI's gated door,
Where SHAs keep runs from cancel wars.
Time stretched long, reports now sing,
Skips in place where mocks don't bring.
Hooray — the staging meadow springs! 🥕✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: hardening staging e2e tests against both deterministic failures and flaky tests through skips, concurrency fixes, timeout increases, and report generation.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 5, 2026

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 7b59e11

The staging e2e "generic" leg was red on ~100% of runs because a few
independent failures sat behind an all-or-nothing gate:

- whatsapp-phone-code: the WhatsApp channel is not enabled on the staging
  instance, so the button never renders and the suite times out every run.
  It also bypasses the isStagingReady graceful-skip, so skip it explicitly
  on staging until the channel is provisioned.
- custom-pages "survives a parent rerender": validates an unreleased
  @clerk/react fix (#8604), but the staging leg installs published @latest,
  so it is deterministically red until release. Skip when E2E_SDK_SOURCE=latest;
  PR CI (ref builds) still covers it.
- concurrency was keyed on ref (effectively always "main") with
  cancel-in-progress, so each new staging deploy cancelled the in-flight run
  and no commit could report a status. Key on the clerk_go commit instead.
- raise the job timeout above the 25-minute test step so the job cap no
  longer kills runs mid-suite.
- emit and upload a JSON Playwright report in CI so the report job can
  classify failures (flaky vs failed, infra vs regression) later.
Copy link
Copy Markdown
Member

@wobsoriano wobsoriano left a comment

Choose a reason for hiding this comment

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

nice

@jacekradko jacekradko merged commit 5bf43a2 into main Jun 5, 2026
48 checks passed
@jacekradko jacekradko deleted the jacek/staging-e2e-resilience-p0 branch June 5, 2026 16:15
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