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

Incorrect cache hit if input is output of dependent target #27965

Open
1 of 4 tasks
ethantkoenig opened this issue Sep 18, 2024 · 0 comments
Open
1 of 4 tasks

Incorrect cache hit if input is output of dependent target #27965

ethantkoenig opened this issue Sep 18, 2024 · 0 comments

Comments

@ethantkoenig
Copy link

Current Behavior

If

  • task Y depends on task X, and
  • task Y has caching enabled, and
  • file F is the input of task Y and the output of task X

then the cache key for task Y appears to be computed using the contents of F prior to task X running, which can result in an incorrect cache hit if task X changes the contents of F.

Expected Behavior

The cache key for task Y should be computed using the contents of F after task X completes.

GitHub Repo

https://github.com/ethantkoenig/nx-cache-bug

Steps to Reproduce

  1. Run nx run foo:b2c a few times, until you see that the b2c task is hitting the cache.
  2. Change the contents of foo/a.
  3. Rerun nx run foo:b2c, and note that the b2c task is still hitting the cache, and that while foo/b has been updated to match the new contents of foo/b, foo/c still has its original contents.

Nx Report

NX   Report complete - copy this into the issue template

Node           : 21.7.1
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.5.0

nx (global)        : 19.6.5
nx                 : 19.7.3
@nx/js             : 19.7.3
@nx/linter         : 19.7.3
@nx/eslint         : 19.7.3
@nx/workspace      : 19.7.3
@nx/devkit         : 19.7.3
@nx/eslint-plugin  : 19.7.3
@nrwl/tao          : 19.7.3
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/eslint/plugin

Failure Logs

No response

Package Manager Version

No response

Operating System

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

Additional Information

No response

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

1 participant