Closed ValentinFunk closed 7 months ago
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏
Still care about this fwiw
This cannot always be the case because tasks can depend on something from dependent tasks. This is only correct when the dependent task is actually run. I'm going to close this issue in favor of the discussion here which also discusses seeing hashes in affected --graph
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
I run
nx print-affected --targets=lint | jq .targets
to see which lint commands need to be run. This gives back a JSON with targets, commands and the task hash:We can see that the task hash for running the command
yarn nx run crush-report-e2e:lint
should be13337821e832dcffc9afa0bdf9598aea274acc99f03f9defa6a2d21f91705890
.I then run
rm -rf .nx-cache
andyarn nx run crush-report-e2e:lint
which lints and then writes the cache files - but with a different hash. e.g.5bbb49c819e3dcd0bfc4b7a8b05a31ea86a3250ecccae516a0a28d05e1791bba
.Expected Behavior
I'd expect that the hash from
.targets[0].hash
thatnx print-affected
outputs matches the hash that is computed for running.targets[0].command
.GitHub Repo
No response
Steps to Reproduce
This can be reproduced in nrwl/nx-examples
yarn nx run cart:lint
yarn nx run cart:lint
used for remote cache:yarn nx print-affected --target=lint
and look at the JSON output. The task has a different hash:Nx Report
Failure Logs
No response
Additional Information
Brief investigation into this makes me suspect that the difference is coming from
hasher.ts
in https://github.com/nrwl/nx/blob/c53d9c325c2f6309b5f1da493e32e002455e9007/packages/linter/src/executors/eslint/hasher.ts#L10The call to the default
Hasher.hashTask()
returns the same hash in both cases. But the custom hasher for the linter returns a different hash (and details).