build: upgrade turbo to 2.7.6 and optimize CI with affected task filtering#447
build: upgrade turbo to 2.7.6 and optimize CI with affected task filtering#447
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
📝 WalkthroughWalkthroughThe changes modernize CI/CD and build infrastructure by consolidating separate npm scripts into unified Turbo commands, upgrading GitHub Actions checkout from v3 to v4, bumping Turbo dependency from 2.4.4 to 2.7.6, and introducing new task dependencies and schema updates in turbo.json configuration. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c842bf326e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - run: pnpm turbo run build typecheck lint --affected | ||
| - run: pnpm format | ||
| - run: pnpm test | ||
| - run: pnpm turbo run test --affected |
There was a problem hiding this comment.
Avoid --affected on main pushes to keep CI coverage
The new --affected runs here mean CI will skip build/typecheck/lint/test on pushes to main, because Turbo’s help text says --affected “Filter[s] to only packages that are affected by changes between the current branch and main”; on a push to main, the current branch is main, so the diff is empty and no packages are considered affected, leaving these checks as no-ops on main. This risks regressions landing on main without any of these tasks running; consider gating --affected to PRs only or passing an explicit base/head range for main builds.
Useful? React with 👍 / 👎.
Greptile OverviewGreptile SummaryThis PR upgrades Turbo from 2.4.4 to 2.7.6 and optimizes the CI workflow to only run tasks on affected packages using the Key changes:
Critical issue: Confidence Score: 2/5
Important Files Changed
|
| "transit": { | ||
| "dependsOn": ["^transit"] |
There was a problem hiding this comment.
transit task is not defined in any package.json scripts. Tasks that depend on this (typecheck, lint, lint!) will fail when executed.
Check that all packages have a transit script defined, or remove this task and its dependencies from turbo.json.
Prompt To Fix With AI
This is a comment left during a code review.
Path: turbo.json
Line: 9:10
Comment:
`transit` task is not defined in any package.json scripts. Tasks that depend on this (`typecheck`, `lint`, `lint!`) will fail when executed.
Check that all packages have a `transit` script defined, or remove this task and its dependencies from turbo.json.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In @.github/workflows/release.yml:
- Line 15: The checkout step currently uses "uses: actions/checkout@v4" with the
default shallow fetch; update the checkout action to pass the fetch-depth option
so changesets can inspect full history and tags (i.e., add fetch-depth: 0 as an
input for the actions/checkout@v4 step). Locate the step using "uses:
actions/checkout@v4" and add the fetch-depth: 0 input beneath it so the workflow
performs a full clone for changesets compatibility.
In `@package.json`:
- Line 15: The dev script currently runs "turbo run dev" which only executes in
workspaces that define a "dev" script; confirm whether demos and docs should
participate and if so, add a "dev" script to each missing package (notably
docs/package.json and the 15 demo packages) that starts the local dev server
(e.g., "dev": "next dev" or the appropriate framework command), or explicitly
exclude them by documenting this in the root package.json or replacing "turbo
run dev" with a workspace filter (e.g., "turbo run dev --filter=...") to target
only intended packages; locate the root "dev" script and the individual
package.json files for demos and docs to apply the change.
In `@turbo.json`:
- Around line 9-24: The turbo.json references a missing "transit" task which
breaks dependent tasks; either define a "transit" script in the relevant
package.json files or remove "transit" from the dependency lists of "typecheck",
"lint", and "lint!" (or remove the "transit" entry entirely from turbo.json).
Locate the symbols "transit", "typecheck", "lint", and "lint!" in turbo.json and
then either add a corresponding "transit" script to the packages that require it
or update the dependency arrays to no longer include "transit" so Turbo can run
without errors.
- Line 2: Update the "$schema" value in turbo.json to point to the correct Turbo
schema URL: replace "https://turborepo.dev/schema.v2.json" with either the
canonical domain "https://turborepo.com/schema.v2.json" for general v2
validation, or pin to your exact Turbo release (e.g.,
"https://v2-7-6.turborepo.dev/schema.json") so editor/schema validation exactly
matches your installed Turbo version.
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)
51-53:--affectedneeds a reliable git base in CI.Turbo’s affected calculation can be incorrect with shallow history. Consider fetching full history or explicitly setting the base/head refs.
♻️ Suggested checkout adjustment for accurate affected runs
- - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + fetch-depth: 0
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n .github/workflows/release.ymlRepository: ts-safeql/safeql
Length of output: 973
🌐 Web query:
actions/checkout@v4 migration breaking changes new defaults requirements github actions
💡 Result:
actions/checkout@v4 migration: breaking changes, new defaults, requirements
Breaking / potentially breaking changes (vs @v3)
- Runtime bumped to Node.js 20 (
actions/checkout@v4runs asusing: node20). This can break older self-hosted runners and/or runner OS images that don’t support Node 20. [1] - Self-hosted runner requirement: update GitHub Actions Runner to v2.308.0+ to run Node 20–based JavaScript actions reliably. [2]
- If you don’t, you can see errors like “'using: node20' is not supported…”. [5]
- Runner OS support impact (self-hosted): GitHub announced removal of runner support for several older OSes that don’t have official Node 20 support (e.g., CentOS/RHEL 7, Debian 9, Ubuntu 16.04, Windows 7/8.1, etc.). If you’re on these,
checkout@v4may not be viable without upgrading OS/runner. [3]
Notable behavior / defaults to be aware of
These aren’t new to v4, but commonly surprise people during upgrades:
- Shallow fetch by default:
fetch-depth: 1(only the triggering commit). Usefetch-depth: 0for full history/tags. [4] - Credentials persisted by default: auth token is written to git config so subsequent authenticated
gitcommands work; setpersist-credentials: falseto opt out. [4]
Minimal migration change
- uses: actions/checkout@v4Quick upgrade checklist
- GitHub-hosted runners: usually fine (runner is managed by GitHub). [3]
- Self-hosted runners:
- Upgrade runner to ≥ v2.308.0. [2]
- Ensure the host OS supports Node 20 (avoid the deprecated/removed OS list). [3]
- Re-run workflows and watch for Node20/runtime errors. [5]
🌐 Web query:
changesets action shallow fetch-depth git history requirements commit analysis
💡 Result:
actions/checkoutis shallow by default: it fetches only 1 commit (fetch-depth: 1). If your workflow needs more Git history (older commits, tags, branch merge-base, etc.), you must increase depth or fetch everything withfetch-depth: 0. [1][2]changesets/actionitself doesn’t state a hard requirement for full Git history; it’s primarily creating/updating a release PR and committing version/changelog updates (via Git CLI or GitHub API modes). [3]- When full history is effectively required: any “commit analysis” or logic that depends on history beyond
HEAD—e.g., comparing against the base branch, finding merge-base, reading tags to determine the last release, generating release notes from commit ranges—will fail or behave incorrectly with a shallow clone. In those cases, use:This is also a common pattern in Changesets-related workflows. [1][4]- uses: actions/checkout@v4 with: fetch-depth: 0
Rule of thumb: if you’re only running changeset version and committing results, shallow may work; if you’re doing any history/tag-based analysis, set fetch-depth: 0. [1][3]
References: [1] actions/checkout README, [2] GitHub Marketplace: Checkout, [3] changesets/action README, [4] GitHub Marketplace: “Changeset Action” example showing fetch-depth: 0.
Add fetch-depth: 0 to checkout@v4 for changesets compatibility.
The default shallow fetch (fetch-depth: 1) prevents changesets from analyzing commit history, tags, and merge-base—all needed to determine version bumps and detect package changes. Update line 15:
Diff
- uses: actions/checkout@v4
+ with:
+ fetch-depth: 0📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - uses: actions/checkout@v4 | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 |
🤖 Prompt for AI Agents
In @.github/workflows/release.yml at line 15, The checkout step currently uses
"uses: actions/checkout@v4" with the default shallow fetch; update the checkout
action to pass the fetch-depth option so changesets can inspect full history and
tags (i.e., add fetch-depth: 0 as an input for the actions/checkout@v4 step).
Locate the step using "uses: actions/checkout@v4" and add the fetch-depth: 0
input beneath it so the workflow performs a full clone for changesets
compatibility.
| "lint": "turbo run lint", | ||
| "lint!": "turbo run lint!", | ||
| "dev": "pnpm run --parallel --filter './packages/**' dev", | ||
| "dev": "turbo run dev", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find all package.json files and check which ones have dev scripts
find . -name "package.json" -type f | head -20 | while read pf; do
echo "=== $pf ==="
grep -A 2 '"scripts"' "$pf" | grep -A 10 '"dev"' | head -3
doneRepository: ts-safeql/safeql
Length of output: 974
🏁 Script executed:
#!/bin/bash
# Simpler approach: list all package.json files and count dev scripts
echo "All package.json files:"
find . -name "package.json" -type f | sort
echo -e "\n\nPackage.json files with 'dev' script:"
rg -l '"dev"\s*:' --glob 'package.json'
echo -e "\n\nTotal dev scripts found:"
rg -c '"dev"\s*:' --glob 'package.json' | wc -lRepository: ts-safeql/safeql
Length of output: 1135
Confirm Turbo dev script coverage across workspaces.
turbo run dev only executes in packages that define a dev script. Currently, only 7 of 23 workspaces have one:
- ✓ Root, packages (ast-types, eslint-plugin, generate, shared, sql-tag, test-utils)
- ✗ All 15 demos and docs/package.json lack
devscripts
If demos are intentionally excluded from turbo run dev, this is fine. However, verify whether the docs package should have a dev script.
🤖 Prompt for AI Agents
In `@package.json` at line 15, The dev script currently runs "turbo run dev" which
only executes in workspaces that define a "dev" script; confirm whether demos
and docs should participate and if so, add a "dev" script to each missing
package (notably docs/package.json and the 15 demo packages) that starts the
local dev server (e.g., "dev": "next dev" or the appropriate framework command),
or explicitly exclude them by documenting this in the root package.json or
replacing "turbo run dev" with a workspace filter (e.g., "turbo run dev
--filter=...") to target only intended packages; locate the root "dev" script
and the individual package.json files for demos and docs to apply the change.
| @@ -1,18 +1,30 @@ | |||
| { | |||
| "$schema": "https://turborepo.org/schema.json", | |||
| "$schema": "https://turborepo.dev/schema.v2.json", | |||
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's find and examine the turbo.json file
fd turbo.json -type fRepository: ts-safeql/safeql
Length of output: 230
🌐 Web query:
Turbo 2.7.6 schema v2 compatibility turborepo
💡 Result:
Turbo 2.7.6 (i.e., Turborepo 2.x) is compatible with the turbo.json schema v2.
What to use in turbo.json:
-
Major-version schema (v2):
{ "$schema": "https://turborepo.com/schema.v2.json" }This is the v2 config schema. [1]
-
Best-practice for Turbo 2.7.6: pin the schema to your exact Turbo version (so editor validation always matches what your installed
turbounderstands):{ "$schema": "https://v2-7-6.turborepo.dev/schema.json" }Version-pinned schemas are available (format shown in docs; available since Turbo 2.5.7). [2]
Note: Turborepo’s docs for 2.7.x also mention updating the $schema recommendation toward versioned schema URLs. [3]
Sources: [1] [2] [3]
🏁 Script executed:
# Fix the fd command - remove type flag with hyphen
fd turbo.jsonRepository: ts-safeql/safeql
Length of output: 70
🏁 Script executed:
cat turbo.jsonRepository: ts-safeql/safeql
Length of output: 677
Update schema URL to use correct domain or pin to Turbo version.
Turbo 2.7.6 supports schema v2, but the current URL uses .dev instead of .com. Use either https://turborepo.com/schema.v2.json for the major-version schema, or better yet, pin to your exact version: https://v2-7-6.turborepo.dev/schema.json for editor validation that exactly matches your installed Turbo version.
🤖 Prompt for AI Agents
In `@turbo.json` at line 2, Update the "$schema" value in turbo.json to point to
the correct Turbo schema URL: replace "https://turborepo.dev/schema.v2.json"
with either the canonical domain "https://turborepo.com/schema.v2.json" for
general v2 validation, or pin to your exact Turbo release (e.g.,
"https://v2-7-6.turborepo.dev/schema.json") so editor/schema validation exactly
matches your installed Turbo version.
| "transit": { | ||
| "dependsOn": ["^transit"] | ||
| }, | ||
| "typecheck": { | ||
| "dependsOn": ["^typecheck"] | ||
| "dependsOn": ["transit"] | ||
| }, | ||
| "test": { | ||
| "dependsOn": ["^build"], | ||
| "inputs": ["src/**/*.ts", "test/**/*.ts"] | ||
| }, | ||
| "lint": {} | ||
| "lint": { | ||
| "dependsOn": ["transit"] | ||
| }, | ||
| "lint!": { | ||
| "dependsOn": ["transit"] | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# List packages defining transit/lint/lint! scripts
rg -n --glob 'package.json' '"transit"\s*:|"lint!"\s*:|"lint"\s*:'Repository: ts-safeql/safeql
Length of output: 2778
🏁 Script executed:
#!/bin/bash
# Search specifically for "transit" script in all package.json files
echo "=== Searching for transit scripts ==="
rg -n '"transit"' --glob 'package.json'
# Also check turbo.json to understand the transit task dependencies
echo -e "\n=== Checking turbo.json transit configuration ==="
cat turbo.jsonRepository: ts-safeql/safeql
Length of output: 766
Remove or define transit script - currently missing but required as a dependency.
The transit task is configured in turbo.json with dependents (typecheck, lint, lint! all depend on it), but no transit script is defined in any package.json file across the workspace. This will cause turbo to fail when attempting to run those tasks. Either add a transit script to the relevant packages, remove the transit task from turbo.json, or remove transit from the dependencies of typecheck, lint, and lint!.
The lint and lint! scripts are properly defined across all packages.
🤖 Prompt for AI Agents
In `@turbo.json` around lines 9 - 24, The turbo.json references a missing
"transit" task which breaks dependent tasks; either define a "transit" script in
the relevant package.json files or remove "transit" from the dependency lists of
"typecheck", "lint", and "lint!" (or remove the "transit" entry entirely from
turbo.json). Locate the symbols "transit", "typecheck", "lint", and "lint!" in
turbo.json and then either add a corresponding "transit" script to the packages
that require it or update the dependency arrays to no longer include "transit"
so Turbo can run without errors.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.