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

Scopes the variables in globalEnv to the tasks they affect, following Turbo's rules for environment variables: a variable that changes a task's output goes in that task's env, and a variable a task only needs at runtime goes in a pass-through list, which isn't hashed.

NODE_VERSION moves to the test task

CI sets NODE_VERSION only in the Unit Tests steps (24.15.0 or 20.19.0), and the Build Packages job doesn't set it. Because it was in globalEnv, each package build had three cache 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

As a result, both Unit Tests jobs rebuilt every package a PR changed, even though Build Packages had just built it. On recent PRs that cost 40 to 70 seconds per job. With this change, both Unit Tests jobs download all 26 builds from the cache. Test results keep a separate cache entry per Node version, so the Node 20 job still runs its own tests.

The other entries

Variable Before After Why
NPM_VERSION, NEXT_PHASE globalEnv removed Nothing reads them. Next.js sets NEXT_PHASE inside its own build.
RSDOCTOR globalEnv env of the clerk-js build and build:sandbox tasks and the ui build task Only their rspack configs read it.
TZ globalEnv env of the test task, plus globalPassThroughEnv The time zone can change test results but not build output. Other tasks still receive it.
VERCEL, VERCEL_PROJECT_PRODUCTION_URL, VERCEL_TARGET_ENV globalEnv globalPassThroughEnv SDK code reads them at runtime in customer apps, not during our builds. Turbo hashes VERCEL_TARGET_ENV on its own anyway.
NODE_ENV and the CLERK_* families globalEnv unchanged Build configs read NODE_ENV. The integration test apps read the CLERK_* families, so the integration tasks need them hashed. Moving those into each integration task's env can follow the integration suite changes in #10648, #10653 and #10661.

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

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

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.
@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 5, 2026 12:09am UTC
swingset Ready Ready Preview Nov 5, 2026 12:09am UTC

Request Review

@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 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 · up to cd2fb

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

Pre-merge checks: Passed 5

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 …
Description check Passed The description states that it scopes globalEnv variables to the tasks they affect. It explains the NODE_VERSION move to the test task, the handling of NPM_VERSION, NEXT_PHASE, RSDOCTOR, TZ, and the V…
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: 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 states that it scopes globalEnv variables to the tasks they affect. It explains the NODE_VERSION move to the test task, the handling of NPM_VERSION, NEXT_PHASE, RSDOCTOR, TZ, and the VERCEL variables, and the cache impact. It is detailed and directly related to the changeset.

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 0 files. (4 skipped: 4 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 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: cd2fb8a

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

…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 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-05T00:29:19.057Z

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 cd2fb8a.

This branch was successfully deployed

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