Repository navigation
build: stop docs and test edits from re-running the task graph, and let turbo select what ci-turbo runs - #2420
Conversation
…heck its inputs Turbo's task inputs follow file classes: no task hashes its package's docs, no build its tests, so a README or spec edit no longer re-runs every dependent. futureFlags.affectedUsingTaskInputs makes --affected and `turbo query affected` follow task inputs and task edges; ci-mode asks the query and reports gate=affected, and ci-turbo.yml scopes its gate with it. Merge groups compare with merge_group.base_sha in both runners, so a queued entry stops re-testing the entries ahead of it. scripts/check-turbo-graph.mjs (in both gates) fails when a task's code reads a file its graph does not hash, when a declared package is not built first, or when a task hashes an ignored tree; scripts/check-turbo-hermetic.mjs (turbo-canary.yml, nightly) runs the builds and the gate without the files no task claims. Building them found reads neither runner declared (cli#test, config#test, api-mock#test, e2e, the Biome plugins) and the server's embedded error page missing from the turbo port; fixed in both runners. Design, evidence and benchmarks: docs/design/build/turborepo-graph.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: cbef076 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen 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 |
Revert wording the package does not need, so the change stays clear of the open PRs that edit the same files: the README's build.sh row (beside the row #2397 changes), two runbook phrasings, the root turbo.json header and the turborepo.md bullet on ignored files in input globs, which the rework of #2420 covers. The cloud task's own comment keeps why it excludes .vercel/ and the other ignored trees. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ci-turbo.yml selects with turbo's own features instead of ci-mode and the two graph checkers: - Every turbo run takes --affected from TURBO_SCM_BASE: the merge group's base, the pull request's, or the commit a push to main replaced. The nightly schedule, and a run by hand with force, runs every task and lane with TURBO_FORCE instead. - Each lane is a step of its own with --affected. The setup only some lanes need (Playwright, the release snapshot, the journey's registry cache) and the journey's framework matrix ask turbo query affected --exit-code. - A version PR is its changeset-release/* branch; pushes to main run the gate alone; pull requests and the merge queue run it again (migration plan, decision 9), still not required. - Turbo's journey-local depends on server#build, so a Go change selects the journey, whose server comes from the snapshot outside the graph. Drops scripts/check-turbo-graph.mjs, scripts/check-turbo-hermetic.mjs, turbo-canary.yml and ci-mode's turbo support; ci-mode serves ci.yml alone, unchanged. Adds the lint of @zitadel/release, which moon already runs. Stops the server's build, //#lint and sdk-core#test from hashing files other tasks write, which made a second run of an unchanged tree miss the cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rthcutt-053986 # Conflicts: # docs/design/build/turborepo.md
On Vercel the Go toolchain and module cache sit in .vercel/cache/golang inside the checkout, where the Go tasks' $TURBO_ROOT$/**/*.go matched them. The root lint already left .vercel/ out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…guration The branch edits turbo.json and moon.yml files of published packages (@zitadel/server, cli, sdk-core, components, config, api, api-mock, sdk-qwik) without changing what any of them ships, the case .changeset/README.md's decision table gives an empty changeset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🔵 Needs a closer look
The change hinges on turbo runtime behavior that can't be executed here and whose required gate and re-enabled ci-turbo workflow were never run, so a human must verify the first live run.
No open issues 🎉
What changed in this PR
This PR tackles wasted CI work in the dual-runner (moon + Turborepo) build system. Previously, docs-only and test-only changes re-ran large parts of the task graph because every task hashed its entire package folder, and the merge queue diffed against origin/main (re-testing every entry queued ahead). It reshapes Turborepo inputs to follow file classes rather than folders, and hands lane/gate selection entirely to turbo's own task-level --affected (enabled by futureFlags.affectedUsingTaskInputs), removing the bespoke affectedTurboTargets graph-walk from ci-mode.mjs. It also fixes the merge-queue base for the required moon gate (MOON_BASE/CI_BASE).
Changes:
- Give turbo's shared task shapes inputs by file class — no task hashes its package docs, and no build/generate hashes its tests — and add the many cross-package/root-script inputs that tasks actually read (mirrored in
moon.yml). - Rewrite
ci-turbo.ymlto run on PRs/merge-queue/push/nightly, selecting every gate step and lane with--affected(fromTURBO_SCM_BASE), gating lane setup viaturbo query affected, and forcing full runs nightly viaTURBO_FORCE; delete the turbo branch ofci-mode.mjsand its tests. - Compare merge groups by
merge_group.base_shain the requiredci.ymlgate, and document the new design (turborepo-graph.md) and policy updates.
I verified the two turbo features this relies on ($TURBO_EXTENDS$, futureFlags.affectedUsingTaskInputs) exist in the Turborepo source, that TURBO_FORCE=false is treated as falsy, that the affectedTurboTargets/queryTurboAffectedTargets removal leaves no dangling references, and that all newly-referenced input paths exist. No objective defects surfaced; the main residual risk is operational (first live ci-turbo run), which the author explicitly did not execute.
| File | Description |
|---|---|
turbo.json |
Root shared shapes gain file-class input exclusions; //#lint///#test///#build-local-image input fixes; affectedUsingTaskInputs flag. |
.github/workflows/ci-turbo.yml |
Reworked to turbo-native --affected/TURBO_FORCE selection; runs on PRs/merge-queue/nightly; inline setup gating replaces ci-mode. |
.github/workflows/ci.yml |
Adds CI_BASE/MOON_BASE so the required moon gate uses the merge-group/PR base. |
scripts/ci-mode.mjs / ci-mode.test.mjs |
Remove the turbo graph-walk (affectedTurboTargets, TURBO_GRAPH_TASKS) and its tests; simplify queryAffectedTargets. |
scripts/task-runner.mjs |
Comment updated to reflect turbo gate now scopes with --affected. |
apps/server/turbo.json / moon.yml |
Go globs exclude ignored trees (node_modules, .claude/, .vercel/); add embedded error-page/tokens inputs; drop self-written internal/staticui/**; add biome plugins. |
apps/cli/turbo.json / moon.yml |
cli#test/typecheck list root & journey scripts, manifests, Dockerfile, IdP schemas; replace shared shape to keep README/skills. |
packages/config/turbo.json / moon.yml |
sync-schemas/test gain file-class exclusions and cross-repo IdP-docs/flow inputs. |
packages/api/, api-mock/, components/, storybook/, sdk-qwik/, sdk-core/ turbo.json |
Switch to $TURBO_EXTENDS$, add task-guard/fixture inputs, exclude built output. |
e2e/turbo.json / moon.yml |
Lane inputs drop docs, add root scripts/skill/OIDC/schema inputs; journey-local gains server#build edge (turbo only). |
apps/docs/turbo.json, apps/console/turbo.json |
$TURBO_DEFAULT$ → $TURBO_EXTENDS$; docs typecheck excludes generated api client. |
tools/release/*, tools/bench/* |
Add release#lint; bench Go/lint input exclusions and biome plugins. |
.moon/tasks/*.yml, .moon/AGENTS.md |
Add biome-plugins/*.grit implicit input; document intentional turbo/moon differences. |
docs/design/build/turborepo*.md, CONTRIBUTING.md, e2e/journey/AGENTS.md |
New graph-design doc and aligned docs for the resumed dual run. |
.changeset/turbo-inputs-by-file-class.md |
Empty changeset (publishable paths touched, nothing ships) — consistent with the decision table. |
Review effort: Balanced
On this pull request ci-turbo took 7.1 minutes against ci.yml's 4.4. Its gate took 3 s; the rest went to two things: - Each e2e lane ran in a step of its own, so the console's real-instance suite and the smaller lanes waited for the journey. They now run in one `turbo run --affected`, side by side as ci.yml's `e2e:all` runs them; the two demo-next lanes, which share :3002, take turns through their demo-next-app mutex. One report step names the failures of the gate or the lanes. - The Go cache, keyed on go.sum, was saved by the first run of each go.sum and never again, so the release snapshot cross-compiled the server for four platforms from scratch: 58 s against 5 s in ci.yml. Every run now restores the newest entry, and the nightly run on main, which compiles every target without turbo's cache, saves one under a key of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mridang
left a comment
There was a problem hiding this comment.
Looks good to me. Approving, with one question that shouldn’t block anything.
A lot of tasks now carry long exclusion lists, this might become a brittle thing to maintain. I read that TURBO_DEFAULT excludes .gitignored files by default so if possible we could thin the list to use TURBO_DEFAULT + any extra exclusions.
True let me investigate in a follow up |
Summary
Why: this is about turbo's build logic, which the hosted cloud's Vercel builds use and which may replace moon one day. Until then turbo runs beside moon, and moon's
ci / full-prstays the required gate. Moon changes here only where it missed the same inputs, and in the merge queue's diff base.Docs-only and test-only changes re-ran large parts of the task graph, for two reasons:
packages/components/README.md, or in a components spec file, selected 105 moon tasks and re-ran 58 under turbo: every SDK, the console, the server's build and tests, the e2e lanes.origin/main, so a queued entry re-tested every entry queued ahead of it. Over the last 61 queue runs that was about 15 minutes of e2e, database and snapshot steps, nearly all on small entries (build(deploy): add changelog entries for what landed on the cloud since 0.1.0 #2410, changelog Markdown: 230 s of its 281 s job).This PR:
turbo.json): no task hashes its package's docs, and no build or generation its tests. A task that reads such a file lists it (cli#testkeeps its README and skill).futureFlags.affectedUsingTaskInputs, so--affectedandturbo query affectedfollow task inputs and task edges (a console change still reaches the server's tests).ci-turbo.ymlruns, with turbo's own features and no script of ours:turbo runtakes--affectedfromTURBO_SCM_BASE: the merge group'sbase_sha, the pull request's base, or the commit a push to main replaced. The nightlyschedule, andworkflow_dispatchwithforce, run every task and lane withTURBO_FORCEinstead (the gate forced; the lanes, never cached, restore their prerequisites from what the gate just built).turbo run … --affected, side by side as moon'se2e:allruns them; the two demo-next lanes, which share :3002, take turns through theirdemo-next-appmutex. The database lanes keep their own steps before them. The setup only some lanes need (Playwright, the release snapshot, the journey's registry cache) runs whenturbo query affected --tasks … --exit-codefinds a lane affected; exit 2 counts as affected. The snapshot itself takes no--affected: the journey needs it whenever it runs.turbo query affectedcheck: full when the by-handjourneylane (the journey's files, the CLI, the test kit, the mock OIDC provider) or an SDK'sbuildis affected, one framework otherwise, ci-mode's rule.journey-local(now CI's journey lane) also depends onserver#build: the journey's server comes from the snapshot, outside the graph, so without the edge a Go change selected every server lane but the journey. Turbo only; moon runs the journey throughe2e:all.changeset-release/*branch; pushes to main run the gate alone.go.sumalone, an entry was saved by the first run of eachgo.sumand never again, so the release snapshot cross-compiled the server from scratch on every run.ci / full-pris the gate.merge_group.base_shainci.yml(ci-mode, andmoon cithroughMOON_BASE).cli#test(19 root scripts, the release manifest's sources,Dockerfile, …),config#test(docs/design/idp/**and the docs Markdown it checks links into,internal/domain/flow_*.go, …),api-mock#test, the e2e package, every lint (biome-plugins/*.grit). Turbo only: the server's embedded error page and design tokens,scripts/task-guard.mjs, and about 150,000 ignored files that//#lintand the Go globs hashed. The Go globs also leave out.vercel/, where Vercel's builds keep the Go toolchain and module cache.console#buildedge already hashes),//#lint(next-env.d.ts,.vitest/),sdk-core#test(the demo apps'.next/.nuxtoutput).@zitadel/release#lint, which moon already runs asrelease:lint.Dropped from the first revision:
scripts/check-turbo-graph.mjs,scripts/check-turbo-hermetic.mjs, their tests, tasks and scripts,turbo-canary.yml, and ci-mode's turbo support (the affected query,affectedTurboTargets, thegateoutput).ci.ymlcalls ci-mode as before.docs/runbooks/cloud.mdpackages/components/README.mdReplayed over the last 150 merged pull requests: the gate's median is 8 tasks under both runners (turbo's mean 28.5 against moon's 32.0), and ci-turbo.yml would have run 1,021 lane steps where ci.yml ran 1,386 (e2e lanes: 796 against 1,089), adding a lane ci.yml did not run in one pull request (#2312, an edit of the server's
turbo.json).Design, evidence and measurements:
docs/design/build/turborepo-graph.md. The rules are indocs/design/build/turborepo.md.Validation
pnpm run test(root suite, 70 tests).node scripts/check-moon-graph.mjs: ok.biome check .: clean (1567 files).turbo boundaries: no issues, with main merged in (before the merge: the same 40 issues as main had until build: run turbo boundaries in CI and move the shared Vitest config into a package #2423, none from this branch).actionlintis not installed here and was not run. Both workflows parse withyamlin strict mode, and every step id andenvreference resolves.TURBO_SCM_BASE=origin/main turbo run lint typecheck build test --affected --dryselects 131 tasks for any scratch commit on this branch, because the branch itself changes the rootturbo.json, a global input. Against the branch tip: package docs 0 tasks, adocs/runbook 5 (config#testand its prerequisites), a components spec file 13, a components source file 70, a Go source file 21.install-browserstasks ran.turbo query affectedper lane for Go, console, SDK, CLI, test kit, journey, api-mock, docs and workflow edits, and the matrix query for each; the replay of 21 change classes and 150 merged pull requests through moon and ci-mode against turbo (numbers in the design doc). The harness is not committed.ci-turborun is the first of the pull-request path; the nightly path runs only on main, or by hand on this branch withgh workflow run ci-turbo.yml --ref claude/turbo-repo-graph-design-fdcae5 -f force=true.Release notes / changeset
Empty changeset (
.changeset/turbo-inputs-by-file-class.md): the branch editsturbo.jsonandmoon.ymlfiles of published packages (@zitadel/serverwith the console it embeds,cli,api,components,config,sdk-core,sdk-qwik), but no package's output or published contents change.node scripts/check-changesets-status.mjs --base origin/main: ok.Notes
ci.ymlrun for the files it knows no moon task claims (29 of the 150 replayed pull requests); turbo has no such list, and the nightly run is the check, a day late. A read the inputs miss shows there too.cbef07671is the first with them.turbo run --affectedfails, rather than counting every file as changed, on a base it cannot resolve; the bases CI passes are always in the full-depth checkout. A run by hand has none: on a branch turbo counts every file as changed and runs everything through the cache, on main it finds nothing.//#testno longer listsscripts/task-runner.mjs: ci-mode stopped importing it.server#test-postgresandserver#test-sqlitemust nameapps/cloud/build-launcher.shinstead ofbuild.sh: the launcher test reads it there, and build(deploy): build every cloud service through one turbo graph #2425 renames the input ofserver#testonly. Whichever of the two PRs lands second makes the change.docs/design/build/turborepo.md(both added rows to its command table); the checks above ran on the merge.apps/cli/tests/unit/scripts/into the root//#test, socli#teststops listing the root scripts.🤖 Generated with Claude Code