-
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
test(integration): Adds assertion to exemplify wrong path resolution in lock file #4717
base: master
Are you sure you want to change the base?
Conversation
Error seems to be produced here: Line 412 in 4c38ca7
yarn/src/cli/commands/install.js Line 832 in 4c38ca7
and further when the dependency gets resolved initially, where it should have been something more similar to a 'workspace' type instead of a 'copy' type:
|
Hi @joscha! Thanks for the PR! Obviously, we cannot merge this since it breaks CI :) Are you planning to submit a fix for the problem? If not can we have this test split up and skip the failing part so we can keep the code and the CI? |
Hi @BYK - I opened the PR to illustrate the problem outlined in #4388 in a test. This is currently blocking us from upgrading from |
@joscha - sorry for the late responses. Unfortunately, PRs are not the best place to have quick conversations anymore 😄 Come to our Discord Channels anytime and ping me or anyone really to initiate a chat. I feel like this issue is somewhat related to #3453. I'll do some more digging and come back to you. Thanks a lot for sticking with us although us not responding very quickly :) |
@joscha I've pushed some changes to your branch and did some hacky things to fix the issue but I think we need a larger refactoring here. @rally25rs @arcanis @kaylieEB - Please have a look at the new code now. It also fixes #3453. I think this is super-hacky but maybe it is an "OK" start and we can start fixing these intermingled parts? |
Woo, I've broken so many other tests now :D |
src/fetchers/copy-fetcher.js
Outdated
@@ -5,11 +5,10 @@ import BaseFetcher from './base-fetcher.js'; | |||
import * as fs from '../util/fs.js'; | |||
|
|||
export default class CopyFetcher extends BaseFetcher { | |||
async _fetch(): Promise<FetchedOverride> { | |||
await fs.copy(this.reference, this.dest, this.reporter); |
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.
I don't see this copy anywhere else, just removed. Was it not needed? Is something else performing the copy now?
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.
Since "file" dependencies are already on the disk, they are now copied at the linking stage, directly from the source instead of from the cache folder.
src/config.js
Outdated
@@ -395,6 +395,10 @@ export default class Config { | |||
return pkg.location; | |||
} | |||
|
|||
if (pkg.remote.type === 'copy') { |
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.
The couple pkg.remote.type === 'copy'
checks feel like an implementation detail that should be left to the remote
. (leaky abstraction?) Perhaps this module path creation should be part of the remote
and not part of config
(config feels like a weird place for it anyway).
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.
Totally agree. I think we need to extend the remote
information to allow "directly available" packages. This may become useful for other things in the future but I don't know how directly. Right now it feels specific to link:
and file:
protocols so I was unsure about extending this data structure or not.
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.
Looks like tarball-resolver
can also report a type of copy
. Not sure if that is OK or not...
// set remote so it can be "fetched"
pkgJson._remote = {
type: 'copy',
resolved: `${url}#${hash}`,
hash,
registry,
reference: dest,
};
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.
Assuming the CI failures are not actually related to this PR, 👍 (edit: looking at the CI results, it's hard to tell what's causing these...)
\o/ |
@BYK any chance to get this in? |
@BYK is the general gist of the changes in this PR what we want to do? If yes, I can try and make tests go green. |
@joscha I guess so. I feel like this requires a bit more refactoring around how we use cache and assume it is there so not sure if it would be fun times for you to figure that out. That said if you really want to try, who am I to stop an enthusiastic soul? 😁 |
😆 haha, hence my question if the general approach is fine, because looking at the code right now, I couldn't definitely say it is. Are there user stories somewhere, e.g. |
I don't think there's a user scenario but since |
I suppose it might have been done for multiple runs of `install`, e.g. a
local dependency should probably stay stable if you just do another
`install` even if the folder of the target dependency has been touched,
e.g.:
X is v1
Y depends on file:..X with yarb.lock X=1
Install in Y (X in Y/node_modules is at 1)
X gets touched and bumped to 2
Install in Y (X in Y/node_modules should stay at 1)
Delete Y/node_modules
Install in Y (X is at 2, yarn.lock of Y is updated with X=2)
Which means that there needs to be a copy of X which isn't touched (unless
that one copy is the one in Y/node_modules?)
It's hard to say what is right without having a user story reasoning about
it.
…On 27 Nov. 2017 22:21, "Burak Yiğit Kaya" ***@***.***> wrote:
When I have a local file:-dependency, then I expect the files to be copied
into the node modules folder and the yarn cache not to be populated, etc.?
I don't think there's a user scenario but since file: dependencies are
local, unless you have used yarn link they should never have been copied
to cache in the first place if you ask me. This is what I mean with larger
refactoring. Right now, Yarn tries to load everything from the cache folder
with the exception of links. That most probably needs to change but it
didn't look too easy when I last tried.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4717 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AALehrRm5uevUsOCnXL6XYZhXBF8xtrJks5s6ptGgaJpZM4P6A_q>
.
|
@joscha I feel like it is fine to sync/copy at all times. That would be a divergence from the old npm behavior but would align with the new npm behavior where |
This seems to be fixed in |
@joscha Do you mind rebasing the PR? I'll see to merge it! |
…in lock file The added assertions make sure that the relative path generated in the lock file points to the installation, not the yarn cache yarnpkg#4388
854fb1b
to
c0ec6eb
Compare
rebased @arcanis |
This change will decrease the build size from 10.49 MB to 10.49 MB, a decrease of 5.33 KB (0%)
|
ah, I am not sure what I am seeing locally with |
Just tested again locally. I am unsure what the hiccup was, but this problem still exists in 1.5.1 unfortunately. |
Forgive me if this is unrelated but another consideration when tackling this issue is that yarn will convert absolute paths in package.json to relative ones in yarn.lock. In my use case, that breaks things (which I can expound upon if need be but I do not think relavant). I would expect that a local dependency (absolute or relative path) should not be altered by the yarn.lock generation process. |
@arcanis I fixed the merge commit up, you can now see the problem again. |
The added assertions make sure that the relative path generated in the lock file points to the
installation, not the yarn cache
This exemplifies the problem outlined in #4388: