You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
STEP export: each body states its own accuracy, so Insert Design no longer opens a body beside a loose one (#17579) - #18354
Insert Design brings a design's bodies into an assembly by writing them to SolidCraft's own STEP and reading it back. The STEP writer stated one accuracy for the whole file: the loosest tolerance of any record, edge or vertex of any body (#11997). The reader reads every solid at its representation's stated tolerance. So one body with loose edges made every other body of the design be read back at that tolerance, and a closed body could lose a face there and come back open. Examples:
A native block with a diagonal bore came back open beside a sheet whose edges carry 0.45 mm tolerances.
Now a body whose accuracy is finer than the file's loosest is written in a representation context of its own that states its accuracy. The reader already reads each representation in its own context. The bodies are written in runs that keep the order SolidCraft's reader met them in before, because a link update keeps body names by position. A file whose bodies are all equally accurate is written byte for byte as before.
solidcraft-kernel step_out::tests::each_body_reads_back_at_its_own_tolerance_in_order: on main the tight bodies read back at 0.3 mm.
solidcraft-engine component_link::tests::insert_design_reads_each_body_at_its_own_accuracy_beside_a_loose_sheet: on main the block comes back with 14 faces, open.
Both of the last two fail without the writer change even with the companion import fix in place.
Passed: format and repository checks, Clippy, doc tests, reference tests, GPU path tests, Windows builds, WebAssembly, RISC-V, SolidCore standalone build and wasm checks, and dependency advisories.
Native Linux tests and SolidCore checks (tests): the hosted runner was shut down while compiling, on both attempts, so no test ran there. The three new tests pass locally on this branch alone. The local full runs gave 8516 passed and 13 failed in the root workspace, all listed in tests/KNOWN_FAILING_TESTS. In solidcore, 8091 passed and 1 failed for want of upstream/TestFiles.
Action matrix: the shards fail the same way on main's nightly run 43818772935.
Screenshots of the behavior
The neutral block after Insert Design, looking into the diagonal bore. Left: 0.43.0, where the bore's wall is missing and the block is open (14 faces). Right: this branch, closed (15 faces, 12466.133 mm³). Captured with solidcraft-cli snapshot.
Integration status
Based on main at b412b6c (16 Nov 2026). Not rebased since.
Independent of the companion lens-import PR: the three tests above pass on this branch alone.
Summary by CodeRabbit
Bug Fixes
STEP exports now better preserve the individual accuracy of bodies with different tolerances, including bodies with looser edge tolerances. Bodies with matching accuracy can share export context.
Reimporting STEP files preserves body names and order, while maintaining the appropriate accuracy for each body.
Tests
Added coverage for linking a design containing a bored, slotted block and a sheet with loose edge tolerances.
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The STEP writer now assigns representation contexts based on body accuracy. New tests check tolerance preservation during STEP round trips and body measurements after linking a design.
The STEP writer sets the file context from the loosest body accuracy and creates or reuses contexts for finer accuracies. It emits solid and sheet representation runs with their associated contexts. Tests check context selection, ordering, and tolerance preservation across export and import.
Linked-design body measurement test crates/engine/src/cmd/component_link.rs
A new test combines a loose-tolerance sheet with a bored, slotted block, links the saved design, and checks the closed body count, face count, and volume.
This change makes STEP export write each body in a context matching its own accuracy, so a loose body no longer causes tighter bodies to reopen open after Insert Design. Files whose bodies all have the same accuracy are written as before. No concrete defect remains from the review. The new tests cover the reported scenario, but they have only been run locally, not on hosted CI.
Architecture risk: Medium · up to 77805
The change affects 2 systems.
Changed systems:crates, solidcore
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
observed — crates (service) was modified; 2 changed files map to changed impact.
observed — solidcore (service) was modified; 1 changed file maps to changed impact.
Before / after behavior
observed — Modified behavior in crates/engine/src/cmd/component_link.rs: Adds a test fixture that builds a STEP file containing a single open sheet with spline edges offset 0.15 mm from its face.
observed — Modified behavior in crates/engine/src/cmd/component_link.rs: Adds a fixture that creates a block, cuts a diagonal bore, then adds and extrudes a slot sketch.
observed — Modified behavior in crates/engine/src/cmd/component_link.rs: Adds a helper that returns each measured body’s name, face count, closed status, and optional volume.
observed — Modified behavior in crates/engine/src/cmd/component_link.rs: Adds a test that combines the loose-tolerance sheet with the block, links the saved design, and asserts that exactly one linked body is closed and that its face count and volume match the original block.
Reliability and maintainability
inferred — Risk-relevant change factors for crates: blast_radius_1; direct_dependents_1
inferred — Risk-relevant change factors for solidcore: blast_radius_1; blast_radius_2; direct_dependents_1
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title names the main change: STEP export now writes each body with its own accuracy, which stops Insert Design from opening a body beside a loose one. It is specific and matches the raw summary an…
Description check
The description follows the template. It has a Change section that explains the problem and behavior in plain words and links issue #17579. It includes the required 'Changes a default: no' line. It ha…
Linked Issues check
[#17579] The requirement is that the three bodies of carriage_screws_min.step stay closed on every Insert Design and STEP export path. The cause is one file-wide uncertainty, set from the loosest body…
Out of Scope Changes check
All changed code relates to the linked issue. The writer change in product.rs implements the per-body accuracy contexts. Its helpers accuracy() and context() and the updated module documentation s…
Existing Defaults Unchanged
The check fails only if the PR changes a UX default: a default setting or preference, usual command behaviour, UI layout or behaviour, or a shortcut. The PR changes three files: `crates/engine/src/cmd…
Full details: Title check
Explanation
The title names the main change: STEP export now writes each body with its own accuracy, which stops Insert Design from opening a body beside a loose one. It is specific and matches the raw summary and objectives. It is long (21 words) and includes an issue number, but it is not off-topic or vague.
Full details: Description check
Explanation
The description follows the template. It has a Change section that explains the problem and behavior in plain words and links issue #17579. It includes the required 'Changes a default: no' line. It has Validation with expected and measured values. It has a Screenshots section with an embedded image. It has an Integration status section. The template's required 'Test change' line is not needed here, because the PR changes no existing test or golden expectation, and the description says 'Goldens moved: none.' The Change section does not define the terms 'SolidCraft' and 'SolidCore' for a newcomer, and it refers to #11997 without context. These are minor gaps. The description is mostly complete.
Full details: Linked Issues check
Explanation
[#17579] The requirement is that the three bodies of carriage_screws_min.step stay closed on every Insert Design and STEP export path. The cause is one file-wide uncertainty, set from the loosest body. The diff in solidcore/crates/solidcore-step/src/write/product.rs fixes this. accuracy() computes each body's own accuracy. A body whose accuracy is finer than the file's gets its own GEOMETRIC_REPRESENTATION_CONTEXT with that uncertainty (context(), cached per accuracy bit pattern). Bodies are grouped into runs that share a context, and the runs keep the reader's body order. The unit test each_body_is_written_in_a_context_of_its_own_accuracy checks the context per representation, the run order, and that uniform files keep one context. The reader already reads each representation in its own context, per the PR description. The author reports that the issue's attached STEP now reads back with closed screws (30 faces, 34.792 mm³ each) and an unchanged carriage. I did not re-run that case. The engine test insert_design_reads_each_body_at_its_own_accuracy_beside_a_loose_sheet is described in the PR but I did not inspect its source. The code change addresses the stated mechanism, so the coding requirement is met.
Full details: Out of Scope Changes check
Explanation
All changed code relates to the linked issue. The writer change in product.rs implements the per-body accuracy contexts. Its helpers accuracy() and context() and the updated module documentation support that change. The new test solids_by_context and the test each_body_is_written_in_a_context_of_its_own_accuracy verify it. The test each_body_reads_back_at_its_own_tolerance_in_order in crates/kernel/src/step_out.rs and the engine test in crates/engine/src/cmd/component_link.rs cover the same behavior through the reader and Insert Design. No unrelated functional change appears in the reviewed diff. Limitation: I reviewed only the product.rs diff and the PR summaries of the other two test files. The reported files-with-changes match the PR description.
Full details: Existing Defaults Unchanged
Explanation
The check fails only if the PR changes a UX default: a default setting or preference, usual command behaviour, UI layout or behaviour, or a shortcut. The PR changes three files: crates/engine/src/cmd/component_link.rs (test only), crates/kernel/src/step_out.rs (test only), and solidcore/crates/solidcore-step/src/write/product.rs (STEP writer). The writer change alters STEP output for files whose bodies differ in accuracy. That is a geometry/kernel result, and the check states that such changes, including anything under solidcore/, are not changed defaults. The keyword scan of the writer diff matched only Header::default() in new test code, not a user-facing default. No settings, preferences, UI, or shortcut files changed. The PR description's Changes a default: no is consistent with the diff. Equal-accuracy files are written byte for byte as before, so existing output is unchanged for those cases.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
…onger opens a body beside a loose one
The STEP writer stated one uncertainty for the whole file, the loosest
tolerance of any record, edge or vertex of any body (tangency-labs#11997). The reader reads
every solid at its representation's stated tolerance, and Insert Design brings
a design's bodies in through SolidCraft's own STEP. So one body with loose
edges (an imported lens whose edges read with 0.37 mm tolerances) made every
other body of the design be read back at that tolerance, and a native block
with a diagonal bore and an angled slot lost its bore face there and came back
open.
A body whose accuracy is finer than the file's loosest is now written in a
representation context of its own that states it. The bodies are written in
runs laid out so that SolidCraft's reader, which meets a product's linked
representations last written first, meets the bodies in the order it did
before (every sheet, then every solid, each in body order): a link update
keeps body names by position. A file whose bodies are all equally accurate is
written byte for byte as before.
Tests:
- solidcore-step write::product::tests::each_body_is_written_in_a_context_of_its_own_accuracy
- kernel step_out::tests::each_body_reads_back_at_its_own_tolerance_in_order
(before: the tight bodies read back at 0.3 mm)
- engine component_link::tests::insert_design_reads_each_body_at_its_own_accuracy_beside_a_loose_sheet
(a neutral block beside a sheet with 0.45 mm edges: 15 faces closed in its
design, 14 faces open after Insert Design before; 15 closed after)
The Native Linux tests failure in run 44121907557 is not from this change. The known-failing check reports one regression, solidcraft-ui-egui::home::tests::library_cache_identity_tracks_replacements_with_preserved_mtime. That is the ctime-granularity flake of #18333, which #18334 fixed. This run's merge commit is based on main at 47f714a, which predates the fix. The other 12 failures are all listed in tests/KNOWN_FAILING_TESTS. The three new tests are unaffected. Rebased locally on current main with no conflicts, and the home test passes there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
approved-for-ciReviewed: run the full PR CI (build, tests, goldens, Clippy)area:kernelB-rep kernel, booleans, blends, STEP/IGESready to mergereviewed, every ask addressed; merge once CI is green
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Insert Design brings a design's bodies into an assembly by writing them to SolidCraft's own STEP and reading it back. The STEP writer stated one accuracy for the whole file: the loosest tolerance of any record, edge or vertex of any body (#11997). The reader reads every solid at its representation's stated tolerance. So one body with loose edges made every other body of the design be read back at that tolerance, and a closed body could lose a face there and come back open. Examples:
Now a body whose accuracy is finer than the file's loosest is written in a representation context of its own that states its accuracy. The reader already reads each representation in its own context. The bodies are written in runs that keep the order SolidCraft's reader met them in before, because a link update keeps body names by position. A file whose bodies are all equally accurate is written byte for byte as before.
Fixes #17579
Changes a default: no
Validation
solidcore-step write::product::tests::each_body_is_written_in_a_context_of_its_own_accuracysolidcraft-kernel step_out::tests::each_body_reads_back_at_its_own_tolerance_in_order: on main the tight bodies read back at 0.3 mm.solidcraft-engine component_link::tests::insert_design_reads_each_body_at_its_own_accuracy_beside_a_loose_sheet: on main the block comes back with 14 faces, open.CI notes
Full CI ran on the fork (GitHub-hosted runners, with the WebAssembly and RISC-V checks): https://github.com/hazardandy/solidcraft/actions/runs/44019838620
tests/KNOWN_FAILING_TESTS. In solidcore, 8091 passed and 1 failed for want ofupstream/TestFiles.main's nightly run 43818772935.Screenshots of the behavior
The neutral block after Insert Design, looking into the diagonal bore. Left: 0.43.0, where the bore's wall is missing and the block is open (14 faces). Right: this branch, closed (15 faces, 12466.133 mm³). Captured with
solidcraft-cli snapshot.Integration status
mainat b412b6c (16 Nov 2026). Not rebased since.solidcore/crates/solidcore-step/src/write/product.rs. The change tocrates/engine/src/cmd/component_link.rsis a new test only. Open PRs Designs: an imported file's bodies can be kept as B-rep records instead of STEP text #16810, Assemblies: a link can keep a linked design's components as a linked subassembly, each occurrence rigid or flexible (#5526) #14860, Relink Source: choose to keep the existing names or take the new source's body names #16714 and Insert Design / Update Links: bodies hidden in the linked design come in hidden (#16506) #16507 also changecomponent_link.rs, but none of them change the STEP writer.Summary by CodeRabbit
Bug Fixes
Tests