feat: compact MCP batch replies; feature replies name changed and removed bodies (#530) (#599)

MCP batch takes verbose: false for compact replies: feature steps leave out the full body list and sketch steps the ids they repeat outside created. Feature replies now also list changed_bodies and removed_bodies next to created_bodies, so a compact reply still shows every effect of a step. Un-ignores the #530 regression test. Fixes #530.

Co-authored-by: jonaswre <jonas.wrede@beyondit.gmbh>
This commit is contained in:
Jonas Wrede authored and GitHub committed 2026-10-13 04:32:39 -04:00
1 parent 94ab54d1f5
commit a4ca1b68db
5 files changed
+78 -6

No files matched your search

+25 -1
View File
@@ -459,7 +459,6 @@ fn screenshot_renders_a_saved_named_view() {
/// is mostly the same body list once per step. A compact batch reply names only what each step
/// added or changed.
#[test]
#[ignore = "fails until #530 is fixed"]
fn compact_batch_reply_does_not_repeat_the_body_list() {
let mut s = server();
let cube =
@@ -480,6 +479,31 @@ fn compact_batch_reply_does_not_repeat_the_body_list() {
}
}
/// A compact batch reply keeps what each step did: the body a cut changed, and a sketch
/// command's new ids once (under `created`); the default reply is unchanged.
#[test]
fn compact_batch_reply_keeps_changed_bodies_and_created_ids() {
let mut s = server();
let steps = json!([
{"command": "solid.box", "params": {"length": 10, "width": 10, "height": 10, "body_name": "Base"}},
{"command": "solid.box", "params": {"length": 4, "width": 4, "height": 10, "corner": [3, 3, 5], "operation": "cut", "targets": ["Base"]}},
{"command": "sketch.create", "params": {"plane": "XY"}},
{"command": "sketch.rectangle.two_point", "params": {"p0": [20, 0], "p1": [30, 10]}},
]);
let full = tool(&mut s, "batch", json!({"commands": steps}));
assert_eq!(full["results"][1]["bodies"], json!(["Base"]), "{full}");
assert_eq!(full["results"][3]["curves"], full["results"][3]["created"]["curves"], "{full}");
tool(&mut s, "new_design", json!({}));
let r = tool(&mut s, "batch", json!({"commands": steps, "verbose": false}));
let cut = &r["results"][1];
assert!(cut.get("bodies").is_none(), "{r}");
assert_eq!(cut["changed_bodies"], json!(["Base"]), "{r}");
let rect = &r["results"][3];
assert!(rect.get("curves").is_none() && rect.get("constraints").is_none(), "{r}");
assert_eq!(rect["created"]["curves"].as_array().map(Vec::len), Some(4), "{r}");
assert!(rect["sides"].is_object(), "results that are not repeated stay: {r}");
}
/// #531: a product model keeps an optional variant hidden in its default presentation. Hiding
/// it must survive saving and reopening the design (suppressing it would change the design).
#[test]