Skip to content

Assembly: Relink Source takes a .json design, as Insert Design does - #10394

Merged
bherbruck merged 1 commit into
tangency-labs:mainfrom
LorbusChris:relink-json-designs
Nov 1, 2026
Merged

bherbruck merged 1 commit into
tangency-labs:mainfrom
LorbusChris:relink-json-designs

Conversation

@LorbusChris

@LorbusChris LorbusChris commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Change

component.insert_design links a design saved either as a .sc container or as plain JSON (.json). component.relink (Relink Source) refused every path that was not a container: "choose a saved .sc design". So a component linked to a JSON design could not be pointed at another JSON design, and one linked to a container could not be pointed at a JSON one.

Relink now takes any design path Insert Design takes (solidcraft_io::is_design_path: .sc, a legacy extension, or .json). The file is read by the same design_bodies, which already reads both. The parameter text and the refusal name both kinds.

In the app, Relink Source's file dialog opened on a filter of .sc and the legacy extensions, so .json designs didn't show until you switched filters. That filter now lists .json too.

Changes a default: no

Validation

Run on Linux x86_64 (Fedora 44, Rust 1.99.1), --profile ci, on this branch rebased on main at ed66ada:

  • cargo test --profile ci -p solidcraft-engine --lib cmd::component_link::relink_tests: 17 passed, 0 failed, the new relink_takes_a_json_design_as_insert_design_does among them. It inserts a 10 × 20 × 30 box saved as .sc (6000 mm³), relinks it to a 10 × 20 × 45 box saved as .json (expected 9000 mm³), then back to the container (expected 6000 mm³), and checks that file.save really wrote the .json as plain JSON.

  • cargo test --profile ci -p solidcraft-ui-egui --lib linked_source: 18 passed, 0 failed, the new relink_picks_a_plain_json_design_as_insert_design_does among them. It answers Relink Source's file dialog with a .json design and checks that the link follows it. The existing picker tests now expect .json among the extensions the dialog opens on.

  • cargo xtask ci, on this PR's head (8749936, on main at b99d4dd): fmt, assets, icons, licences, lists, skills, layering, UI containers, clippy --workspace --all-targets -D warnings, the wasm check and the doc tests pass. 81 of the 83 test binaries pass, among them solidcraft-engine lib (3092 passed, 0 failed) and the UI scenarios test (146 passed). The two that fail have failures unrelated to this change:

    • solidcraft-gpu lib: 28 of 165 tests, all path-tracer tests on this machine's AMD Radeon 890M (RADV). On main at 653bc00, 28 fail as well.
    • solidcraft-ui-egui lib: 3969 passed and 3 failed, the linked_source tests among those that pass. render_workspace::tests::progressive_image_controls_route_to_the_registered_host is a path-traced render ("inconsistent glass medium paths") and fails on main too. op_auto::tests::primitives_and_revolves_join_cut_or_stand_apart and viewport::overlays_tests::corner_toast_keeps_its_width_beside_a_docked_dialog failed only inside the full run; run alone, they pass on this branch and on main.
    • The web offline test wasn't reached. With no Chrome on this machine, it would have been skipped anyway.
    • Corrected on 2026-11-01: the cargo xtask ci results first posted here came from a run in another checkout, not of this branch. These are from this branch.
  • Reproduction with solidcraft-cli run, built from main at ed66ada and from this branch, on the same two files (scripts below):

    Step main this branch
    component.insert_design source.sc inserted, 6000 mm³ inserted, 6000 mm³
    component.relink to source.json refused: "invalid parameters for component.relink: choose a saved .sc design" relinked: previous_path source.sc, geometry_changed: true
    inspect.measure (not reached) 9000 mm³
Scripts

make-sc.json and make-json.json write the two sources; relinked.json is the run above. make-json.json is make-sc.json with "height": 45 and source.json.

{"commands": [
 {"command": "solid.box", "params": {"length": 10, "width": 20, "height": 30, "corner": [0, 0, 0]}},
 {"command": "file.save", "params": {"path": "source.sc"}}
]}
{"commands": [
 {"command": "component.insert_design", "params": {"path": "source.sc", "name": "Source"}},
 {"command": "inspect.measure", "params": {}},
 {"command": "component.relink", "params": {"component": "Source", "path": "source.json"}},
 {"command": "inspect.measure", "params": {}}
]}

solidcraft-cli run make-sc.json && solidcraft-cli run make-json.json && solidcraft-cli run relinked.json --results

Screenshots of the behavior (when observable)

Steps: save a 10 × 20 × 30 box as source.sc and a 10 × 20 × 45 box as source.json. In a new design, Insert Design source.sc, then Relink Source to source.json.

Before the relink: the component shows the 30 mm box from source.sc.
1-linked-to-sc

After Relink Source to source.json: the same component, now the 45 mm box. On main this step is refused with "choose a saved .sc design" and the component stays as it was.

2-relinked-to-json

Captured from this branch's desktop build (--profile ci) on Linux x86_64 under Xvfb. Both shots use the same isometric camera. The steps were sent through the control channel (engine.execute), because Relink Source picks its file in the system's file dialog, which Xvfb can't drive.

Integration status

Rebased on main at b99d4dd (2026-11-01); no conflicts. No open issue or PR covers it (#2772, Relink Source itself, is closed). #5449 (open) moves Relink's reading of the design into open_linked, which already takes .json. But it keeps Relink's own .sc-only check in front of that, so the refusal stays. Both change relink() in component_link.rs, a few lines apart.

Assisted-by: LLM

`component.insert_design` links a design saved as a .sc container or as plain
JSON (`.json`), but `component.relink` refused every path that was not a
container ("choose a saved .sc design"), so a component linked to a JSON
design could not be pointed at another one. Relink now takes any design path
Insert Design takes (`is_design_path`: .sc, a legacy extension or .json); the
file is read by the same `design_bodies`, which already reads both. The Relink
Source file dialog opens on a filter that lists .json among the designs, too.

Assisted-by: LLM
@github-actions github-actions Bot added the area:ui desktop/web front end, dialogs, viewport label Nov 1, 2026
@bherbruck bherbruck added approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) ready to merge reviewed, every ask addressed; merge once CI is green and removed approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) labels Nov 1, 2026
@bherbruck
bherbruck enabled auto-merge November 1, 2026 01:43
@bherbruck bherbruck added approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) and removed approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) labels Nov 1, 2026
@bherbruck
bherbruck added this pull request to the merge queue Nov 1, 2026
Merged via the queue into tangency-labs:main with commit 5c1aad8 Nov 1, 2026
96 of 147 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) area:ui desktop/web front end, dialogs, viewport ready to merge reviewed, every ask addressed; merge once CI is green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants