Skip to content

build: stop CI compiling the server while the console build is restored - #3576

Merged
fforootd merged 1 commit into
mainfrom
claude/zealous-faraday-o0n94m
Dec 2, 2026
Merged

fforootd merged 1 commit into
mainfrom
claude/zealous-faraday-o0n94m

Conversation

@fforootd

@fforootd fforootd commented Dec 2, 2026

Copy link
Copy Markdown
Member

Context

full-pr failed in nextgen#build three times on 2026-12-02, each time on an unrelated change and each time green when run again:

# github.com/zitadel/nextgen/internal/staticui/console
internal/staticui/console/embed.go:14:5: embed dist/assets/.turbo-restore-4000-2828: open internal/staticui/console/dist/assets/.turbo-restore-4000-2828: no such file or directory
command (apps/api) go build ./... exited (1)

Summary

The race

  • nextgen#build is a task nobody wrote. It is turbo's built-in go build ./... for the Go module in apps/api. apps/api/turbo.json drops it ("build": { "extends": false }), because the module's tasks are @zitadel/server's.
  • Dropping it only removes it from what a run names: turbo run build has no nextgen#build. A dependsOn that reaches it runs turbo's own command again, with no dependencies.
  • The root docs:api shape (dependsOn: ["^build", "build"]) applied to every package, the Go modules too. nextgen#docs:api, bench#docs:api and go-workspace#docs:api have no script and run nothing, but their edges brought nextgen#build into CI's graph. Under --affected, any change in apps/api selects it.
  • With no dependencies it starts when the run starts, which is when turbo restores @zitadel/console#build from the cache into apps/api/internal/staticui/console/dist/: each file as .turbo-restore-<pid>-<n>, then a rename. go build lists that folder for //go:embed all:dist and the compiler opens the files later. A temporary file listed in between is gone by then.
  • Run 46920402660 shows exactly that: @zitadel/console:build is cache hit, replaying logs at 15:55:50, and nextgen:build is cache bypass, force executing and fails at 15:56:16.
  • Reproduced locally: a loop that writes and renames .turbo-restore-* files in dist/assets beside go build ./internal/staticui/console/ failed 10 of 15 builds with the same message.

The fix

  • docs:api is no longer a root shape. It is a task in the turbo.json of the 13 SDKs that have the script, each with dependsOn: ["build"].
  • ^build is gone from it, as docs/design/build/turborepo.md already asks. TypeDoc compiles tsconfig.lib.json, the program build compiles, and build's own edges cover what that imports.
  • CI's graph drops from 420 to 367 tasks. Gone with nextgen#build are three more uncached built-in go build ./... runs (zitadel/v5, defaults, design-tokens) and 49 nodes that ran nothing (48 docs:api, go-workspace#build).
  • turborepo.md and apps/api/turbo.json now say that a dropped Go built-in comes back through dependsOn, and that a cache restore writes like a build does.

The noconsole tag is not the answer here: this build should not run at all. The one build that must not wait for the console, the hosted cloud's launcher, already uses it.

How the graph rules it out

One green run proves nothing about a race, so the claim is about edges (turbo run <the ci list> --dry=json):

  • One task has outputs in the embed folder: @zitadel/console#build.
  • No task of the package nextgen runs a command.
  • Every task that compiles the server module depends on @zitadel/console#build:
Task Edge to @zitadel/console#build
@zitadel/server#build direct
@zitadel/server#vet, #lint direct
@zitadel/server#test:unit, #test:sqlite, #test:postgres direct
@zitadel/server-*#build-binary direct
//#smoke-upgrade through @zitadel/server#build
  • The Go tasks without that edge do not read the folder:
Task Why it is safe
@zitadel/server#test:pow compiles internal/crypto/pow only
@zitadel/cloud#build -tags noconsole
@zitadel/server#check-generate generates in a copy of the tracked and unignored files, so only .gitkeep
bench#build, #vet, #test go list -deps shows tools/bench does not import the embed package
//#check-go-work go list -deps -test lists names and opens no file; 15 runs beside the same loop, 0 failures

