Repository navigation
fix: declare build outputs so the turbo cache restores artifacts - #636
Merged
Merged
Conversation
The build task declared no `outputs`, so turbo cached no artifacts for it while still recording a cache hit on a matching input hash. A cache hit therefore reported success in milliseconds and produced zero files. That is a correctness problem rather than a missed optimisation: wherever build/ is absent but the cache is warm - CI restoring a cache into a fresh checkout, a container reusing a cache volume, a rebuild after git clean - the build silently yields no output and a deploy ships it. build/** covers every buildable package here; block-theme's `wp-scripts build --webpack-copy-php` writes only into build/. Fixes #635
stian-overasen
approved these changes
Sep 10, 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 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.
Short Introduction
Adds
"outputs": ["build/**"]to thebuildtask so turbo actually caches and restores build artifacts, instead of recording a cache hit that restores nothing.Description
Fixes #635.
Turbo only stores the files a task declares in
outputs. Thebuildtask declared none, so its cache stored nothing — yet turbo still reported the task ascachedon a matching input hash and exited 0. A cache hit therefore produced a successful, sub-second build with an emptybuild/directory.That makes the current state a correctness problem rather than a missed optimisation: any run where
build/is absent but the cache is warm (CI restoring a cache into a fresh checkout, a container reusing a cache volume, a rebuild aftergit clean) silently yields no build output, and a subsequent deploy ships it.build/**is sufficient for this repo: the only buildable package ispackages/themes/block-theme, and itswp-scripts build --webpack-copy-phpwrites only intobuild/.Note for downstream projects inheriting this config: a package that emits anything outside
build/must declare it as well, otherwise that file goes missing on a cache hit. A theme with atheme.jsongeneration step needs"outputs": ["build/**", "theme.json"].Steps to Test/Replicate
On
mainstep 2 reportsFULL TURBOand leaves the count at0. With this change the artifacts are restored from the cache.The before/after transcript from a downstream project with an identical
buildtask is in #635.Screenshots
n/a — build configuration only.
Checklist
Dekode coding standards