Skip to content

ci(repo): scope integration test inputs to packages the e2e apps use - #10623

Closed
austincalvelage wants to merge 17 commits into
mainfrom
austin/caching-ci
Closed

austincalvelage wants to merge 17 commits into
mainfrom
austin/caching-ci

Conversation

@austincalvelage

@austincalvelage austincalvelage commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Description

Every //#test:integration:* task listed packages/*/src/** as an input, so a change to any package invalidated all 26 integration suites. A Mosaic or Swingset change reran Express, Nuxt, Astro, and the rest. Separately, the root package.json depended on @clerk/backend, @clerk/shared and @clerk/testing, and Turborepo includes every file of a root workspace dependency in the global hash. Editing any file in those packages, a test or README included, reran every task in the repo.

Each suite now hashes only what it uses:

  • dependsOn lists <pkg>#build:inputs for each package the suite needs: @clerk/clerk-js, @clerk/ui, the harness packages, and the framework packages its e2e apps install. build:inputs is a transit node. No package defines it, so it runs and restores nothing, but it hashes the same inputs as build and chains through ^build:inputs, so transitive packages are covered. A cache hit downloads no build outputs.
  • inputs covers the harness, the test directories the suite's tagged tests live in, the templates its apps copy, and any package source file a test imports directly.
  • scripts/integration-deps.test.mjs derives both lists from integration/presets and the tagged tests, and fails with the block to paste when turbo.json drifts.
Change touches Suites invalidated before After
packages/mosaic/src 26 mosaic
packages/expo/src 26 expo-web
packages/upgrade/src 26 none
packages/shared/src 26 26
a packages/shared test file every task in the repo none (only shared's own test and lint tasks rerun)
integration/tests/vue/components.test.ts 26 vue
integration/tests/generic/sign-in-flow.test.ts 26 generic, nextjs, nextjs:canary, custom
integration/expo-native 26 none

node scripts/integration-hash-matrix.mjs reproduces this table on a clean tree.

The three harness packages move from the root package.json into a new private @clerk/integration workspace package (integration/package.json). A test keeps workspace packages out of the root manifest.

Every integration test now lives under integration/tests/<suite>/, because Turborepo scopes inputs by path and about 60 tests used to sit at the top level with only a @suite tag. Tests tagged for both @generic and @nextjs live in generic/, and the seven tests no suite selects live in unscheduled/. Only import depth changed inside the moved files. Review commit by commit: ace299fb69 is pure renames.

Per-job setup (package build, pkglab publish, clerk-js and ui install, Chromium, Xvfb) moved from workflow steps into integration/scripts/run-integration.mjs, which runs inside the turbo task. A cache hit skips all of it, including user cleanup, which is gated on the tests-started output the script writes. The script strips CLERK_* from its package build, because CLERK_* is in globalEnv and the test step's secrets would otherwise make every build miss the Build Packages job's cache.

Caching e2e suites is a deliberate exception to Turborepo's assumption that tasks are deterministic. The suites also depend on the live Clerk backend and on template dependencies resolved from npm at test time, which no hash can see. So:

  • The merge queue sets TURBO_FORCE on the integration test step, so every suite runs before anything reaches main. Forcing reaches only the suite, because its dependencies are transit nodes.
  • The nightly integration run passes --force, so external drift surfaces within a day.
  • The integration test step must not gain --only, which drops dependency hashes from the task hash.

The clerk-monorepo skill gains an "Integration CI caching" section covering the cache key, these rules, and how to add a suite.

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: CI

@vercel

vercel Bot commented Nov 3, 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 7:08am UTC
swingset Ready Ready Preview Nov 4, 2026 7:08am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2dbd626

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 3, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@pkg-pr-new

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

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-biometrics

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

@clerk/expo-google-signin

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

@clerk/expo-native-components

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/mosaic

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 2dbd626

Comment thread scripts/integration-deps.mjs Fixed
Give each integration suite task a dependsOn list of the package builds
its e2e apps install, and drop the packages/* input globs. Turbo folds
the dependency build hashes into the suite hash, so a change to a
package no suite installs no longer invalidates every suite, while a
change to a transitive dependency still does. Force full runs in the
merge queue and nightly.
… boot

Derive each suite's dependsOn and inputs from the presets and the tests
tagged for it, and fail the CI script tests when turbo.json drifts. Each
task now lists only the test directories and templates it owns, and the
turbo passthrough variables move to globalPassThroughEnv so the 26 task
blocks differ only where the suites differ.
Read the environment the CI setup needs up front and exit with a named
variable instead of crashing mid-run.
…cript

Explain how a suite's cache key is built, the --only rule, the merge
queue safety net, the in-task setup script, and how to add a suite. The
matrix script shows which suites rerun for a set of representative edits.
Each suite's tests now live under integration/tests/<suite>/, so a
suite's turbo inputs are its own directory rather than every top-level
test file. Tests tagged for both generic and nextjs live in generic/,
and the seven tests no suite tag selects live in unscheduled/. Only the
import depth changed inside the moved files.
The chrome-extension suite imports a clerk-js test fixture that the
clerk-js build excludes, so a fixture change could reuse a cached pass.
The dependency checker now records package source files that tests
import directly and adds them to the suite's inputs, and a check asks
turbo's dry run to confirm it hashes each one.
…ess deps out of the root

Integration suites now depend on <pkg>#build:inputs, a task no package
defines. It hashes the same inputs as build and chains through
^build:inputs, so a suite's hash still covers every package it uses, but a
cache hit restores no build outputs and TURBO_FORCE in the merge queue no
longer rebuilds dependencies.

@clerk/backend, @clerk/shared and @clerk/testing move from the root
package.json to a new private @clerk/integration workspace package. Turbo
folded every file of a root workspace dependency into the global hash, so
editing any file in those packages, tests included, reran every task in the
repo. Suites now list the harness packages explicitly, derived from
integration/package.json, and a test keeps workspace packages out of the
root manifest.
…uild

CLERK_* is in globalEnv, and the integration test step sets
CLERK_PLATFORM_API_KEY and CLERK_E2E_OAUTH_PROVIDER_CLIENT_SECRET. Once
the build moved into that step, every package hash differed from the Build
Packages job, so each integration cache miss rebuilt all 26 packages. The
runner now drops CLERK_* from the build's environment.

Also removes the no-op .npmrc edit from the integration job and corrects
the staging workflow's description of the cache key.

This branch was successfully deployed

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