Two new tests in scripts/task-graph.test.mjs (part of //#test) hold this. On main they fail with expected [ 'nextgen#build' ] to deeply equal [] and on the 48 docs:api tasks of packages that have no such script.

Validation

  • turbo run lint typecheck build test docs:api --concurrency=2: 203 of 204 tasks pass.
    • The failure is @zitadel/cli#test, one test of 11,756: auth-method sso enable when the schema cannot be written. It makes a file read-only with chmod and my container runs as root. This PR does not touch the CLI.
    • --concurrency=2 because turbo's default ran my 4-core container out of memory.
  • vitest run scripts/task-graph.test.mjs: 30 pass. Before the fix the two new tests fail as quoted above.
  • turbo run clean, then turbo run docs:api --filter="@zitadel/sdk-*": 32 tasks pass with api-mock, vitest-config and client-sdk-contract unbuilt, so the build edge is enough.
  • turbo boundaries: no issues.
  • The gate again from a settled tree: every cacheable task hits, except bench#build and bench#test (see Notes).
  • node scripts/check-changesets-status.mjs --summary and node scripts/check-pr-title.mjs --base origin/main: ok.

Release notes / changeset

Empty changeset (.changeset/sdk-docs-api-task.md): packages/sdk-*/turbo.json lie under publishable roots, but no tarball holds a turbo.json and nothing ships.

Notes

  • Turbo's behaviour stays: a new shape with dependsOn: ["build"] that reaches a Go module would bring the built-in back. The new test fails on that.
  • Not from this PR, seen while validating: locally bench#build and bench#test miss the cache on the run after the console's output changes. Turbo adds every file of the modules bench requires to their inputs, the ignored apps/api/internal/staticui/console/dist/** included. CI's checkout starts with that folder empty, so its keys are stable.

Generated by Claude Code

`full-pr` failed three times on 2026-12-02 in `nextgen#build`:

    internal/staticui/console/embed.go:14:5: embed dist/assets/.turbo-restore-4000-2828:
    open internal/staticui/console/dist/assets/.turbo-restore-4000-2828: no such file or directory

`nextgen#build` is turbo's built-in `go build ./...` of the server's Go
module, which apps/api/turbo.json drops. The root `docs:api` shape
(`dependsOn: ["^build", "build"]`) applied to every package, the Go modules
too, and a `dependsOn` that reaches a dropped built-in runs turbo's own
command again, with no edges. So it started beside `@zitadel/console#build`,
listed a temporary file of that build's cache restore for
`//go:embed all:dist`, and could not open it after the rename.

`docs:api` is now a task of the thirteen SDKs that have the script, each
after its own `build`. No task reaches a Go module's dropped built-in, and
the graph test holds every task that compiles the server module to the
console's build.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmTkxuPGCPPRHB4oEhB
@vercel

vercel Bot commented Dec 2, 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 Dec 2, 2026 6:22pm UTC

Request Review

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: 8b9bbdd

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
fforootd marked this pull request as ready for review December 2, 2026 21:36
Copilot AI balanced review requested due to automatic review settings December 2, 2026 21:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-12-02T21:44:35.826678Z 8b9bbdd 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.

🟢 Approval recommended

No active review issues were identified for the change limiting API documentation tasks to SDK packages.

No open issues 🎉

What changed in this PR

Prevents unintended Go builds from racing with console cache restoration in CI by limiting API documentation tasks to SDK packages.

Changes:

  • Moves docs:api from the root configuration into 13 SDKs, depending only on each SDK’s build.
  • Adds regression tests for server build ordering and documentation task scope.
  • Documents the dependency behavior and includes an empty changeset for this build-only change.
File Description
turbo.json Removes the global docs:api task.
scripts/​task-graph.test.mjs Tests build ordering and documentation task scope.
packages/​sdk-vue/​turbo.json Defines SDK-local documentation task.
packages/​sdk-tanstack-start/​turbo.json Defines SDK-local documentation task.
packages/​sdk-sveltekit/​turbo.json Defines SDK-local documentation task.
packages/​sdk-svelte/​turbo.json Defines SDK-local documentation task.
packages/​sdk-solid/​turbo.json Defines SDK-local documentation task.
packages/​sdk-solid-start/​turbo.json Defines SDK-local documentation task.
packages/​sdk-react/​turbo.json Defines SDK-local documentation task.
packages/​sdk-qwik/​turbo.json Defines SDK-local documentation task.
packages/​sdk-qwik-router/​turbo.json Defines SDK-local documentation task.
packages/​sdk-nuxt/​turbo.json Defines SDK-local documentation task.
packages/​sdk-next/​turbo.json Defines SDK-local documentation task.
packages/​sdk-core/​turbo.json Defines SDK-local documentation task.
packages/​sdk-angular/​turbo.json Defines SDK-local documentation task.
docs/​design/​build/​turborepo.md Explains task scope and cache-restore ordering.
apps/​api/​turbo.json Adds comments explaining dropped built-in task behavior.
.changeset/​sdk-docs-api-task.md Records a change requiring no package release.

Review effort: Balanced

@fforootd
fforootd added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit e7629bc Dec 2, 2026
15 checks passed
@fforootd
fforootd deleted the claude/zealous-faraday-o0n94m branch December 2, 2026 21:47
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Dec 2, 2026

This branch was successfully deployed

1 active deployment
Preview — 8b9bbdd7 Deployed Dec 2, 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

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants