{"action":"created","issue":{"url":"https://api.github.com/repos/yarnpkg/yarn/issues/2164","repository_url":"https://api.github.com/repos/yarnpkg/yarn","labels_url":"https://api.github.com/repos/yarnpkg/yarn/issues/2164/labels{/name}","comments_url":"https://api.github.com/repos/yarnpkg/yarn/issues/2164/comments","events_url":"https://api.github.com/repos/yarnpkg/yarn/issues/2164/events","html_url":"https://github.com/yarnpkg/yarn/pull/2164","id":193775811,"number":2164,"title":"Fix an issue in package hoisting","user":{"login":"mvestergaard","id":2027834,"avatar_url":"https://avatars.githubusercontent.com/u/2027834?v=3","gravatar_id":"","url":"https://api.github.com/users/mvestergaard","html_url":"https://github.com/mvestergaard","followers_url":"https://api.github.com/users/mvestergaard/followers","following_url":"https://api.github.com/users/mvestergaard/following{/other_user}","gists_url":"https://api.github.com/users/mvestergaard/gists{/gist_id}","starred_url":"https://api.github.com/users/mvestergaard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvestergaard/subscriptions","organizations_url":"https://api.github.com/users/mvestergaard/orgs","repos_url":"https://api.github.com/users/mvestergaard/repos","events_url":"https://api.github.com/users/mvestergaard/events{/privacy}","received_events_url":"https://api.github.com/users/mvestergaard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-06T13:45:08Z","updated_at":"2016-12-07T11:51:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/yarnpkg/yarn/pulls/2164","html_url":"https://github.com/yarnpkg/yarn/pull/2164","diff_url":"https://github.com/yarnpkg/yarn/pull/2164.diff","patch_url":"https://github.com/yarnpkg/yarn/pull/2164.patch"},"body":"**Summary**\r\n\r\nThis is an attempt to fix #2142 \r\n\r\nUsing this package.json\r\n```\r\n{\r\n  \"name\": \"test\",\r\n  \"devDependencies\": {\r\n    \"babel-cli\": \"^6.18.0\",\r\n    \"gulp-imagemin\": \"^3.1.1\"\r\n  }\r\n}\r\n```\r\n\r\nShould create a scenario along the lines of this (on any platform except OSX):\r\n```\r\nbabel-cli [installed]\r\n└─ chokidar [installed]\r\n   └─ fsevents [skipped, potentially the whole tree]\r\n      └─ node-pre-gyp [skipped good]\r\n         └─ rc [not skipped, good]\r\n            ├─ deep-extend [skipped, bad!]\r\n            ├─ ini [skipped, bad!]\r\n            ├─ minimist [not skipped, good]\r\n            └─ strip-json-comments [skipped, bad!]\r\n\r\ngulp-imagemin [installed]\r\n└─ imagemin-jpegtran [installed]\r\n   └─ jpegtran-bin [installed]\r\n      └─ bin-build [installed]\r\n         └─ download [installed]\r\n            └─ caw [installed]\r\n               └─ get-proxy [installed]\r\n                  └─ rc [installed]\r\n                     ├─ deep-extend [missing]\r\n                     ├─ ini [missing]\r\n                     ├─ minimist [installed]\r\n                     └─ strip-json-comments [missing]\r\n\r\n[...]\r\n{various-other-packages} [installed]\r\n└─ minimist [installed]\r\n```\r\n\r\nMy findings from debugging is that this happens because of the following:\r\n\r\nIt seems like what happens is that `rc` is ignored in the `fsevents` branch.\r\n\r\nThis causes `get-proxy#rc` to be removed from the tree in the method `hoist@283`: `this.tree.delete(key);` and when it looks at the dependency `deep-extend` in `_seed@141` it will skip it because `get-proxy#rc` was removed from the tree:\r\n```javascript\r\n      if (!this.tree.get(parent.key)) {\r\n        return null;\r\n      }\r\n```\r\n\r\n`get-proxy#rc` is removed from the tree due to:\r\n```javascript\r\n    if (duplicate) {\r\n      info.addHistory(`Satisfied from above by ${newKey}`);\r\n      this.declareRename(info, rawParts, parts);\r\n      return;\r\n    }\r\n```\r\n\r\nWith this change, installed packages align with installiation through npm. `npm install` and `npm prune` yield no changes.\r\n\r\nAt this time, this seems to break the test `hoisting should factor ignored dependencies`.\r\n\r\n**Test plan**\r\n\r\nI have not been able to replicate the original scenario in a test.\r\nI've made multiple attempts including https://github.com/mvestergaard/yarn/commit/9521157ace19bb4d42240532091d8b5402b05ef5"},"comment":{"url":"https://api.github.com/repos/yarnpkg/yarn/issues/comments/265428202","html_url":"https://github.com/yarnpkg/yarn/pull/2164#issuecomment-265428202","issue_url":"https://api.github.com/repos/yarnpkg/yarn/issues/2164","id":265428202,"user":{"login":"bestander","id":2121048,"avatar_url":"https://avatars.githubusercontent.com/u/2121048?v=3","gravatar_id":"","url":"https://api.github.com/users/bestander","html_url":"https://github.com/bestander","followers_url":"https://api.github.com/users/bestander/followers","following_url":"https://api.github.com/users/bestander/following{/other_user}","gists_url":"https://api.github.com/users/bestander/gists{/gist_id}","starred_url":"https://api.github.com/users/bestander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bestander/subscriptions","organizations_url":"https://api.github.com/users/bestander/orgs","repos_url":"https://api.github.com/users/bestander/repos","events_url":"https://api.github.com/users/bestander/events{/privacy}","received_events_url":"https://api.github.com/users/bestander/received_events","type":"User","site_admin":false},"created_at":"2016-12-07T11:51:24Z","updated_at":"2016-12-07T11:51:24Z","body":"Existing tests are failing"}}
{"actor":{"display_login":"bestander"}}