Uh oh!
There was an error while loading. Please reload this page.
build(turbo): declare content/docs as an input to build and type-check - #85
Merged
Merged
Conversation
`content/docs/` lives at the repo root, outside the `apps/docs` package, but both `build` and `type-check` consume it — `source.config.ts` points fumadocs at `../../content/docs`. With no `inputs` declared, turbo's default hash covers only the package directory, so a content-only change did not move the hash and both tasks replayed a cached green. The cache is shared across worktrees in a multi-agent container, so the replayed logs could come from a sibling agent's tree, which makes the false green look like a real run. Declare the dependency with the root-anchored `$TURBO_ROOT$` microsyntax rather than a hand-counted `../../`. Both resolve identically on turbo 2.9.14 (measured: same 450-entry input list, same hashes), but a relative glob encodes the package's depth and silently matches nothing if the package moves — and a wrong inputs glob is not an error, it exits 0 and reverts to the stale hash. Task-level `inputs` rather than root `globalDependencies`: globalDependencies feeds the global hash, so it would bust every task in the repo, including `lint`, which does not read content/docs (measured). AGENTS.md documents how to verify the hash actually tracks content, plus the `--force` escape hatch for anyone on a turbo older than 2.4. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CJPxtTxoxTUnjNdTbiEaRa
os-zhuang
marked this pull request as ready for review
August 18, 2026 13:03
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 18, 2026
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 freeto 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.
Fixes#81
content/docs/lives at the repo root, outside theapps/docspackage, but bothbuildandtype-checkgenuinely consume it —apps/docs/source.config.tspoints fumadocs atpath.resolve(process.cwd(), '../../content/docs'). With noinputsdeclared, turbo's default hash covers only the package directory, so a content-only change did not move the hash and both tasks replayed a cached green."build": { "dependsOn": ["^build"], + "inputs": ["$TURBO_DEFAULT$", "$TURBO_ROOT$/content/docs/**"], "outputs": ["dist/**", ".next/**", "!.next/cache/**"] }, "type-check": { - "dependsOn": ["^build"]+ "dependsOn": ["^build"],+ "inputs": ["$TURBO_DEFAULT$", "$TURBO_ROOT$/content/docs/**"] }turbo version in this repo: 2.9.14 (root
package.jsonpins^2.5.0; lockfile resolves 2.9.14).The defect, confirmed from history before touching anything
The issue quoted
cache hit, replaying logs 6eb08f6bec2cc211from a sibling worktree. A fresh worktree cut from today'sorigin/main— which has since merged two rounds of content changes (8fe88ba, merged as #82) — computes the same hash:37 inputs, all under
apps/docs/, none fromcontent/docs/. The hash is unchanged across every content change that has landed since the issue was filed.1. Before — a content-only change hits the cache
On the unmodified
origin/mainconfig, isolatedTURBO_CACHE_DIR:Same hash,
FULL TURBO, with a modified MDX page in the working tree. Nothing was checked.2 and 3. After — it misses when it should, hits when it should
The config is held constant across the three steps below; the only variable is the content file, which is edited and then reverted. The hash moves and returns to the identical value, so the miss cannot be attributed to a lockfile touch, a config change, or a different working directory.
type-check
build
7ec62389ee49c559→5e646c077c805631→7ec62389ee49c559, anddf9c5ef0f979f8c6→39b8ad052a391947→df9c5ef0f979f8c6. Caching is not disabled; the hash simply now tracks the content.Which lever — measured, not inferred
Four configs, each dry-run on a clean tree and again with one
content/docs/file edited:type-checkinputsorigin/main(noinputs)inputs: ["$TURBO_DEFAULT$", "../../content/docs/**"]build,type-checkinputs: ["$TURBO_DEFAULT$", "$TURBO_ROOT$/content/docs/**"]build,type-checkglobalDependencies: ["content/docs/**"]build,type-check, andlintAnswering the card's open question directly: the package-relative escape is honoured in turbo 2.9.14 — B is not broken. B and C produce byte-identical results (same 450-entry input list, same hashes on both legs).
globalDependenciesis the wrong lever: it feeds the global hash rather than the task's inputs, socontent/docs/never appears as a task input and every task in the repo is invalidated, includinglint, which does not read content.Why
$TURBO_ROOT$over../../Because a wrong
inputsglob is not an error. Every one of these exits 0:A miscounted
../reverts silently to6eb08f6bec2cc211— the exact defective hash, with no diagnostic.../../encodes the package's depth and is only correct while docs sits atapps/docs;$TURBO_ROOT$is anchored to the repo root by turbo itself. Same behaviour today, one fewer thing that can be silently wrong tomorrow. The microsyntax is validated by turbo (it carries dedicated errors for$TURBO_ROOT$not at the start of a glob, and for a missing/after it), so a typo in the token itself fails loudly.AGENTS.md
A short section documents the coupling, the reason for
$TURBO_ROOT$, how to check that the hash actually moves (since a wrong glob is silent), and--forceas a belt-and-braces escape hatch — explicitly the escape hatch, not the routine path.--forcealso covers anyone on a turbo older than 2.4, where$TURBO_ROOT$does not exist and the glob would match nothing.Verification
All at
749e62c:Scope
.github/workflows/ci.ymlnot touched —os-support-aihas ci: run the build check on merge_group #77 in flight against it. No workflow change was needed: the merge queue and requiredbuildcheck are unaffected, since CI already runs cold with no populated cache.content/docs/index.mdxin the working tree and reverted it; no fixture page was added. Verified byte-identical toorigin/mainby sha256 (efeebee6…4903e1) and by an emptygit diff origin/main -- content/. Sibling cards Six pages outside Deploy still describe the retired multi-Environment runtime #70 and The three boot shapes are named differently on architecture.mdx and deploy/index.mdx #71 are untouched.TURBO_CACHE_DIRso no sibling worktree's cache could confound the result.Generated by Claude Code