fix(package-graph): Flatten cycles to avoid skipping packages#2185
fix(package-graph): Flatten cycles to avoid skipping packages#2185evocateur merged 22 commits intolerna:masterfrom
Conversation
e5917a0 to
10ded5e
Compare
b619ccb to
0f0dae2
Compare
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
I will mark this PR as ready after I have tested it with Babel.
I suggest reviewing it with whitespace diff disabled (https://github.com/lerna/lerna/pull/2185/files?w=1)
|
Oh this PR makes lerna warn about 6 cycles in Babel (instead of about 30), making it way more actionable to resolve 😄 And it seems to correctly update every package 😎 |
evocateur
left a comment
There was a problem hiding this comment.
I'm very impressed by this PR, thanks so much! (and huge apologies for the pain!)
|
|
||
| Cycles: | ||
| B -> C -> D -> E -> B | ||
| B -> C -> F -> G -> B |
b9d9352 to
031ecf3
Compare
|
I have no idea why the exec+run tests are flaking (inconsistently!) in CI. I'm fixing that now, then I'll merge. |
…, avoid environmental variability
bweggersen
left a comment
There was a problem hiding this comment.
Really great work! I love how you solved the problem at the right abstraction and simplified the way we should reason about cycles. I had to re-read the visits() function a few times to "get it". Especially lines 378-380, 384 and 391 in package-graph/index.js. There's a lot going on!
I'm grateful you were able to solve this so well, and I'm sorry this was a problem in the first place. I learned a lot reviewing your code!
| | | ||
| +---+ +---+ <----\ | ||
| | A | --> | C | | | ||
| +---+ +---+ <-\ | |
There was a problem hiding this comment.
nit: C and D's dependency lines should only point one direction each, right?
|
@evocateur Thanks for your new commits |
|
ok ok i'm done tweaking i swear |
|
@nicolo-ribaudo @bweggersen Huge thanks for all your help! |
Thanks to a gracious fix to Lerna by the Babel community, this issue (originally reported in my lerna/lerna#2107) is no longer an issue in new versions of Lerna, thanks to the fix provided in lerna/lerna#2185. Ref: lerna/lerna#2185 Ref: lerna/lerna#2107
v3.16 includes lerna/lerna#2185, which fixes an issue we had in the v7.5 releases
> In the same spirit as `apollo-server`: > apollographql/apollo-server@585085d4d8dd7ab Thanks to a gracious fix to Lerna by the Babel community, this issue (originally reported in my lerna/lerna#2107) is no longer an issue in new versions of Lerna, thanks to the fix provided in lerna/lerna#2185. Ref: lerna/lerna#2185 Ref: lerna/lerna#2107 cc @JakeDawkins cc @trevor-scheer
* Stop pinning Lerna to pre v3.14.0. > In the same spirit as `apollo-server`: > apollographql/apollo-server@585085d4d8dd7ab Thanks to a gracious fix to Lerna by the Babel community, this issue (originally reported in my lerna/lerna#2107) is no longer an issue in new versions of Lerna, thanks to the fix provided in lerna/lerna#2185. Ref: lerna/lerna#2185 Ref: lerna/lerna#2107 cc @JakeDawkins cc @trevor-scheer * chore(deps): update dependency lerna to v3.16.4
Description
To correctly handle cycles, I wrote an algorithm which flattens cycles into single nodes. Then every cycled, when it becomes a "leaf node", can be normally executed.
Example:
Becomes
Now that there aren't anymore nodes,
EandBcan be executed since they are leaf nodes. The graph becomes:C + Dnow is a leaf node, soCandDcan be executed. The cycle is then removed from the graph.At this point,
Abecomes a leaf node and can be executed.Note that two cycles might have an intersection (or be nested): in that case they are handled as a single cycle.
Context
Fixes #2107
Need to check: #2165 (@alcferreira)
How Has This Been Tested?
It fixed our problem in the Babel publishing process.
Types of changes
Checklist: