You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Combined Map keyed by path (how allChildren() in diff.js keys)
809
809
constcombined=newMap()
810
810
811
-
// Add actual tree's children (the top-level symlinks)
812
-
for(constchildofactualTree.children.values()){
813
-
combined.set(child.path,child)
814
-
}
815
-
816
-
// Add synthetic entries for store nodes and store links that exist on disk.
817
-
// The proxy tree is flat: all store entries (isInStore) and store links (isStoreLink) are direct children of root.
818
-
// The actual tree only has top-level links as root children, so store entries need synthetic actual entries for the diff to match them.
811
+
// Create synthetic actual entries for ALL ideal children that exist on disk.
812
+
// The isolated ideal tree is flat (all entries as root children), but loadActual() produces a nested tree where workspace deps are under fsChildren and store entries are deep link targets.
813
+
// Synthetic entries ensure the diff compares matching resolved/integrity values (e.g. workspace links have resolved=undefined in the ideal tree but resolved="file:../packages/..." in the actual tree).
// Use empty fsChildren so that allChildren() only picks up entries from the combined map.
849
+
// The actual fsChildren have real children with different resolved values (e.g. file:../../../node_modules/.store/... vs file:.store/...) that would overwrite our synthetic entries in allChildren().
Copy file name to clipboardExpand all lines: workspaces/arborist/test/isolated-mode.js
+37Lines changed: 37 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1863,6 +1863,43 @@ tap.test('workspace links are not affected by store resolved fix', async t => {
1863
1863
t.ok(arb2.diff.unchanged.length>0,'second install should have unchanged nodes')
1864
1864
})
1865
1865
1866
+
tap.test('idempotent install with cross-workspace deps (diamond pattern)',asynct=>{
1867
+
// Regression: when workspace-x depends on workspace-y (and both share a registry dep), the second install would report "changed N packages" because (1) workspace link resolved values didn't match between ideal and actual trees, and (2) actual fsChildren overwrote synthetic store entries in the diff proxy.
0 commit comments