Skip to content

build: stop docs and test edits from re-running the task graph, and let turbo select what ci-turbo runs - #2420

Merged
fforootd merged 6 commits into
mainfrom
claude/turbo-repo-graph-design-fdcae5
Oct 28, 2026
Merged

fforootd merged 6 commits into
mainfrom
claude/turbo-repo-graph-design-fdcae5

Conversation

@fforootd

@fforootd fforootd commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

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-pr stays 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:

  • Folder-wide inputs. Every task hashed its whole package, and a dependency's hash is part of each dependent's. One line in 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.
  • The merge queue diffed against 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:

  • gives turbo's shared task shapes inputs by file class (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#test keeps its README and skill).
  • turns on futureFlags.affectedUsingTaskInputs, so --affected and turbo query affected follow task inputs and task edges (a console change still reaches the server's tests).
  • lets turbo select what ci-turbo.yml runs, with turbo's own features and no script of ours:
    • every turbo run takes --affected from TURBO_SCM_BASE: the merge group's base_sha, the pull request's base, or the commit a push to main replaced. The nightly schedule, and workflow_dispatch with force, run every task and lane with TURBO_FORCE instead (the gate forced; the lanes, never cached, restore their prerequisites from what the gate just built).
    • the e2e lanes run in one turbo run … --affected, side by side as moon's e2e:all runs them; the two demo-next lanes, which share :3002, take turns through their demo-next-app mutex. 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 when turbo query affected --tasks … --exit-code finds a lane affected; exit 2 counts as affected. The snapshot itself takes no --affected: the journey needs it whenever it runs.
    • the journey's one-framework matrix stays, as a turbo query affected check: full when the by-hand journey lane (the journey's files, the CLI, the test kit, the mock OIDC provider) or an SDK's build is affected, one framework otherwise, ci-mode's rule.
    • turbo's journey-local (now CI's journey lane) also depends on server#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 through e2e:all.
    • a version PR is its changeset-release/* branch; pushes to main run the gate alone.
    • Go's build cache is restored from the newest entry, and the nightly run on main saves one under a key of its own. Keyed on go.sum alone, an entry was saved by the first run of each go.sum and never again, so the release snapshot cross-compiled the server from scratch on every run.
    • pull requests and the merge queue run it again: decision 9 of the migration plan, resumed. It stays non-required; ci / full-pr is the gate.
  • compares merge groups with merge_group.base_sha in ci.yml (ci-mode, and moon ci through MOON_BASE).
  • fixes reads the inputs missed, in both runners where they applied: 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 //#lint and the Go globs hashed. The Go globs also leave out .vercel/, where Vercel's builds keep the Go toolchain and module cache.
  • stops three tasks from hashing what other tasks write, which made a second run of an unchanged tree miss the cache: the server's build (the console dist, which its console#build edge already hashes), //#lint (next-env.d.ts, .vitest/), sdk-core#test (the demo apps' .next/.nuxt output).
  • adds @zitadel/release#lint, which moon already runs as release: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, the gate output). ci.yml calls ci-mode as before.

change, gate run locally on a warm cache moon turbo before turbo after
docs/runbooks/cloud.md 0.3 s (0) 7.5 s (4) 1.1 s (1)
packages/components/README.md 89 s (57) 108 s (58) 0.2 s (0)
a components spec file 95 s (57) 92 s (59) 22 s (5)
an sdk-react spec file 51 s (23) 47 s (28) 3.0 s (5)
a components source file 87 s (57) 72 s (59) 68 s (58)

Replayed 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 in docs/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).
  • Workflows: actionlint is not installed here and was not run. Both workflows parse with yaml in strict mode, and every step id and env reference resolves.
  • TURBO_SCM_BASE=origin/main turbo run lint typecheck build test --affected --dry selects 131 tasks for any scratch commit on this branch, because the branch itself changes the root turbo.json, a global input. Against the branch tip: package docs 0 tasks, a docs/ runbook 5 (config#test and its prerequisites), a components spec file 13, a components source file 70, a Go source file 21.
  • The whole gate locally, cold: 133 tasks passed in 97 s; run again on the unchanged tree, only the four never-cached install-browsers tasks ran.
  • turbo query affected per 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.
  • Not run: the workflow itself. This PR's own ci-turbo run is the first of the pull-request path; the nightly path runs only on main, or by hand on this branch with gh 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 edits turbo.json and moon.yml files of published packages (@zitadel/server with 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

  • A change no task reads runs nothing in ci-turbo: a workflow edit, say. ci-mode forces a full ci.yml run 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.
  • ci-turbo runs each lane only when the change reaches it; ci.yml runs every e2e lane once one is affected, so the two differ on purpose in which lanes run.
  • On this PR's first complete runs ci-turbo took 7.1 min against ci.yml's 4.4, with a 3 s gate: its e2e lanes ran one step after another (4.5 min against ci.yml's 2.6), and the snapshot's cross-compiles missed the Go cache (58 s against 5 s). Both are changed since; the run of cbef07671 is the first with them.
  • A version PR's merge-queue entry carries the queue's branch name, so ci-turbo runs it like any other entry (ci.yml's version-only mode recognises it by its files).
  • turbo run --affected fails, 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.
  • //#test no longer lists scripts/task-runner.mjs: ci-mode stopped importing it.
  • When build(deploy): build every cloud service through one turbo graph #2425 lands, server#test-postgres and server#test-sqlite must name apps/cloud/build-launcher.sh instead of build.sh: the launcher test reads it there, and build(deploy): build every cloud service through one turbo graph #2425 renames the input of server#test only. Whichever of the two PRs lands second makes the change.
  • main is merged in to resolve the conflict with build: run turbo boundaries in CI and move the shared Vitest config into a package #2423 in docs/design/build/turborepo.md (both added rows to its command table); the checks above ran on the merge.
  • Follow-up: move apps/cli/tests/unit/scripts/ into the root //#test, so cli#test stops listing the root scripts.

🤖 Generated with Claude Code

…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>
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Ready Ready Preview Oct 28, 2026 3:25am UTC

Request Review

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: cbef076

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

fforootd added a commit that referenced this pull request Oct 28, 2026
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>
@fforootd fforootd changed the title build: stop docs and test edits from re-running the task graph, and check its inputs build: stop docs and test edits from re-running the task graph, and let turbo select what ci-turbo runs Oct 28, 2026
…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>
@fforootd
fforootd marked this pull request as ready for review October 28, 2026 03:09
Copilot AI balanced review requested due to automatic review settings October 28, 2026 03:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-28T03:13:47.233778Z 08f59aa Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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.yml to run on PRs/merge-queue/push/nightly, selecting every gate step and lane with --affected (from TURBO_SCM_BASE), gating lane setup via turbo query affected, and forcing full runs nightly via TURBO_FORCE; delete the turbo branch of ci-mode.mjs and its tests.
  • Compare merge groups by merge_group.base_sha in the required ci.yml gate, 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 mridang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@fforootd

Copy link
Copy Markdown
Member Author

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

@fforootd
fforootd added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 3c72dd7 Oct 28, 2026
19 of 20 checks passed
@fforootd
fforootd deleted the claude/turbo-repo-graph-design-fdcae5 branch October 28, 2026 05:21
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Oct 28, 2026

This branch was successfully deployed

1 active deployment
Preview — cbef0767 Deployed Oct 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants