Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Tell me why a cache miss happened #4494

Closed
ds300 opened this issue Apr 6, 2023 · 7 comments
Closed

Tell me why a cache miss happened #4494

ds300 opened this issue Apr 6, 2023 · 7 comments

Comments

@ds300
Copy link

ds300 commented Apr 6, 2023

Which project is this feature idea for?

Turborepo

Describe the feature you'd like to request

When turbo can't find a cached result, we get no information to tell us why. In the cli we only see

@scope/package:task cache miss, executing <hash>

This makes it extremely tedious to debug situations where the cache is being invalidated more often than I expect, which happens often.

I'd like a short list of the cached values that were different compared to the previous successful build.

@scope/package:task cache missed because
  changed file packages/cli/src/run.ts
  new file packages/cli/__test__/e2e.test.ts
  deleted file packages/cli/__test__/harness.ts
  changed env var NODE_ENV
  ... and 32 others. See .turbo/task.log

Describe the solution you'd like

Turbo should store a log of the most recent successful build for any given (task, package) pair. This log should include a manifest of all the input values that contribute to the composite cache key for the (task, package) pair, along with their hashes.

Whenever turbo starts a new task in a given package, it should look for the most recent log and, if found, compare the new list of input values and their hashes against the value recorded on the previous successful build.

If it finds a log and finds hash differences, it should print a concise truncated list of the differences to the cli, and a full list of the differences to the persistent task log.

Describe alternatives you've considered

I tried using the new summary.json files, but even with json-aware diffing it's quite difficult to find out what changed from one run to the next.

@ds300 ds300 added needs: triage New issues get this label. Remove it after triage story labels Apr 6, 2023
@tomByrer
Copy link

I guess this is your solution?
https://github.com/ds300/lazyrepo

@GiancarlosIO
Copy link

+1 it would be really helpful to understand why we get cache-miss

@jonaslindstr
Copy link

With Turbo 1.9 I have run the same small task twice, starting from an uncached state, with and without --experimental-env-mode=strict. The only differences in the JSON output are the id of the run, execution.startTime and execution.endTime on the top level and for the task itself, and then the hash of the task, tasks[0].hash.

Since the task hash is different between the runs, both runs get a cache miss. But I don't understand what the hash change is based on, since everything else in the tasks (as listed in the JSON) is the same.

@gsoltis
Copy link
Contributor

gsoltis commented Apr 12, 2023

@ds300 with turbo@1.9.0, you should be able to use --summarize to generate a JSON file of everything turbo considered for its hash / cache calculation.

@gsoltis gsoltis closed this as completed Apr 12, 2023
@gsoltis
Copy link
Contributor

gsoltis commented Apr 12, 2023

@jonaslindstr if you have a hash changing with nothing else changing in the file, can you open a new issue with the relevant details? Thanks!

@ds300
Copy link
Author

ds300 commented Apr 14, 2023

@gsoltis --summarize exists sure, but it requires extra (as-of-yet nonexistent) tooling to be human-friendly.

This feature request is explcitly for a human-friendly way of knowing why a task reran.

@gsoltis
Copy link
Contributor

gsoltis commented Apr 14, 2023

@ds300 Got it. I'll leave this open as a feature request then. --summarize is new, now that we are regularly producing the data, I expect it will be a bit more tractable to layer on some tooling to get a more human-friendly view.

@gsoltis gsoltis reopened this Apr 14, 2023
@mehulkar mehulkar removed the needs: triage New issues get this label. Remove it after triage label Nov 6, 2023
@vercel vercel locked and limited conversation to collaborators Feb 22, 2024
@anthonyshew anthonyshew converted this issue into discussion #7477 Feb 22, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

7 participants