Repository navigation
build: rework the turbo task graph and lint the repo in one pass - #1928
Merged
joshunrau merged 8 commits intoNov 19, 2026
Merged
Conversation
Caching was defeated by how tasks were keyed, and lint paid for 28 separate type-checks. Cache keys: - .env is no longer a global dependency. It is generated with random secrets per clone, so no cache entry was ever valid in another checkout, and every edit to it reran every task. A task still sees a variable only through its `env` key. - NODE_ENV leaves globalEnv and NODE_OPTIONS becomes pass-through, and the build `env` list moves to the two apps that read it, so the library builds hash the same under `pnpm lint`, `pnpm build` and `pnpm dev` instead of three different ways. - TURBO_CACHE_DIR leaves .env.template. It reached turbo only through env-cmd, which split the cache across two directories and switched off the cache sharing turbo does between git worktrees. - runtime-core's build declares `lib/**` as an output. A cache hit restored `dist` alone, leaving the `./constants` export unresolved. - `build` hashes neither `*.md` nor `__tests__/`, `db:generate` hashes the schema alone, and outreach hashes the /docs and /blog trees its content links to, which turbo saw only as symlinks. Graph: - `lint` no longer depends on `db:push`, and nothing depends on the never-matching `^db:generate`. `db:push` is defined in the gateway, the one workspace that has it, and its build no longer runs it. - `//#generated` names what a whole-repo tool reads that source control does not hold. `test:e2e` depends on it explicitly, so the task is correct under `--filter` rather than only when every workspace is in scope. - `pnpm test` and `pnpm test:coverage` build the packages that export only build output first, instead of reading whatever `dist` is on disk. - `start` depends on its own `build`, and persistent tasks are uncached. Lint: - `pnpm lint` runs one `oxlint --type-check --fix` over the repo in place of `tsc && oxlint --fix src` in each workspace; outreach keeps `astro check`. A cold run drops from 22-25s to 12s on 11 cores. - That pass also covers the files the per-package scripts skipped (vite configs, build scripts, runtime/v1's tests), whose findings are fixed here. - `pnpm format` is one `oxfmt` run rather than 26 turbo tasks. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Every CI run started from an empty cache, and until .env left turbo's global hash a saved one could not have matched anyway. A follow-up push now reruns only the tasks whose inputs it changed. The release workflow's lint no longer invents a GATEWAY_DATABASE_URL: lint stopped running the gateway's `db:push`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A production build read its version from RELEASE_VERSION alone, which only the Dockerfiles set, so root `pnpm build` failed at the api build on every development machine. It now takes the root package.json version when the variable is unset, which is the value the release workflow passes anyway. A malformed value still fails the build. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
CI runs only on pull requests, and a pull request can read a cache saved on its base branch but not one saved by another pull request, so the first run of each started cold. The release workflow's lint job now saves turbo's cache on every push to main. Each run saves what it restored plus its own entries, so both jobs cap the age of an entry at seven days. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The playbooks and AGENTS.md files still named per-package `lint` scripts, a `lint` that ran the gateway's `db:push`, a runtime-core `lib/` that turbo did not restore, and `.env` as a global dependency. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A production build of the api, the gateway or the web app now reads its version from the root package.json when RELEASE_VERSION is unset, and nothing in their cache keys named that file. A version bump made by the release script changed the keys only because it also rewrites a package those builds depend on. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Naming the suite's prerequisites explicitly dropped `^build`, which was what built packages/playground-url/dist/cli.js, and one playground spec runs that file. The suite passed on a machine that had built the CLI before and failed in CI, which had not. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
This pull request was closed because its body does not meet
Fix the body with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Turbo's cache now survives between checkouts, git worktrees and CI runs, and
pnpm linttakes 12 s cold instead of 22–25 s (11 cores). Stacked on #1927: until that merges, the diff here also shows its two commits.Changes
pnpm lintruns oneoxlint --type-check --fixover the whole repo instead oftsc && oxlint --fix srcin each workspace. No workspace has alintscript any more exceptapps/outreach, which keepsastro check.pnpm --filter <pkg> lintno longer exists;pnpm exec oxlint --type-check <path>checks part of the repo.runtime/v1's tests. Their findings are fixed here.pnpm formatis oneoxfmtrun over the repo. No workspace has aformatscript..envis no longer a turbo global dependency, so editing it reruns nothing and a cache entry is valid in another checkout. A task still sees a variable only through itsenvkey.NODE_ENVis no longer passed to turbo tasks from the calling shell, andNODE_OPTIONSis passed through without entering the hash. The buildenvlist applies toapps/webandapps/playgroundonly, each in its ownturbo.json.TURBO_CACHE_DIRis gone from.env.template. An existing.envthat still carries the line keeps a second cache directory for the scripts that load it.runtime-core's build now restoreslib/as well asdist/.*.mdfile or a unit test no longer rebuilds anything downstream; editing a file under/docsor/blognow invalidates outreach's build and lint, which it did not before.pnpm lintno longer runs the gateway'sprisma db push, and neither does the gateway's build.dev,dev:testandtest:e2estill do.turbo run test:e2e --filter=@opendatacapture/testingnow builds everything the suite needs. Before, only an unfiltered run did.pnpm testandpnpm test:coveragebuild the packages that export only build output before running vitest.pnpm startbuilds the app it starts.RELEASE_VERSIONtakes the rootpackage.jsonversion instead of failing, so rootpnpm buildworks on a development machine.package.jsonchanges, since that is where the fallback version comes from.validatejob saves one on every push tomain. Entries older than seven days are evicted. That job no longer setsGATEWAY_DATABASE_URL.Decisions
src.--type-check, which oxlint labels experimental. It still builds one program pertsconfig.json. A file outside everyincludeis checked with compiler defaults rather than skipped, which is the one way it differs fromtsc.apps/api's Prisma client stays uncached, soprisma generateruns on every turbo invocation. libnest imports@prisma/clientitself, so the client cannot move to an output turbo can restore.package.jsonrather than failing. The release workflow already passes that same value, so the variable and the file cannot disagree in a release build.package.jsonis a declared build input for three apps only. The release script's bump already changed their cache keys, but only because it also rewrites a package they depend on. Declaring it for every build would rebuild the libraries on any root script edit.test:e2ekeeps^buildbeside its named prerequisites. One playground spec runs the builtplayground-urlCLI, and^buildis what builds it; the first version of this change dropped it and the suite failed in CI on that one test.main, so it covers this change alone. It ran before the last two commits, which changeturbo.jsonfiles and one doc and none of the files the review read.Risks
validatejob changes here and cannot run before this merges. It gains a cache step and loses an environment variable that only the removeddb:pushread.NODE_ENVfrom the calling shell would now see it unset. Everydev,dev:test,startand appbuildscript sets it inline, and the library builds do not read it.db pushat build time.scripts/run.shapplies the schema on every container start, as before.Notes
buildtasks pass on this branch, with and withoutRELEASE_VERSIONset.packages/runtime-core/{lib,dist}and rebuilding from cache restores both.turbo pruneforwebandgatewayfollowed by a dry-run build in the pruned output resolves, so the Docker builds accept the new rootturbo.jsonand the per-package ones.srcfile, a build script, a*.test-d.tsfile, a checked.jsfile and an e2e spec was reported identically byoxlint --type-checkand bytsc.packages/playground-url/distdeleted, a filteredtest:e2erun of the spec that failed in CI builds the CLI first and passes.Adversarial review
Reviewed at commit bfc9345. pnpm check: green.
Follow-up 0c62e69: restores the
^buildprerequisite oftest:e2eafter the end-to-end failure in CI; no new code.Findings
CLEAN
Attestation
I, Claude Fable 5.2, attest that the review block above reports the adversarial review as it ran on the commit named, with every finding it returned.
🤖 Generated with Claude Code