diff --git a/rust/kcl-lib/src/execution/artifact.rs b/rust/kcl-lib/src/execution/artifact.rs
index 717081595..36fa47469 100644
--- a/rust/kcl-lib/src/execution/artifact.rs
+++ b/rust/kcl-lib/src/execution/artifact.rs
@@ -1122,32 +1122,36 @@ fn artifacts_to_update(
let mut new_solid_ids = vec![id];
+ // Make sure we don't ever create a duplicate ID since merge_ids
+ // can't handle it.
+ let not_cmd_id = move |solid_id: &ArtifactId| *solid_id != id;
+
match response {
OkModelingCmdResponse::BooleanIntersection(intersection) => intersection
.extra_solid_ids
.iter()
.copied()
.map(ArtifactId::new)
+ .filter(not_cmd_id)
.for_each(|id| new_solid_ids.push(id)),
OkModelingCmdResponse::BooleanSubtract(subtract) => subtract
.extra_solid_ids
.iter()
.copied()
.map(ArtifactId::new)
+ .filter(not_cmd_id)
.for_each(|id| new_solid_ids.push(id)),
OkModelingCmdResponse::BooleanUnion(union) => union
.extra_solid_ids
.iter()
.copied()
.map(ArtifactId::new)
+ .filter(not_cmd_id)
.for_each(|id| new_solid_ids.push(id)),
_ => {}
}
let return_arr = new_solid_ids
.into_iter()
- // Extra solid IDs may include the command's ID. Make sure we
- // don't create a duplicate.
- .filter(|solid_id| *solid_id != id)
.map(|solid_id| {
Artifact::CompositeSolid(CompositeSolid {
id: solid_id,
diff --git a/rust/kcl-lib/tests/intersect_cubes/artifact_graph_flowchart.snap.md b/rust/kcl-lib/tests/intersect_cubes/artifact_graph_flowchart.snap.md
index d94dcb7c6..7529ff769 100644
--- a/rust/kcl-lib/tests/intersect_cubes/artifact_graph_flowchart.snap.md
+++ b/rust/kcl-lib/tests/intersect_cubes/artifact_graph_flowchart.snap.md
@@ -48,6 +48,7 @@ flowchart LR
42["SweepEdge Adjacent"]
43["SweepEdge Opposite"]
44["SweepEdge Adjacent"]
+ 45["CompositeSolid Intersect
[448, 477, 0]"]
1 --- 2
2 --- 3
2 --- 4
@@ -114,4 +115,6 @@ flowchart LR
30 --- 42
30 --- 43
30 --- 44
+ 2 <--x 45
+ 24 <--x 45
```
diff --git a/rust/kcl-lib/tests/subtract_cylinder_from_cube/artifact_graph_flowchart.snap.md b/rust/kcl-lib/tests/subtract_cylinder_from_cube/artifact_graph_flowchart.snap.md
index 2ca151fde..477743d8c 100644
--- a/rust/kcl-lib/tests/subtract_cylinder_from_cube/artifact_graph_flowchart.snap.md
+++ b/rust/kcl-lib/tests/subtract_cylinder_from_cube/artifact_graph_flowchart.snap.md
@@ -36,6 +36,7 @@ flowchart LR
30["Cap End"]
31["SweepEdge Opposite"]
32["SweepEdge Adjacent"]
+ 33["CompositeSolid Subtract
[461, 497, 0]"]
1 --- 2
2 --- 3
2 --- 4
@@ -81,4 +82,6 @@ flowchart LR
27 --- 30
27 --- 31
27 --- 32
+ 2 <--x 33
+ 24 <--x 33
```
diff --git a/rust/kcl-lib/tests/subtract_doesnt_need_brackets/artifact_graph_flowchart.snap.md b/rust/kcl-lib/tests/subtract_doesnt_need_brackets/artifact_graph_flowchart.snap.md
index f04581fb3..6da35c68c 100644
--- a/rust/kcl-lib/tests/subtract_doesnt_need_brackets/artifact_graph_flowchart.snap.md
+++ b/rust/kcl-lib/tests/subtract_doesnt_need_brackets/artifact_graph_flowchart.snap.md
@@ -48,6 +48,7 @@ flowchart LR
42["SweepEdge Adjacent"]
43["SweepEdge Opposite"]
44["SweepEdge Adjacent"]
+ 45["CompositeSolid Subtract
[445, 479, 0]"]
1 --- 2
2 --- 3
2 --- 4
@@ -114,4 +115,6 @@ flowchart LR
30 --- 42
30 --- 43
30 --- 44
+ 2 <--x 45
+ 24 <--x 45
```
diff --git a/rust/kcl-lib/tests/union_cubes/artifact_graph_flowchart.snap.md b/rust/kcl-lib/tests/union_cubes/artifact_graph_flowchart.snap.md
index d94dcb7c6..a991f572e 100644
--- a/rust/kcl-lib/tests/union_cubes/artifact_graph_flowchart.snap.md
+++ b/rust/kcl-lib/tests/union_cubes/artifact_graph_flowchart.snap.md
@@ -48,6 +48,7 @@ flowchart LR
42["SweepEdge Adjacent"]
43["SweepEdge Opposite"]
44["SweepEdge Adjacent"]
+ 45["CompositeSolid Union
[448, 473, 0]"]
1 --- 2
2 --- 3
2 --- 4
@@ -114,4 +115,6 @@ flowchart LR
30 --- 42
30 --- 43
30 --- 44
+ 2 <--x 45
+ 24 <--x 45
```