Skip to content

solidcore: DXF geometry as general kernel maths, DXF checks in ops dxf::{import, export} (#21398) - #21542

Merged
tangency-repo-manager[bot] merged 10 commits into
tangency-labs:mainfrom
MarkusReichart:fix-21398-dxf-layers
Nov 25, 2026
Merged

tangency-repo-manager[bot] merged 10 commits into
tangency-labs:mainfrom
MarkusReichart:fix-21398-dxf-layers

Conversation

@MarkusReichart

@MarkusReichart MarkusReichart commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Change

Fixes #21398. Part of #21392.

Three kernel modules were named for the DXF code they came from. Their maths moves, unchanged, into modules named for what it computes; the DXF-facing ops API becomes solidcore_ops::dxf::{import, export}, as with STEP; every caller changes, with no aliases.

Before Kernel now Ops now
prism::path_export prism::arc_conversion dxf::export
prism::export_geometry (bounds) prism::bounds dxf::export
prism::export_geometry (scale, translate) prism::transform dxf::export
prism::import_geometry prism::transform, prism::arc_conversion dxf::import
DxfPath, DxfPathStyle PlanarPath, PathStyle PathStyle
import_geometry::chord_coordinates prism::transform affine::chord_coordinates
  • prism::arc_conversion also takes the checks on degree fields and centre/major/ratio ellipses (finite_degrees, ellipse_support and four more).
  • collapsed_coordinate, a comparison, becomes an ops function. The other checks use to_radians, hypot or float subtraction, which ops' lints refuse (docs/layers.md §4), so they stay in the kernel and ops re-exports them.
  • chord_coordinates serves the airfoil reader, so its ops entry is affine.
  • crates/io reaches them through solidcraft_kernel::services::dxf (main's path since Kernel: import and export call solidcore through SolidCraft's kernel interface #21853); services re-exports dxf in place of the three old modules.
  • crates/io keeps its own word, DxfPathStyle (70 uses, mostly tests), as pub use ...::PathStyle as DxfPathStyle.
  • Ops' bounds sit in a private dxf/export/bounds.rs, re-exported from dxf::export, so git sees each file as a rename.

No arithmetic changes, so no new test: the existing tests run under the new paths.

Why one PR: a move without aliases changes each definition and its callers together; most counted lines are functions moving between files.

Changes a default: no

Test change: no assertion changed; tests of moved functions use the new paths, and two test names drop the old module names.

Validation

At head 312c61e619 (upstream/main 9ef680c87e merged in): cargo xtask fast --base upstream/main --no-tests: "all checks passed".

At the previous head f03ef1bcff (upstream/main c56fe82505):

  • In solidcore/: fmt, cargo clippy --workspace --all-targets -- -D warnings, wasm and scripts/ci: pass.
  • Root: cargo xtask fast --base upstream/main --no-tests: "all checks passed".
  • cargo test -p solidcore -p solidcore-ops: 9505 passed, 0 failed, 75 skipped.
  • cargo nextest run -p solidcraft-io (DXF round trips, now through dxf::{import, export}): 1095 passed, 0 failed, 3 skipped.
  • cargo run --profile goldens -p goldens: goldens: 283 unit(s), 283 passed, 0 failed.
  • cargo deny check: pass.
  • git grep -E "import_geometry|export_geometry|path_export" over crates/, docs/, xtask/, solidcore/crates/ at 312c61e619: no hits.

Not run: the test suites of crates this change does not touch, doctests, publish dry run and the kernel rig, left to CI.

CI run 45528305825 at 3c8e763feb is red for two reasons outside this change. The fillets rig shard tested a CLI built on main b199ad8545 against the cases of main b6bed2ad52, where #20464 had re-derived every-pocket-rim-edges-r2, every-pocket-rim-edges-r5-as-deep-as-pocket and every-pocket-floor-and-rim-edges-r2 for the new Auto turn (the older CLI built the mitred corners, four faces fewer than each case now wants). craft-plugin-wasm native::tests::an_importer_says_a_valid_file_is_not_supported printed ok and then aborted with SIGABRT; that crate depends on nothing this change touches. The other 19 failed tests are on tests/KNOWN_FAILING_TESTS.

Units: none (a move; no kernel result changes)
In scope: the prism::{export_geometry, path_export, import_geometry} row of #21392: kernel modules renamed and split, ops dxf::{import, export}, callers in crates/io and solidcore-ops.
Out of scope: the other rows of #21392 (#21441 and #21525 take two of them).

Screenshots of the behavior (when observable)

Nothing is observable: modules and type names move, results don't.

Integration status

upstream/main 5acca8bf41 merged in: the crates/io conflicts from #21853 keep main's solidcraft_kernel::services path with our module names on it; b199ad8545 merges cleanly. upstream/main 9ef680c87e merged in at 312c61e619: only the module lists in crates/kernel/src/services.rs and solidcore-ops/src/lib.rs conflicted (main added paper_gaps; path_export stays out, it lives in dxf). Open PRs on crates/io/src/dxf*.rs (#18382, #18393, #19567, #20861, #21452) don't touch these calls.

Co-written and tested with Claude Code (AI).

Summary by CodeRabbit

  • Refactor
    • Updated how DXF geometry is handled during import and export, including coordinate conversion, shape checks, and bounds calculations.
    • Existing validation and error handling remain unchanged; no change to user-visible behavior is noted.
  • Tests
    • Updated regression coverage for geometry conversion and encoding checks.

… DXF rules in ops

Co-Authored-By: Claude Code <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

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.

Run configuration

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

Geometry helpers are reorganized into prism kernel modules and DXF-specific import and export modules. I/O call sites and tests use the new APIs. The described conversion, validation, and error-handling behavior remains largely unchanged.

Changes: DXF geometry and I/O

Layer / File(s) Summary
Generalize prism geometry APIs
solidcore/crates/solidcore/src/prism.rs, solidcore/crates/solidcore/src/prism/arc_conversion.rs, solidcore/crates/solidcore/src/prism/bounds.rs, solidcore/crates/solidcore/src/prism/bounds/bulges.rs, solidcore/crates/solidcore/src/prism/transform.rs, solidcore/crates/solidcore/src/prism/tests.rs
Prism APIs use generic planar-path types instead of DXF-named types. Bounds and transform helpers are organized in their own modules. Arc and ellipse validation helpers are added, and tests use the reorganized APIs.
Organize solidcore-ops APIs
solidcore/crates/solidcore-ops/src/dxf.rs, solidcore/crates/solidcore-ops/src/dxf/*, solidcore/crates/solidcore-ops/src/affine.rs, solidcore/crates/solidcore-ops/src/lib.rs, solidcore/crates/solidcore-ops/src/import_geometry.rs, solidcore/crates/solidcore-ops/src/tests.rs, solidcore/crates/solidcore-ops/src/blend.rs
The crate exposes DXF import and export modules that use prism APIs. Chord-coordinate conversion is added to affine, and the former geometry modules are removed. The chamfer scale-fit path uses the prism transform API.
Update import and chord-coordinate callers
crates/io/src/airfoil.rs, crates/io/src/dxf.rs, crates/io/src/dxf/text_entity.rs
Airfoil and DXF import callers use the affine and DXF import APIs for chord coordinates, scaling, ellipse support, and text validation.
Update DXF export callers
crates/io/src/dxf_out.rs, crates/io/src/dxf_out/file_model.rs, crates/io/src/dxf_out/file_model/bulges.rs, crates/io/src/dxf_out/file_model/geometry.rs, crates/io/src/dxf_out/path.rs
DXF export callers use the DXF export API for path conversion, geometry validation, bounds, transforms, scaling, and anchor transformation.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: Minimal · previous review f03ef

This reorganizes DXF geometry modules without changing behavior. No concrete merge-blocking risk was found; remaining checks such as doctests are left to CI.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names the main change: DXF geometry maths moves into general kernel modules, and DXF checks move into solidcore-ops dxf::{import, export}. The raw summary confirms the module renames, the ne…
Linked Issues check Passed Issue #21398 has three coding requirements, and the PR meets each one.

1. General maths in the kernel as prism::{bounds, transform, arc_conversion}: The kernel `solidcore/crates/solidcore/src/prism.r…
Out of Scope Changes check Passed All changed files relate to the module move the issue requests.

- Kernel renames and splits (prism/arc_conversion.rs, prism/bounds.rs, prism/transform.rs, prism/tests.rs): these carry the mov…
Description check Passed The description follows the template. It has a Change section that links issue #21398, states the module and API moves in a table, and gives the 'Changes a default: no' line. It includes a Test change…
Existing Defaults Unchanged Passed The check passes. The PR changes no UX default. Evidence: - The PR summary and the PR description describe a refactor. Modules and types move or rename: `prism::{path_export, export_geometry, import_g…
Full details: Title check

Explanation

The title names the main change: DXF geometry maths moves into general kernel modules, and DXF checks move into solidcore-ops dxf::{import, export}. The raw summary confirms the module renames, the new dxf::{import, export} ops modules, and the removal of import_geometry, export_geometry, and path_export. The title is 97 characters, slightly long, and uses an issue-tracker style prefix, but it describes a real, specific change.

Full details: Linked Issues check

Explanation

Issue #21398 has three coding requirements, and the PR meets each one.

  1. General maths in the kernel as prism::{bounds, transform, arc_conversion}: The kernel solidcore/crates/solidcore/src/prism.rs declares these modules and removes export_geometry, import_geometry and path_export. Bounds, affine transform and arc conversion code moved there unchanged in arithmetic.
  2. DXF rules in ops as dxf::{import, export}: solidcore-ops adds pub mod dxf with import and export submodules. dxf::import holds scale_point, collapsed_coordinate and ellipse_support. dxf::export holds the bounds, transform and admission entry points. The PR keeps finite_degrees and ellipse_support in the kernel, and docs/layers.md §4 bans hypot, to_radians and similar calls in ops. So the kernel keeps the arithmetic checks, and ops re-exports them. This is a justified split under the repository layer rules, not a gap.
  3. Done-when criteria: crates/io callers (dxf.rs, dxf_out.rs, dxf_out/file_model/*, airfoil.rs) switch to solidcore_ops::dxf::{import, export} and affine::chord_coordinates. The old ops modules are deleted. No kernel module is named for a file format. The reported run of 1095 passing solidcraft-io DXF round-trip tests is in the PR description. I did not re-run it. Its result rests on the author's report.

No non-coding requirements apply.

[#21398] [#21392 scope: prism::{export_geometry, path_export, import_geometry} row]

Full details: Out of Scope Changes check

Explanation

All changed files relate to the module move the issue requests.

  • Kernel renames and splits (prism/arc_conversion.rs, prism/bounds.rs, prism/transform.rs, prism/tests.rs): these carry the moved maths. Type renames (DxfPath to PlanarPath, DxfPathStyle to PathStyle, DxfShape to PathShape) follow from removing the file-format names.
  • Ops files (dxf.rs, dxf/export.rs, dxf/export/bounds.rs, dxf/import.rs, blend.rs, lib.rs, import_geometry.rs deleted, tests.rs): these carry the ops side of the split and the caller update (blend.rs uses prism::transform::scale_value).
  • solidcore-ops/src/affine.rs gains chord_coordinates: this moves the airfoil reader helper out of the deleted import_geometry module. The PR gives this reason.
  • crates/io callers and crates/io/src/dxf/path.rs (DxfPathStyle as a re-export of PathStyle): the PR states this alias is the crate's own name. It is not a kernel or ops alias.
  • Test edits: they change only paths and two test names. No assertion changes are reported in the summary.

No change adds unrelated behaviour. The summary shows no arithmetic change in the moved functions.

Full details: Description check

Explanation

The description follows the template. It has a Change section that links issue #21398, states the module and API moves in a table, and gives the 'Changes a default: no' line. It includes a Test change line that explains why no assertions changed. Validation lists commands, results, and measured counts at specific commit heads. The screenshot section explains why no observable behavior exists, which the template allows for changes with no useful observable behavior. The integration status section records upstream commits, merge conflicts, and open PRs. The description is thorough. Minor gaps: the Change section opens with the issue reference and the table, not a plain-words summary for a newcomer, and the title line is absent from the description body (the title is set separately).

Full details: Existing Defaults Unchanged

Explanation

The check passes. The PR changes no UX default. Evidence: - The PR summary and the PR description describe a refactor. Modules and types move or rename: prism::{path_export, export_geometry, import_geometry} become prism::{arc_conversion, bounds, transform}. Ops modules become dxf::{import, export}. DxfPath/DxfPathStyle become PlanarPath/PathStyle. The author states "No arithmetic changes" and "Changes a default: no". - The changed crates/io files (dxf.rs, dxf_out.rs, airfoil.rs, text_entity.rs, file_model*, path.rs) only change import paths and call sites. None of the summaries show a changed default value, preference, shortcut, layout, or command behaviour. - The solidcore/ changes are kernel-side. Under the check's terms they are not UX defaults, even where they change internal validation helpers. The Changes a default field of the description matches the code. - Each change is a rename or move. Nothing is removed from user-facing behaviour, and the PR adds no new default. - Limitation: the local main is not an accurate merge base for the PR branch. A local git diff main...HEAD covers about 2,600 files, so I could not isolate the PR diff by git. I relied on the PR summary and description, which describe only the module moves above. The conclusion rests on those descriptions.

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between c56fe82 and f03ef1b.

Files selected for processing: 23

  • crates/io/src/airfoil.rs
  • crates/io/src/dxf.rs
  • crates/io/src/dxf/text_entity.rs
  • crates/io/src/dxf_out.rs
  • crates/io/src/dxf_out/file_model.rs
  • crates/io/src/dxf_out/file_model/bulges.rs
  • crates/io/src/dxf_out/file_model/geometry.rs
  • crates/io/src/dxf_out/path.rs
  • solidcore/crates/solidcore-ops/src/affine.rs
  • solidcore/crates/solidcore-ops/src/blend.rs
  • solidcore/crates/solidcore-ops/src/dxf.rs
  • solidcore/crates/solidcore-ops/src/dxf/export.rs
  • solidcore/crates/solidcore-ops/src/dxf/export/bounds.rs
  • solidcore/crates/solidcore-ops/src/dxf/import.rs
  • solidcore/crates/solidcore-ops/src/import_geometry.rs
  • solidcore/crates/solidcore-ops/src/lib.rs
  • solidcore/crates/solidcore-ops/src/tests.rs
  • solidcore/crates/solidcore/src/prism.rs
  • solidcore/crates/solidcore/src/prism/arc_conversion.rs
  • solidcore/crates/solidcore/src/prism/bounds.rs
  • solidcore/crates/solidcore/src/prism/bounds/bulges.rs
  • solidcore/crates/solidcore/src/prism/tests.rs
  • solidcore/crates/solidcore/src/prism/transform.rs
Files with no reviewable changes: 1

  • solidcore/crates/solidcore-ops/src/import_geometry.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

MarkusReichart and others added 2 commits November 24, 2026 09:44
…f::{import, export} (tangency-labs#21398)

The kernel's prism::{export_geometry, path_export, import_geometry} become
prism::{bounds, transform, arc_conversion}, with DxfPath and DxfPathStyle
renamed PlanarPath and PathStyle. The ops modules export_geometry,
import_geometry and path_export become dxf::{import, export};
collapsed_coordinate, a comparison only, moves to ops. chord_coordinates
(the airfoil reader) is ops affine::chord_coordinates. Callers in
crates/io and ops blend switch over. No arithmetic changes.

Co-Authored-By: Claude Code <noreply@anthropic.com>
…e checks use

Co-Authored-By: Claude Code <noreply@anthropic.com>
Conflicts: solidcore-ops affine.rs (main's same_sense beside chord_coordinates)
and solidcore prism.rs (main's gusset module beside the renamed modules).

Co-Authored-By: Claude Code <noreply@anthropic.com>
@MarkusReichart MarkusReichart changed the title [WIP] solidcore: DXF geometry as general kernel maths, DXF checks in ops dxf::{import, export} (#21398) solidcore: DXF geometry as general kernel maths, DXF checks in ops dxf::{import, export} (#21398) Nov 24, 2026
MarkusReichart and others added 2 commits November 24, 2026 14:09
Conflict: solidcore prism.rs (main's member module beside the renamed modules).

Co-Authored-By: Claude Code <noreply@anthropic.com>
Conflict: solidcore-ops lib.rs (main's hole_stacks module beside the removed import_geometry).

Co-Authored-By: Claude Code <noreply@anthropic.com>
@MarkusReichart
MarkusReichart marked this pull request as ready for review November 24, 2026 16:40
@MarkusReichart
MarkusReichart requested a review from a team as a code owner November 24, 2026 16:40
@MarkusReichart
MarkusReichart requested review from bherbruck and removed request for a team November 24, 2026 16:40
@bherbruck bherbruck added the approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) label Nov 24, 2026
@bherbruck

Copy link
Copy Markdown
Collaborator

Thanks for this. It now conflicts with current main, mostly from #21853, which routes import and export through the kernel interface. GitHub runs no CI on a conflicting PR. Here's where it conflicts:

git fetch https://github.com/tangency-labs/solidcraft.git main
git merge FETCH_HEAD
# resolve the files above, then
git add -A && git commit --no-edit && git push

Co-Authored-By: Claude Code <noreply@anthropic.com>
@MarkusReichart

Copy link
Copy Markdown
Contributor Author

Thanks, @bherbruck. Merged upstream/main (5acca8bf41) in as 3c8e763feb, no force-push.

  • The eight crates/io files you listed (airfoil.rs, dxf.rs, dxf/text_entity.rs, dxf_out.rs, dxf_out/file_model.rs, dxf_out/file_model/bulges.rs, dxf_out/file_model/geometry.rs, dxf_out/path.rs) keep main's solidcraft_kernel::services path from Kernel: import and export call solidcore through SolidCraft's kernel interface #21853, with this PR's module names on it: services::dxf::{import, export} and services::affine::chord_coordinates.
  • crates/kernel/src/services.rs re-exports solidcore_ops::dxf in place of export_geometry, import_geometry and path_export, and the io row of the table in docs/design/kernel-layer.md names the new items.

Check at 3c8e763feb: cargo xtask fast --base upstream/main --no-tests gives "all checks passed". git grep finds no uses of the three old module names left. Tests are left to CI.

Written with Claude Code (AI) on behalf of @MarkusReichart.

@bherbruck

Copy link
Copy Markdown
Collaborator

Heads-up, this is on us: main just moved SolidCraft's kernel calls behind its own kernel interface, so this branch no longer compiles once merged with main. The fix is mechanical: merge main, then change solidcore_ops::X to solidcraft_kernel::services::X (same names; solidcore_tess:: → solidcraft_kernel::services::tess::, solidcore_step:: → solidcraft_kernel::services::step::). If something you need is missing from services, say so here and we'll add it. If you'd rather we make the change on a branch for you, just say so.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@bherbruck bherbruck added the ready to merge reviewed, every ask addressed; merge once CI is green label Nov 25, 2026
bherbruck and others added 2 commits November 25, 2026 02:28
…r, drop the re-export

Co-authored-by: MarkusReichart <52602624+MarkusReichart@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bherbruck

Copy link
Copy Markdown
Collaborator

Merged main. Main re-exported solidcore_ops::import_geometry from the kernel services, but this PR moves those helpers into the DXF reader and deletes that module, so I dropped the re-export (nothing else uses it). cargo check on kernel, io, engine and doc with tests is clean.

@tangency-repo-manager
tangency-repo-manager Bot merged commit 4b3bcb7 into tangency-labs:main Nov 25, 2026
65 checks passed
@MarkusReichart
MarkusReichart deleted the fix-21398-dxf-layers branch November 25, 2026 08:59
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) 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.

DXF geometry: general maths in the kernel, the DXF rules in ops

2 participants