Skip to content

ci(repo): hash environment variables only into the tasks they affect - #10667

Open
austincalvelage wants to merge 2 commits into
mainfrom
austin/turbo-node-version-env
Open

austincalvelage wants to merge 2 commits into
mainfrom
austin/turbo-node-version-env

Conversation

@austincalvelage

@austincalvelage austincalvelage commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Description

Some environment variables in turbo.json are part of every task's cache key, even though each one matters to one or two tasks, or to none. This PR moves each variable to where it belongs, following Turbo's guide to environment variables. A variable that changes a task's output goes in that task's env. A variable a task only needs to read goes in a pass-through list, which doesn't touch the cache key.

NODE_VERSION now only affects tests

CI sets NODE_VERSION in the Unit Tests jobs (24.15.0 or 20.19.0), but not in Build Packages. Because it was in every cache key, each package build had three different keys, one per job:

NODE_VERSION @clerk/clerk-js#build before after
unset (Build Packages) 1e99830997e4d0ca 22193a379805db24
24.15.0 (Unit Tests) bfb74d663908a326 22193a379805db24
20.19.0 (Unit Tests) 6d504020eae9134a 22193a379805db24

So both Unit Tests jobs rebuilt every package the PR changed, right after Build Packages had built it. On recent PRs that cost 40 to 70 seconds per job. Now both jobs take all 26 builds from the cache. Test results still get a separate cache entry for each Node version, so the Node 20 job still runs its own tests.

The other variables

Variable Before After Why
NPM_VERSION, NEXT_PHASE every task removed Nothing reads them. Next.js sets NEXT_PHASE itself during its own build.
RSDOCTOR every task the clerk-js build and build:sandbox tasks and the ui build task Only their rspack configs read it.
TZ every task the test task, and passed through to the rest The time zone can change test results, but not build output.
VERCEL, VERCEL_PROJECT_PRODUCTION_URL, VERCEL_TARGET_ENV every task passed through, not in any cache key SDK code reads them in customer apps at runtime. Our builds don't read them.
NODE_ENV and the CLERK_* families every task unchanged Build configs read NODE_ENV. #10661 moves the CLERK_* families to the integration tasks.

Every task's cache key changes once, so the first run after merge rebuilds everything.

This conflicts with #10659 in the clerk-js and ui turbo.json files. Whichever merges second keeps "env": ["RSDOCTOR"] and drops the inputs lists, so ui's build becomes { "env": ["RSDOCTOR"] }.

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 caching

@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 6, 2026 8:05pm UTC
swingset Ready Ready Preview Nov 6, 2026 8:05pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1b341cb and 2d39abd.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The root Turbo configuration moves several environment variables out of globalEnv, adds TZ and Vercel variables to globalPassThroughEnv, and adds NODE_VERSION and TZ to the test task environment. The build and build:sandbox tasks in packages/clerk-js, and the build task in packages/ui, add RSDOCTOR to their environment inputs. A changeset file adds two empty YAML delimiters.

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

Possibly related PRs

  • clerk/javascript#10648: Both changes alter how Turbo assigns environment variables to global, pass-through, and task-specific settings.
  • clerk/javascript#10659: Both changes affect package build environment inputs, including the RSDOCTOR setting.
  • clerk/javascript#10664: Both changes alter task environment inputs used in Turbo task-input calculations.

Suggested reviewers: brkalow, alexcarpenter, dstaley

Merge Risk: Minimal · previous review cd2fb

The environment changes match the repository’s configured Turbo workflows and are safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "ci(repo): hash environment variables only into the tasks they affect" matches the main change. The PR scopes Turbo environment variables from globalEnv to the tasks that use them. The main …
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.
Description check Passed The description explains the change: scoping Turbo environment variables to the tasks that use them, which matches the raw summary. It covers NODE_VERSION moving to test tasks, removal of NPM_VERSION …
Full details: Title check

Explanation

The title "ci(repo): hash environment variables only into the tasks they affect" matches the main change. The PR scopes Turbo environment variables from globalEnv to the tasks that use them. The main example is moving NODE_VERSION into the test task. The title is concise and specific, and it follows the conventional commit style.

Full details: Description check

Explanation

The description explains the change: scoping Turbo environment variables to the tasks that use them, which matches the raw summary. It covers NODE_VERSION moving to test tasks, removal of NPM_VERSION and NEXT_PHASE, RSDOCTOR scoped to clerk-js and ui build tasks, TZ and Vercel variables moved to pass-through, and a conflict note with #10659. It is specific and clearly related to the changeset.

  • 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 9a2db32 and cd2fb8a.

Files selected for processing: 4

  • .changeset/turbo-node-version-test-env.md
  • packages/clerk-js/turbo.json
  • packages/ui/turbo.json
  • turbo.json
Linked repositories identified

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

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.

@changeset-bot

changeset-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2d39abd

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 Nov 4, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-biometrics

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

@clerk/expo-google-signin

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

@clerk/expo-native-components

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/mosaic

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 2d39abd

@austincalvelage austincalvelage changed the title ci(repo): hash NODE_VERSION only into test tasks ci(repo): hash environment variables only into the tasks they affect Nov 5, 2026
@austincalvelage
austincalvelage marked this pull request as ready for review November 5, 2026 00:25
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-11-06T20:07:37.280Z

Summary

Metric Count
Packages analyzed 20
Packages with changes 0
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 2d39abd.

NODE_VERSION was in globalEnv, so the Unit Tests jobs (which set it per Node version) computed different build hashes from the Build Packages job (which does not set it) and rebuilt every package the PR changed. Scoping it to the test task keeps test results separate per Node version and lets every job share build cache entries.
…ks they affect

Remove NPM_VERSION and NEXT_PHASE, which nothing reads. Hash RSDOCTOR only into the clerk-js and ui builds that read it, and TZ only into tests. Pass TZ and the VERCEL variables through to tasks without hashing them, since they don't change any task's output.
@austincalvelage
austincalvelage force-pushed the austin/turbo-node-version-env branch from 1b341cb to 2d39abd Compare November 6, 2026 20:03
@blacksmith-sh

blacksmith-sh Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Matches Build cache keys ignore NODE_VERSION

Before, each Node version gave every build its own key and a Node 20 build missed the cache. After, all three share one key and the Node 20 build is a cache hit.

Merge-base

Build keys by Node version

This PR 2d39abd8

Build keys by Node version

Also checked · 2 match · 1 differs

Differs Other vars leave build keys
Matches Test keys still split by Node and TZ
Matches RSDOCTOR scoped to rspack builds

Warning

Doesn't do what was asked

Other vars leave build keys

NPM_VERSION, NEXT_PHASE, TZ, VERCEL and VERCEL_PROJECT_PRODUCTION_URL no longer change any build key, and TZ and the VERCEL vars are still passed through. VERCEL_TARGET_ENV still changes all 33 build keys: Turbo hashes it on its own as an inferred variable.

Merge-base

Build keys per variable

This PR 2d39abd8

Build keys per variable

Proof on 2d39abd8 · Did Proof get it right? Yes · No

View full Proof report

This branch was successfully deployed

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

1 participant