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

False cache positive with generated code #29685

Closed
1 of 4 tasks
TheLudd opened this issue Jan 20, 2025 · 1 comment
Closed
1 of 4 tasks

False cache positive with generated code #29685

TheLudd opened this issue Jan 20, 2025 · 1 comment

Comments

@TheLudd
Copy link

TheLudd commented Jan 20, 2025

Current Behavior

I have tasks that generate code in my repository.
The code is generated from an internal tool, and the generate task has the internal tool source as input.
There are then test tasks that depend on the generate task.

If the code for the code generating tool is changed, then the cache for the generate task is invalidated, but the cache for the subsequent test tasks is not invalidated. This causes tests to pass even if the code generator introduces bugs.

Expected Behavior

When output is generated in an nx task that a subsequent task uses as input, changes in the output should always invalidate the cache for the subsequent task

GitHub Repo

https://github.com/TheLudd/nxcache

Steps to Reproduce

  1. Clone the repo
  2. check out the master branch
  3. run pnpm install
  4. run pnpm test
  5. checkout the branch bug
  6. run pnpm test again

Nx Report

NX   Report complete - copy this into the issue template

Node           : 20.18.0
OS             : linux-x64
Native Target  : x86_64-linux
pnpm           : 9.14.2

nx  : 20.3.2

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@AgentEnder
Copy link
Member

Hey @TheLudd - this is almost certainly caused by Nx not considering gitignored files as part of the hash. You should be able to use this feature to work around the issue: https://nx.dev/reference/inputs#outputs-of-dependent-tasks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants