-
Notifications
You must be signed in to change notification settings - Fork 2k
Turbo only cache files at the start of a command, resulting in erroneous format/linting cache hit #10111
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
Comments
Hi, thanks for the issue. Could you paste the |
Hi 👋 I tried to run with But I think I understand the issue now, it seems what is cached is only the pre-format hash of
It seems the bug comes from the turbo caching mechanism only calculating input files hashes at start, which is not an issue for build commands but create the following bug for linter/format commands |
Gotcha. For a formatting task, you could either disable caching for it, or you could try making the task outputs the source files. That way if you hit cache, Turborepo should restore the source files. That does create some potential problems if you're using watch mode, because a task could end up in an infinite loop, but as long as you're not using watch mode, it should work. |
I see, I think I'll just disable caching for lint/format command for now, that way I'll avoid the mega headache inevitably coming when I'll forget about the workaround and wonders why watch is breaking. On the resolution side, would caching input files at the end of a task (just like output files) be a reasonable solution to you? |
Verify canary release
Link to code that reproduces this issue
https://github.com/BayLee4/turbo-bug
Which canary version will you have in your reproduction?
2.4.5-canary.2
Enviroment information
Expected behavior
Turbo should not hit cache when a source file hash has changed
Actual behavior
Turbo hits cache when a source file hash has changed
To Reproduce
Additional context
I verified using
--summarize
that the hash is correctly updated between commands, but it still hit cacheThe text was updated successfully, but these errors were encountered: