Skip to content

Assemblies: ungrounding a part says which joint can't place it (#12869) - #12870

Closed
kaievns wants to merge 2 commits into
tangency-labs:mainfrom
kaievns:pr/ground-says-skipped-joints
Closed

kaievns wants to merge 2 commits into
tangency-labs:mainfrom
kaievns:pr/ground-says-skipped-joints

Conversation

@kaievns

@kaievns kaievns commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Change

In an assembly, a grounded part stays fixed. Ungrounding it lets its joints
place it. This PR makes ungrounding say what happened. Before, a part a joint
couldn't place stayed put with no message.

Fixes #12869

Depends on #12868; review the top commit alone. #12868 makes a joint between 2
grounded parts say so. The tests use its helpers. After OK on such a joint,
#12868 leaves an error on the status line. When ungrounding warns, this PR's
note replaces that error.

Now:

  • The status line names a joint that doesn't place the part. Ungrounding
    Tab:1 with a lost origin face shows: "Tab slot doesn't place Tab:1: joint
    origin: the face F49:-z no longer exists (edit the joint to pick again)". It
    covers every ungrounding path. These are the context menu, the toolbar, and
    the Joint dialog's Unground button.
  • occurrence.ground reports the solve. It answers moved, the parts the
    solve moved, and transform, where this part is now. It also answers
    conflicts and skipped: [{joint, name, why}].
  • skipped covers the part's free group. It lists the skipped joints
    touching the part and the free parts joined to it. The walk stops at a fixed
    part.
  • The reply warns when no joint places the part. When no joint places the
    ungrounded part, it adds a warning. That also needs a skipped joint. The
    warning holds the status line's text. A part that a valid joint holds where
    it sits gets no warning.

How it works:

  • occurrence.ground solves the joints before it replies (after_grounding in
    crates/engine/src/cmd/component.rs). Before, the refresh after the command
    solved them and dropped the Solution.
  • Session::place_joints solves and records the design and model, as
    solve_joints does. The refresh after the command then skips its own solve,
    so ungrounding still solves once.
  • The warning comes from that solve. It fires when the part is missing from
    Solution::world.
  • GroundResult, the command's output schema, gains 5 fields. transform is a
    4x4 matrix. moved lists occurrence ids. conflicts and skipped are
    JointProblem lists, as in joint.edit's reply. warning is left out when
    there is none. Each field has its description.
  • command_completed calls dialogs_assembly::ground_note for
    occurrence.ground: 1 localized joint.skips_part line per skipped joint.
  • The new string is in assets/locales/pending/joint-ground-skips.json (en, ar,
    de, he, ja, ko, vi, zh). The assemblies guide and the mechanisms skill say
    what the reply holds.

Changes a default: no

Validation

New tests, in the existing test files:

  • crates/engine/src/cmd/joints_tests.rs:
    • ungrounding_one_of_two_grounded_parts_snaps_it_to_the_joint: the reply,
      B's bottom on A's top, and undo restoring B's place, flag, and conflict.
    • ungrounding_solves_the_joints_once: 1 solve. It counts 2 without
      place_joints.
    • ungrounding_a_part_whose_joint_origin_is_lost_says_which_joint_skips_it.
    • ungrounding_a_part_held_through_a_skipped_joint_says_which_joint_skips_it:
      A and B grounded, C on B, C to A with its origin lost. Ungrounding B names
      the C-A joint.
    • ungrounding_a_part_in_a_loop_of_three_closes_the_loop: B and C land
      stacked, with no conflict.
    • ungrounding_a_part_a_joint_holds_where_it_sits_warns_nothing: B sits where
      Stack puts it. C hangs off B by Clip, and Clip's origin is lost. Ungrounding
      B lists Clip under skipped, leaves B in place, and gives no warning.
  • crates/ui-egui/src/dialogs_assembly_tests.rs:
    ungrounding_a_part_a_joint_skips_says_which_joint_on_the_status_line.
  • crates/engine/src/schema/component_tests.rs:
    an_ungrounding_with_a_skipped_joint_matches_the_output_schema. It checks a
    reply with skipped and a warning against GroundResult.

1 existing schema test,
replies_match_the_output_schemas_of_the_occurrence_commands, checks 5 more
ground replies against GroundResult. None of them has joints.

The UI test and the first 5 engine tests ran on the parent commit (#12868). 5 of
those 6 fail: 4 engine and 1 UI. Each gets the reply {grounded, occurrence}
alone. The solve count passes there: #12868 solves once, in the refresh.

With the warning keyed on moved instead of the solve,
ungrounding_a_part_a_joint_holds_where_it_sits_warns_nothing fails. B stays,
and moved is []. But the reply warns "Clip doesn't place B:1: joint origin:
the face F999:nothing no longer exists (edit the joint to pick again)". The 5
other engine tests and the schema test pass either way.

cargo xtask ci on this head, on upstream/main eefdca4 (2026-11-14), stops at clippy on main's own code: crates/engine/src/cmd/file.rs:1123, vec_init_then_push, from #5092's KiCad import, macOS only. This PR doesn't touch that file. The steps before it pass: fmt, assets, icons, licences, lists, skills, layers, the shared crates, ui-containers and mesh-decisions. The rest, run on this head by hand:

  • clippy -D warnings with that one lint allowed: passes.
  • cargo xtask wasm: passes.
  • cargo xtask test, 112 binaries and the doc tests: 16,254 passed, 22 failed, 73 ignored.
  • cargo xtask web-offline-test: passes.

None of the 22 failures comes from this PR:

  • 15 are in tests/KNOWN_FAILING_TESTS.
  • 3 fail alone on main at eefdca4 too: the GPU thin-lens oracle, boolean_props::cylinder_resting_on_a_box_edge_is_scale_invariant and step_export_bytes::step_export_keeps_its_bytes_and_reads_back.
  • 4 fail in the full run and pass alone on this branch and on main at eefdca4: 3 in ui-egui agent_chat, and the UI scenario mirror_body_keeps_fillets.

On the test design from #12869, run with solidcraft-cli run:

  • Bin, Cover, and Tab are grounded.
  • "Cover seat" joins Cover's flange to Bin's rim.
  • "Tab slot" joins a foot under Tab to a pocket floor. The foot is suppressed.

Then Cover and Tab are ungrounded:

Build Unground Cover:1 Unground Tab:1
upstream/main 871014f {grounded, occurrence} {grounded, occurrence}, no warning
This branch on 871014f moved: [46], skipped: [] moved: [], 1 skipped, warning as above

Screenshots of the behavior (when observable)

Test design: Bin, Cover, and Tab, all grounded. Bin is a 6 x 5 grid of pockets
with 1,956 faces. "Cover seat" and "Tab slot" are as above.

The shots are from 2026-11-07 builds on upstream/main 871014f, which reports
version 0.40.0-rc.2.

Ungrounding Cover:1 snaps it onto Bin's rim on both builds. This branch's reply
adds moved: [46].

Ungrounding Tab:1 leaves it in place on both builds. On upstream/main 871014f,
Messages holds 1 entry, "Opened bin-grid":

upstream/main 871014f95: after ungrounding Tab:1, Messages holds 1 entry, Opened bin-grid

On this branch on 871014f, Messages shows "Tab slot doesn't place Tab:1: joint
origin: the face F49:-z no longer exists (edit the joint to pick again)":

This branch on 871014f95: after ungrounding Tab:1, Messages says Tab slot does not place Tab:1

Steps
  1. Build the design with the script in Assemblies: ungrounding a part says nothing when its joint can't place it #12869, then
    solidcraft-cli run bin.json --save bin-grid.sc.
  2. Activate Tab. Add a 26 x 2 x 1 mm box at [214, 0, -1], joined, named Foot.
  3. Ground Bin:1, Cover:1, and Tab:1.
  4. Join Cover's flange to Bin's rim ("Cover seat"). Join Foot's bottom to the
    first pocket floor ("Tab slot").
  5. Suppress Foot.
  6. Right-click Cover:1 and choose Unground. Then do the same for
    Tab:1, and read Messages.

Integration status

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor
Pre-merge checks: Passed 1

Check name Status Explanation
Existing Defaults Unchanged Passed The check fails only if the PR changes a UX default a user already relies on, or if its changes are not purely additive. I found no such change. Evidence: - The diff for commit 79165c4 (HEAD) touch…
Full details: Existing Defaults Unchanged

Explanation

The check fails only if the PR changes a UX default a user already relies on, or if its changes are not purely additive. I found no such change. Evidence: - The diff for commit 79165c4 (HEAD) touches 11 files. The source changes are in crates/engine/src/cmd/component.rs, crates/engine/src/lib.rs, crates/engine/src/schema/component.rs, crates/ui-egui/src/dialogs_assembly.rs and crates/ui-egui/src/lib.rs. The grep for default, shortcut, keybind, preference, setting and layout terms found no changed defaults, settings, shortcuts or layout. - occurrence.ground now returns extra reply fields (transform, moved, conflicts, skipped, warning). These are additive. warning is omitted when there is none. - The status-line message on ungrounding appears only when a skipped joint exists and no joint places the part. Before, that case was silent. The usual ungrounding path with no skipped joint shows no new message. - In the Joint dialog, the new note replaces a stale "can move neither" error in the skipped-joint case. This is a narrow change to one error path. - Solve timing moves into the command. The PR says this keeps the solve count at one. The result does not change for the tested cases. Cover snaps to the rim on both builds. Tab stays in place on both builds. Any geometry change falls under the check's kernel/geometry exclusion. - The PR description says Changes a default: no. The code agrees with that statement. Conclusion: the changes add a message and reply fields for a case that was silent before. No existing default value, preference, shortcut or layout changed. The check passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@kaievns

kaievns commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto #12868's head (61bfc390d), on main at 3a6fcb7. Both merge clean
with main at ba45ae8. This stays a draft until #12868 lands.

What changed:

cargo xtask ci on this branch: fmt, clippy, and the wasm check pass. Tests,
104 binaries: 15,429 passed, 24 failed, 72 ignored.

  • 18 failures are in tests/KNOWN_FAILING_TESTS.
  • The GPU thin-lens oracle also fails alone on main at 3a6fcb7.
  • The other 5 pass alone on this branch and on main at 3a6fcb7.

@kaievns

kaievns commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto #12868's new head (a635207ef), on main at cd9fa52. This commit applied with no conflict, and its code is unchanged. Both merge clean with main at 655ac60. This stays a draft until #12868 lands.

cargo xtask ci on this branch: fmt, clippy, and the wasm check pass. Tests, 110 binaries: 15,846 passed, 25 failed, 72 ignored. The 7 new engine tests and the new UI test pass.

  • 15 failures are in tests/KNOWN_FAILING_TESTS.
  • 3 also fail alone on main at cd9fa52: the GPU thin-lens oracle, a kernel boolean property test, and the STEP export bytes test.
  • The other 7 pass alone on this branch and on main at cd9fa52.

Joining 2 grounded parts stored the joint, moved nothing and said
nothing. The solver fixes every grounded part. So the new joint closes
a loop with nothing on its path to move. Its conflict read "off by N mm
... from the placement the other joints give". There were no other
joints. No create, adopt or preview path read conflicts at all.

- The closure check names both sides when both are fixed: "both its
  parts are grounded (A:1, B:1), so it can move neither". The design's
  base (occurrence 0) is fixed in every solve. When one side is the
  base, it says "it joins the design's base to B:1, which is grounded,
  so it can move neither". The check fires past CONFLICT_MM or
  CONFLICT_RAD. So parts that already meet as joined list nothing.
- When both sides are fixed, joint.create also lists it under warnings.
  assembly.constraint.create shares that path (add_joint), so it warns
  the same, by the constraint's name.
- joint.edit's reply names its joint, as joint.create's does
  (EditJointResult.joint). So a dialog tells its own conflict apart.
  assembly.constraint.edit returns the same struct, so its reply names
  its joint too.
- The preview keeps a create, as_built or edit reply that conflicts on
  its own joint. PreviewState::reply / Built::reply holds it. That
  field also holds a stopped drive's reply.
- The Joint dialog shows a warning under the picks in one case. The
  reply conflicts, and both picked occurrences are grounded. An
  "Unground <part>" button ungrounds the second pick
  (occurrence.ground). As-built joints hold their parts and stay quiet.
  The base never moves, so a pick on it shows no button.
- After OK, a conflict on the dialog's own joint sets an error in
  Messages. That covers create, as_built and edit. The error is the
  both-grounded text, or "<joint> doesn't hold: <why>". command_note
  covers this and the drive stop for both OK paths (adopt_dialog,
  run_dialog).
- Strings in assets/locales/pending/joint-both-grounded.json: en, ar,
  de, he, ja, ko, vi, zh. The assemblies guide and the mechanisms skill
  say what happens. Parts that already meet list nothing.

Tests: engine joints_tests
a_joint_between_two_grounded_parts_says_both_are_grounded,
a_joint_from_the_base_to_a_grounded_part_says_the_base,
as_built_between_two_grounded_parts_warns_nothing and
a_constraint_between_two_grounded_parts_says_both_are_grounded. ui
dialogs_assembly_tests
a_joint_between_two_grounded_parts_says_so_and_offers_to_unground,
ok_on_a_joint_between_two_grounded_parts_leaves_an_error and
ok_on_a_joint_from_the_base_to_a_grounded_part_names_the_base. With
the 4 engine tests added to upstream/main 3a6fcb7, 3 fail. Both why
tests get the old "off by 22.3607 mm ... other joints give" text. The
constraint test gets no warnings. The as-built test passes there. The
3 ui tests fail on upstream/main 871014f. 2 don't build there; 1
finds no status after OK.

On upstream/main cd9fa52. On this commit alone, the engine joints
and component tests (508) and the ui dialogs_assembly tests (86) pass.
cargo xtask ci ran on tangency-labs#12870's head, which carries this commit: fmt,
clippy, and wasm pass. Tests, 110 binaries: 15,846 passed, 25 failed,
72 ignored. 15 failures are in KNOWN_FAILING_TESTS. 3 fail alone there
and on upstream/main cd9fa52: the GPU thin-lens oracle, a kernel
boolean property test, and the STEP export bytes test. The other 7 pass
alone on that branch and on upstream/main cd9fa52: 4 in agent_chat, 2
in the CLI's help_output, and 1 in stand_up_offer.
…part

occurrence.ground flipped the flag and nothing else, and answered
{occurrence, grounded}. The refresh after it solved the joints, so a
freed part snapped. Nothing said what moved. A joint whose origin no
longer resolves goes to the solve's errors. The solve leaves it out.
Ungrounding its part then moved nothing and said nothing.

- occurrence.ground solves the joints before it replies
  (component.rs after_grounding). It answers moved: the occurrences
  the solve moved. transform says where this one is now. It also
  answers conflicts and skipped: [{joint, name, why}].
- skipped holds the errors of the joints touching the part. It also
  holds those touching the free parts joined to it. The walk stops at
  fixed occurrences.
- The reply adds a warning when no joint places the ungrounded part.
  It also needs a skipped joint. The warning reads "Stack doesn't place
  B:1: joint origin: the face `...` no longer exists (edit the joint
  to pick again)". The solve decides it: the part is missing from
  Solution::world. A part a valid joint holds where it sits gets no
  warning. That holds with a skipped joint on a free part hanging off
  it too.
- The window shows the warning on the status line. That covers every
  ungrounding path: context menu, toolbar, and the Joint dialog's
  Unground button. command_completed calls
  dialogs_assembly::ground_note: 1 localized joint.skips_part line per
  skipped joint. It replaces the stale "can move neither" error the
  dialog left there.
- The joints are still solved once per ungrounding.
  Session::place_joints solves them and records the design and model,
  as solve_joints does. The refresh after the command then skips its
  own solve. Without that, after_grounding's solve made it 2.
- GroundResult, the command's output schema, gains 5 fields:
  transform (4x4), moved, conflicts, skipped, and warning. conflicts
  and skipped are JointProblem lists, as in joint.edit. warning is
  left out when there is none.
- String in assets/locales/pending/joint-ground-skips.json: en, ar,
  de, he, ja, ko, vi, zh. The assemblies guide and the mechanisms
  skill's grounding step say what the reply holds.

Tests: engine joints_tests
ungrounding_one_of_two_grounded_parts_snaps_it_to_the_joint (reply,
B's bottom on A's top, undo restores place, flag, and conflict),
ungrounding_solves_the_joints_once (2 without place_joints),
ungrounding_a_part_whose_joint_origin_is_lost_says_which_joint_skips_it,
ungrounding_a_part_held_through_a_skipped_joint_says_which_joint_skips_it
(A, B grounded, C on B, C to A with its origin lost: unground B, the
reply names the C-A joint and warns) and
ungrounding_a_part_in_a_loop_of_three_closes_the_loop (A, B grounded
apart, C on B, a closing rigid A-C with 10 mm offset: B and C land
stacked, no conflict). ui dialogs_assembly_tests
ungrounding_a_part_a_joint_skips_says_which_joint_on_the_status_line.
With these tests added to the parent commit (tangency-labs#12868), 5 of the 6 fail.
The reply there is {grounded, occurrence} alone. The solve count
passes there: the refresh solves once.

engine joints_tests
ungrounding_a_part_a_joint_holds_where_it_sits_warns_nothing: B sits
where Stack puts it. C hangs off B by Clip, and Clip's origin is lost.
Ungrounding B lists Clip under skipped, leaves B in place, and warns
nothing. Keyed on moved instead of the solve, it fails, warning "Clip
doesn't place B:1: ...". schema component_tests
an_ungrounding_with_a_skipped_joint_matches_the_output_schema checks a
reply with skipped and a warning against GroundResult.

cargo xtask ci on this commit (on tangency-labs#12868, on upstream/main cd9fa52):
fmt, clippy, and wasm pass. Tests, 110 binaries: 15,846 passed, 25
failed, 72 ignored. 15 failures are in KNOWN_FAILING_TESTS. 3 fail
alone here and on upstream/main cd9fa52: the GPU thin-lens oracle, a
kernel boolean property test, and the STEP export bytes test. The other
7 pass alone on this branch and on upstream/main cd9fa52: 4 in
agent_chat, 2 in the CLI's help_output, and 1 in stand_up_offer.
@kaievns

kaievns commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto #12868's new head (91fb777), on main at eefdca4 (no merge of main). This commit applied with no conflict, and its code is unchanged. This stays a draft until #12868 lands.

cargo xtask ci stops at clippy on main's own code: crates/engine/src/cmd/file.rs:1123, vec_init_then_push. It comes from #5092's KiCad import and fires on macOS only. This PR doesn't touch that file. The steps before it pass: fmt, assets, icons, licences, lists, skills, layers, the shared crates, ui-containers and mesh-decisions. I ran the rest on this head by hand:

  • clippy -D warnings with that one lint allowed: passes;
  • the wasm check (cargo xtask wasm): passes;
  • cargo xtask test, 112 binaries and the doc tests: 16,254 passed, 22 failed, 73 ignored;
  • cargo xtask web-offline-test: passes.

Of the 22 failures:

  • 15 are in tests/KNOWN_FAILING_TESTS.
  • 3 fail alone on main at eefdca4 too: the GPU thin-lens oracle, a kernel boolean property test, and the STEP export bytes test.
  • 4 fail in the full run and pass alone on this branch and on main at eefdca4: 3 in agent_chat, and mirror_body_keeps_fillets in the UI scenarios.

mirror_body_keeps_fillets failed the same way in the full runs of #12868, #2465, #8719 and #12870: "step 13: bodies: got 1, want 2". It passes alone, and in a run of the whole scenarios binary on main.

The branch merges clean with main at d20e582.

kaievns added a commit to kaievns/solidcraft that referenced this pull request Nov 15, 2026
Joining 2 grounded parts stored the joint, moved nothing and said
nothing. The solver fixes every grounded part. So the new joint closes
a loop with nothing on its path to move. Its conflict read "off by N mm
... from the placement the other joints give". There were no other
joints. No create, adopt or preview path read conflicts at all.

- The closure check names both sides when both are fixed: "both its
  parts are grounded (A:1, B:1), so it can move neither". The design's
  base (occurrence 0) is fixed in every solve. When one side is the
  base, it says "it joins the design's base to B:1, which is grounded,
  so it can move neither". The check fires past CONFLICT_MM or
  CONFLICT_RAD. So parts that already meet as joined list nothing.
- When both sides are fixed, joint.create also lists it under warnings.
  assembly.constraint.create shares that path (add_joint), so it warns
  the same, by the constraint's name.
- joint.edit's reply names its joint, as joint.create's does
  (EditJointResult.joint). So a dialog tells its own conflict apart.
  assembly.constraint.edit returns the same struct, so its reply names
  its joint too.
- The preview keeps a create, as_built or edit reply that conflicts on
  its own joint. PreviewState::reply / Built::reply holds it. That
  field also holds a stopped drive's reply.
- The Joint dialog shows a warning under the picks in one case. The
  reply conflicts, and both picked occurrences are grounded. An
  "Unground <part>" button ungrounds the second pick
  (occurrence.ground). As-built joints hold their parts and stay quiet.
  The base never moves, so a pick on it shows no button.
- After OK, a conflict on the dialog's own joint sets an error in
  Messages. That covers create, as_built and edit. The error is the
  both-grounded text, or "<joint> doesn't hold: <why>". command_note
  covers this and the drive stop for both OK paths (adopt_dialog,
  run_dialog).
- Strings in assets/locales/pending/joint-both-grounded.json: en, ar,
  de, he, ja, ko, vi, zh. The assemblies guide and the mechanisms skill
  say what happens. Parts that already meet list nothing.

Tests: engine joints_tests
a_joint_between_two_grounded_parts_says_both_are_grounded,
a_joint_from_the_base_to_a_grounded_part_says_the_base,
as_built_between_two_grounded_parts_warns_nothing and
a_constraint_between_two_grounded_parts_says_both_are_grounded. ui
dialogs_assembly_tests
a_joint_between_two_grounded_parts_says_so_and_offers_to_unground,
ok_on_a_joint_between_two_grounded_parts_leaves_an_error and
ok_on_a_joint_from_the_base_to_a_grounded_part_names_the_base. With
the 4 engine tests added to upstream/main 3a6fcb7, 3 fail. Both why
tests get the old "off by 22.3607 mm ... other joints give" text. The
constraint test gets no warnings. The as-built test passes there. The
3 ui tests fail on upstream/main 871014f. 2 don't build there; 1
finds no status after OK.

On upstream/main cd9fa52. On this commit alone, the engine joints
and component tests (508) and the ui dialogs_assembly tests (86) pass.
cargo xtask ci ran on tangency-labs#12870's head, which carries this commit: fmt,
clippy, and wasm pass. Tests, 110 binaries: 15,846 passed, 25 failed,
72 ignored. 15 failures are in KNOWN_FAILING_TESTS. 3 fail alone there
and on upstream/main cd9fa52: the GPU thin-lens oracle, a kernel
boolean property test, and the STEP export bytes test. The other 7 pass
alone on that branch and on upstream/main cd9fa52: 4 in agent_chat, 2
in the CLI's help_output, and 1 in stand_up_offer.
@kaievns

kaievns commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Closing: I no longer need this change. The branch stays if anyone wants to pick it up.

@kaievns kaievns closed this Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:doc timeline, components, parameters, naming area:infra CI, tooling, repo, docs area:ui desktop/web front end, dialogs, viewport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assemblies: ungrounding a part says nothing when its joint can't place it

1 participant