turbo
turbo copied to clipboard
turbo run --dry=json says cache.local=false yet when I run the task, it says cache hit
Verify canary release
- [X] I verified that the issue exists in the latest Turborepo canary release.
Link to code that reproduces this issue
https://github.com/BenjaminVanRyseghem/turbo-bug
What package manager are you using / does the bug impact?
Yarn v1
What operating system are you using?
Mac
Which canary version will you have in your reproduction?
2.0.15-canary.2
Describe the Bug
As explained here on our CI, I end up in a situation where the dry run tells me there is no local cache (even though it is restored via a prior step), but when I run the actual task, it's a full turbo.
Expected Behavior
I am expecting both to be coherent, so that I can rely on the --dry=json parameter to know when to skip CI steps
To Reproduce
I managed to reproduce it locally as you can see in the following screenshot, using this repo
Additional context
No response
outputs already on disk means the cache wasn’t even checked in the real run. The daemon was watching the outputs for your task, and they didn’t change since the last run, so it assumes that it’s a cache hit. In this scenario it is plausible there is no cache entry for the run, but we still get a “cache hit”.
Maybe it should say “cache bypass” (like it does when using the - - force flag, albeit for the opposite reason)
Thanks.
That is not the message we got in the original issue, in our CI.
The message is
package1:build: cache hit, replaying logs 74f0d18029cb48a5
So I guess it's a bit different.
The dry-run output something like
{
// tons of files
"hashOfExternalDependencies": "79d18c12d5940eb5",
"cache": {
"local": false,
"remote": false,
"status": "MISS",
"timeSaved": 0
},
"command": "webpack --progress",
"cliArguments": [],
"outputs": null,
"excludedOutputs": null,
"logFile": "apps/client/.turbo/turbo-build.log",
"directory": "apps/client",
"dependencies": [
"@foretagsplatsen/client#transit"
],
"dependents": [],
"resolvedTaskDefinition": {
"outputs": [],
"cache": true,
"dependsOn": [
"transit"
],
"inputs": [],
"outputLogs": "full",
"persistent": false,
"env": [],
"passThroughEnv": null,
"interactive": false
},
"expandedOutputs": [],
"framework": "create-react-app",
"envMode": "strict",
"environmentVariables": {
"specified": {
"env": [],
"passThroughEnv": null
},
"configured": [],
"inferred": [],
"passthrough": null
}
}
but we I run the task, I got
Tasks: 2 successful, 2 total
Cached: 2 cached, 2 total
Time: 475ms >>> FULL TURBO
Done in 0.85s.
As Mehul explained above, for local runs with the daemon this is expected behavior since outputs haven't change so nothing needs to be restored from cache.
A few follow up questions:
- Is remote cache enabled for either the
--dry=jsonrun or the real run? (i.e. isTURBO_TOKENset?) - Can you provide a reproduction (or the equivalent shell commands) of your CI setup?
I am noticing this same issue. Opening up a broader issue and will reference this one
Also having this issue
As Mehul explained above, for local runs with the daemon this is expected behavior since outputs haven't change so nothing needs to be restored from cache.
A few follow up questions:
- Is remote cache enabled for either the
--dry=jsonrun or the real run? (i.e. isTURBO_TOKENset?)- Can you provide a reproduction (or the equivalent shell commands) of your CI setup?
I have remote cache enabled for both cases. I am producing this locally, not on CI.
It is showing cache misses for both remote and local in the dry run.
See https://github.com/vercel/turborepo/issues/10055 for more information here.