From dbccabce4170dfe1479a3f9469a93082b7719739 Mon Sep 17 00:00:00 2001 From: B-uchi Date: Thu, 19 Nov 2026 01:54:50 +0100 Subject: [PATCH] M8: design context gives Code Connect links as the connect file does `inspect.designContext` wrote a component's links through `camel`, which renames keys at every depth, so a mapped design value such as `extra_large` came out as `extraLarge`. Its components and the code it gives each connected layer now use Code Connect's own link JSON: value names stay as written, and the code carries the link's `source` and `notes`. Export also sorts its links once, after merging the file's other links. --- crates/engine/src/design_context_tests.rs | 26 +++++++++++++++++++++++ crates/engine/src/dev/code_connect.rs | 16 ++++++++------ crates/engine/src/dev/design_context.rs | 11 ++++++++-- docs/mcp.md | 2 +- 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/design_context_tests.rs b/crates/engine/src/design_context_tests.rs index 5d6f51304..722edc8b4 100644 --- a/crates/engine/src/design_context_tests.rs +++ b/crates/engine/src/design_context_tests.rs @@ -407,3 +407,29 @@ fn a_join_stopped_at_its_budget_says_so() { let (some, complete) = crate::design_context::referenced(s.doc().unwrap(), &start, &none, 3); assert_eq!((some.len(), complete), (3, false), "{some:?}"); } + +#[test] +fn code_links_keep_their_value_names_and_carry_source_and_notes() { + let mut s = session(); + let variants: Vec<_> = ["small", "extra_large"] + .iter() + .map(|v| { + let f = node(&mut s, json!({"type": "frame", "name": format!("Size={v}"), "width": 80, "height": 32})); + id(&s.execute("component.create", &json!({"ids": [f]})).unwrap()) + }) + .collect(); + let set = id(&s.execute("component.combineVariants", &json!({"ids": variants})).unwrap()); + s.execute( + "codeConnect.set", + &json!({"id": set, "name": "Button", "template": "