Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

turbo run --dry=json says cache.local=false yet when I run the task, it says cache hit #9044

Open
1 task done
BenjaminVanRyseghem opened this issue Aug 22, 2024 · 3 comments
Labels
kind: bug Something isn't working needs: author input

Comments

@BenjaminVanRyseghem
Copy link

Verify canary release

  • 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

Screenshot 2024-08-22 at 11 16 32

Additional context

No response

@BenjaminVanRyseghem BenjaminVanRyseghem added kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage labels Aug 22, 2024
@mehulkar
Copy link
Contributor

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)

@BenjaminVanRyseghem
Copy link
Author

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.

@chris-olszewski
Copy link
Member

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=json run or the real run? (i.e. is TURBO_TOKEN set?)
  • Can you provide a reproduction (or the equivalent shell commands) of your CI setup?

@chris-olszewski chris-olszewski added needs: author input and removed needs: triage New issues get this label. Remove it after triage labels Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working needs: author input
Projects
None yet
Development

No branches or pull requests

3 participants