Skip to content

Commit c6f41ba

Browse files
committed
fix: Fix label instance reuse bug during pruning
Why is this a fixture update and not an explicit focused test? - It's an implementation bug that does not deserve negative testing
1 parent 2cb43d5 commit c6f41ba

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/legacy/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ async function buildSubtree(
283283
depTree.versionProvenance = nodeInfo.versionProvenance;
284284
}
285285
if (nodeInfo.labels) {
286-
depTree.labels = nodeInfo.labels;
286+
depTree.labels = { ...nodeInfo.labels };
287287
}
288288

289289
const depInstanceIds = depGraph.getNodeDepsNodeIds(nodeId);

test/fixtures/pruneable-tree-multi-top-level-deps-pruned.json

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
"vuln": "yes"
2323
}
2424
}
25+
},
26+
"labels": {
27+
"foo": "bar"
2528
}
2629
}
2730
}
@@ -34,6 +37,7 @@
3437
"name": "c",
3538
"version": "1.0.0",
3639
"labels": {
40+
"foo": "bar",
3741
"pruned": "true"
3842
}
3943
}
@@ -60,6 +64,9 @@
6064
"vuln": "yes"
6165
}
6266
}
67+
},
68+
"labels": {
69+
"foo": "bar"
6370
}
6471
}
6572
}

test/fixtures/pruneable-tree-multi-top-level-deps.json

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
"vuln": "yes"
2323
}
2424
}
25+
},
26+
"labels": {
27+
"foo": "bar"
2528
}
2629
}
2730
}
@@ -41,6 +44,9 @@
4144
"vuln": "yes"
4245
}
4346
}
47+
},
48+
"labels": {
49+
"foo": "bar"
4450
}
4551
}
4652
}
@@ -66,6 +72,9 @@
6672
"vuln": "yes"
6773
}
6874
}
75+
},
76+
"labels": {
77+
"foo": "bar"
6978
}
7079
}
7180
}

0 commit comments

Comments
 (0)