-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add hash to cache path for non-NPM packages #2074
Conversation
48bb44c
to
aa4b3e3
Compare
Where is |
@kittens it's saved to the metadata file here. The only occasion I found where |
@mourner, could you add a test for the new behavior and the issues it addresses, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- need tests to ensure it does not regress later
Sure, I just wanted to get some early feedback before I start working on tests. Will do. |
It does make some sense, we have some confusion in the system where the hashes come from. |
@mourner want any help with tests? |
@benmosher sure! I was going to take a look next week, but if you're willing to help out with the PR, you're very welcome! |
@bestander @kittens updated the PR with a simpler fix. It leaves Note that the test failures are the same as the ones in the current master, for which I'm not responsible. I'm still not able to add tests for the change though because package resolver tests were disabled by @kittens in b59fd78 and I don't have enough knowledge to reenable them and fix the failures (unrelated to the changes in this PR). |
@bestander thanks! Rebased on top of master. I'll wait for #2373 to land before attempting to add any tests. @benmosher are you still up for help on the tests? |
@bestander finally added some tests based on the reenabled resolver tests! Hopefully we can land this in a Yarn release soon. Also, I used this Yarn fork locally and it worked perfectly when doing a difficult git bisect in a project with tons of git-hashed dependencies (mapbox-gl-js), whereas it would be impossible in both stable Yarn (due to the bug) and NPM (due to unbearable install times). |
Found another duplicate for the problem: #2280, cc @redgenie ^^^ |
@mourner, great job! |
Yay, thanks for merging! |
I believe this has regressed; currently a github dependency is not updated on disk after a EDIT: yarn 0.21.3, macOS 10.12.3. |
@tamird I think |
Yes, |
@tamird can you check if the relevant resolver tests still pass? |
What do you mean? Does yarn not have CI? |
@tamird it does but it's quite useless at the moment because all recent master commits have failed builds, so I don't know whether the resolver tests actually caught any regression or not. 😕 |
Yes, it seems the resolver tests do pass. |
Summary
Currently, only packages resolved to NPM registry have their hash appended to cache directory name. Other packages, such as those with GitHub URL, get cached by their
name
+version
rather than actual content. This leads to a bug where even if you update the GitHub url inpackage.json
(e.g. different GitHub commit hash), it is never updated onyarn install
unless you clean the cached folders for the package along withnode_modules
. This is a huge pain for teams that depend on GitHub urls in dependencies.Should address #1171, #1893, #1087, #1280, #1278, #1017 #1573 #2280. I'm not sure it fully fixes all the mentioned issues, so it's a work in progress in need of a discussion and thorough testing, but it should be a step in the right direction.
Test plan
This is my first dive into Yarn codebase and I haven't yet figured out a way to test this — currently
npm test
fails for me locally onmaster
with "process exited unexpectedly error" incommands/remove.js
without much detail.cc @kittens @jfirebaugh @jordanburke @ronag @wmertens @tamird @mgutz @panrafal @omnidan