Status: approved by the owner in full. He approved phase 1, the seam (§12), on 2026-11-24, and on 2026-11-26 every later phase of §12 as well: "I asked for it". Phase 1 is the kernel interface in SolidCraft, the solidcore adapter behind it, and SolidCraft calling the kernel only through that interface. No second kernel is planned or being built. On 2026-11-28 he amended the body format: "basically if solidcore is deleted it should still work". A body now lives in its own kernel's form, and the record is an exchange format only (§3; the stages are in §12). The later sections describe what the seam must allow, so that the interface is right the first time; they are not a plan to add another kernel.
The problem today. App code reaches straight into solidcore's B-rep structs: about 3,430 references across 14 crates. That has three costs:
- Any other kernel's body has to be converted into solidcore's format after every operation.
- A refactor inside the kernel breaks app code.
- "Any kernel can plug in" isn't really true yet.
The goal. If solidcore were deleted, SolidCraft should still build and run on another kernel. I want high cohesion and low coupling:
- each kernel owns its own bodies;
- the app talks to a kernel only through
kernel-api.
What it buys us.
- A stable, versioned kernel contract. That pushes solidcore to be stable too.
- solidcore stands on its own. It can be tested and refactored without the app in the way.
- "Does it run on SolidCraft" becomes real. A kernel plugs in through an adapter and is tested on the same cases as solidcore.
- No conversion on every operation. A body stays in its own kernel's form.
The risks, and how we guard against them.
- Naming and history is the riskiest stage. The guard is the full rig and the naming corpus, plus reopening real saved designs before and after each change, with identical results.
- The API could copy solidcore's quirks. The guard is a stub kernel: every call must be something it can implement cleanly.
- The extra layer costs a little. The guard is measuring that cost at every stage, and solidcore's own path stays at zero conversions.
What changes for contributors.
- No new direct solidcore imports in app crates. A CI check enforces it
(
xtask/kernel-coupling.txt, checked bycargo xtask layers). The list only shrinks: when you remove uses,cargo xtask layers --kernel-coupling-shrinkupdates it. - Kernel geometry still goes in solidcore. App code reaches it through
kernel-api. - Existing code isn't blocked. It moves over stage by stage (§12).
- Saved designs keep working. The timeline stays the source of truth, so any kernel replays it (§3).
The owner's brief (2026-11-24):
solidcore/ops is the solidcore one... then we have one in SOLIDCRAFT NOT SOLIDCORE that is where the kernel can be selected, then we make things that can adapt kernels to that abstraction.
Later the same day the owner added these requirements:
- the kernel is chosen at compile time: build features decide which kernels are compiled in; choosing among them at run time comes later, not now;
- SolidCraft must use
solidcore-opsfully, and only through the solidcore adapter.
What follows from that:
- solidcore stays an independent, app-agnostic kernel.
solidcore-opsis solidcore's own operations API. It gains no trait, no "backend" and no SolidCraft type. Work this design asks of solidcore is new app-agnostic operations insolidcore-ops. Each one is documented and goes in its ownsolidcore/pull request (§10). - Speed and features keep being fixed inside solidcore. This layer is not a way around solidcore's slow cases or missing features. Those are solidcore's to fix, in solidcore, and that stays the kernel work's focus. Nothing here moves effort away from it.
- SolidCraft owns the interface. One trait, in
crates/kernel-api, says what SolidCraft needs from a kernel.crates/kernelis the router behind it. - We maintain exactly one adapter: solidcore's. It adapts
solidcore-opsto the interface. We write it and keep it in SolidCraft, and it is the default. - SolidCraft carries no compatibility layer for other kernels. If anyone else wants their kernel in SolidCraft, they write and maintain its adapter to our interface. To count, it must pass our naming gate and an accuracy gate with a tolerance equal to or tighter than solidcore's (§8), and it is listed in the kernel support matrix (§8). None is planned.
- The solidcore adapter is the only SolidCraft code that depends on solidcore crates. Since
2026-11-28 there is no exception for the record's data types either (§3, §10): SolidCraft must
build and run with solidcore deleted.
cargo xtask layersenforces this, as it once kept truck insidecrates/kernel. This also helps solidcore: every call SolidCraft makes goes throughsolidcore-ops, so its public API ends up complete and documented, which is what makes solidcore usable as a general kernel. - Kernels are chosen at compile time. Build features decide which kernels are compiled in. solidcore is in every build we ship, and is the only one in them. A build without it still compiles, with a stub kernel in its place (§3). Choosing a kernel at run time, and swapping one while the app runs, come later, not in phase 1.
- STEP stays in solidcore. Import and export are solidcore's, reached through
solidcore-ops. - solidcore stays the default, and the default path stays byte-identical to today.
Decisions the owner has made. The rest of this document follows them; the open questions are in §13.
| Date | Decision |
|---|---|
| 2026-11-24 | The abstraction is SolidCraft's, not solidcore's. solidcore-ops stays solidcore's own app-agnostic API, and the trait and the router live in SolidCraft (§1). |
| 2026-11-24 | SolidCraft uses solidcore-ops fully, and only through the solidcore adapter. In the end state the adapter is the only SolidCraft code that depends on solidcore crates, and cargo xtask layers enforces it (§10). |
| 2026-11-24 | Kernels are chosen at compile time, by build features. Features decide which backends are compiled in. solidcore is always compiled in; every other backend is off by default. The launch-time switch (SOLIDCRAFT_KERNEL, SOLIDCRAFT_KERNEL_ROUTE, --kernel) picks only among the backends compiled in (§8). Hot swap is not in v1: changing kernels takes a restart (§11). |
| 2026-11-24 | solidcore is the default backend, and the default path stays byte-identical (§4). |
| 2026-11-24 | Build it: phase 1 only. Phase 1 is the seam: the crates/kernel-api trait, crates/kernel as the router, the solidcore adapter, and SolidCraft moved to call the kernel only through it, with a check that fails on new direct uses of solidcore outside the adapter. No second kernel (§12). |
| 2026-11-24 | We write and maintain the solidcore adapter, and only it. It adapts solidcore-ops, solidcore's own API, and lives in SolidCraft. Anyone else writes and maintains their own kernel's adapter to our interface; it must pass our naming gate and an accuracy gate (tolerance equal to or tighter than solidcore's) and appear in the support matrix (§8). |
| 2026-11-24 | Run-time selection comes later. In phase 1, build features alone decide which kernels are compiled in, and solidcore is the only one. The launch-time switch, per-operation routes and hot swap described below are later work. This supersedes the launch-time switch in the compile-time decision above. |
| 2026-11-24 | STEP stays in solidcore (§2, §10). |
| 2026-11-28 | A body lives in its own kernel's form; the record is an exchange format only. "Basically if solidcore is deleted it should still work": high cohesion, low coupling. The app holds an opaque handle and talks to a body only through kernel-api. Only the composition root names a concrete kernel. Save files stay kernel-neutral. Kernel-specific geometry lives in its kernel, and generic maths in a kernel-neutral crate. This replaces "the record is the body format" in §3 and §10, and answers §13 question 1. The stages are in §12, and the acceptance test is in §3. |
| 2026-11-26 | Build all of it. Every later phase of §12 is approved too (steps 6 to 16: smlib onto solidcore-ops, the adapter split, sweep and loft in the trait, exchange, measurement, run-time selection and designs recording their kernel). Each step still follows §12's rules. Still no second kernel. |
Contents: 0. Decisions
- Where the abstraction lives
- The trait surface
- Bodies and the exchange format
- Naming
- Designs record their kernel
- Errors
- Checks
- Selection, routing and measurement
- Performance and binary cost
- solidcore only through ops, only through the adapter
- Switching kernels with a design open
- Migration
- Risks and open questions
crates/kernel(solidcraft-kernel) is already the app's kernel boundary. Its crate doc says no solidcore type appears in its public API, "so the kernel can be replaced without touching the rest of the workspace".- But it isn't the only door. Thirteen other SolidCraft crates depend on solidcore crates
directly (§10). Two of them,
crates/smlibandcrates/geom, reach the kernel crate itself throughxtask/solidcore-seam.txt. - Every operation already runs on the record and comes back as one. A
Bodyis its schema 4 record (solidcore_record::brep::Brep, in canonical order). The solidcore forms (Body::smlib,Body::ops) are caches built from that record on first use. - The adapter pattern already exists.
crates/kernel/src/offset_backend.rsandsmlib_boolean.rsalready do what an adapter must do:- send the record in, tagging each face and edge with its record index;
- run the operation;
- read the tags back as an exact
History; - renumber the result into the record's order.
- The surface is large. On
origin/mainthe app uses about 322 distinctsolidcraft_kernelitems from outside the crate, in roughly 2,990 qualified references.Bodyhas about 95 public methods, about 85 of them called from outside.
| Crate | Holds | Depends on |
|---|---|---|
crates/kernel-api (solidcraft-kernel-api, new) |
the Backend trait, OpKind, Route, Made, ExchangeLoss, BackendError, and the neutral input types (profiles, path segments, extents) |
the kernel-neutral value-type crate (§3) and thiserror, never a solidcore crate. Until stage 5 of §12 it still uses solidcore-record's data types |
crates/kernel (solidcraft-kernel, as now) |
the router: the same public functions as today, each picking its backend from the route; the Body type and its caches of backend forms; the record services' public face |
kernel-api, and each adapter crate (solidcore's always; the others behind features) |
crates/kernel-solidcore (new; today's solidcore code in crates/kernel and crates/smlib, moved) |
the solidcore adapter: impl Backend for Solidcore, plus every call SolidCraft makes into solidcore-ops, -tess and -step |
kernel-api, the solidcore crates |
crates/kernel-<name> (only if someone brings another kernel; none is planned) |
that kernel's adapter, written and maintained by whoever brings that kernel, not by us | kernel-api, that kernel |
- It would make a dependency cycle. An adapter implements the trait, so it depends on the
trait's crate. The router calls the adapters, so it depends on them. If the trait lived in
crates/kernel, the two would depend on each other. - It would also make
crates/kernelthe place every adapter reaches into. A trait in a small crate of its own gives each adapter only the contract it needs. crates/kernelonly shrinks. CONTRIBUTING ("Kernel work goes in solidcore/") says so. Here it shrinks to a router once the solidcore code moves tocrates/kernel-solidcore(§12, step 10).
- Callers don't change. Every caller already calls
solidcraft_kernel::fillet,boolean,extrudeand so on. Keeping the router behind those names means no call site in doc, engine or io changes for the router itself. - The only caller changes are the bypasses. Code that today reaches
solidcore-opsdirectly is switched tocrates/kernel's re-exports, one crate per pull request (§10).
crates/doccalls the kernel directly. About 55% of the distinct items it uses (most of the blend, sweep, loft, surface and edit calls) are used only from doc. A layer above doc would miss them.
The layer table in docs/architecture.md (L1) gains the new crates. cargo xtask layers enforces
these rules:
- adapters depend on
kernel-apiand their own kernel, never oncrates/kernelor on each other; - only
crates/kerneldepends on adapters; - only
crates/kernel-solidcoredepends on solidcore crates, the record included (§3, §10), once stage 5 of §12 is done. Until then, the kernel-coupling ratchet (xtask/kernel-coupling.txt, added in stage 0) freezes every app crate's solidcore dependencies and references, so they only fall.
The counts below come from a grep of qualified references outside crates/kernel on
origin/main. They cover solidcraft_kernel::X and the kernel::X alias that 14 doc files use.
They include tests and use lines, so they show how far each item reaches, not exact call counts.
| Family | Main items (references) | Called from |
|---|---|---|
| Primitives | box_solid 111, cylinder 43, sphere 10, torus 5, half_space 11 |
doc, engine, io, gpu, ui |
| Extrude, revolve | extrude 31, extrude_tapered(_between) 4, extrude_planar_regions 3, revolve 9, revolve_whole 1 |
doc, engine |
| Sweep, loft | sweep(_with) 4, sweep_helix(_radial) 3, sweep_point_path_with 2, loft* 7, loft_blend 2 |
doc |
| Booleans, split | boolean 55, BoolOp 37, planar_regions_boolean 25, union_all 4, union_apart 6, join_apart 4, split_* 7, trim_keep 3 |
doc, engine, io |
| Transform | transform_matrix 49, transform 5, place_matrix 4 |
doc, engine, io |
| Blends | fillet 4, fillet_* variants 14, chamfer_* 5, blend_edges 5, tangent_chain* 5, fit notes 20 |
doc, engine, ui |
| Offset family | offset_faces 6, shell 1, thicken 1, draft 2, draft_corners 3, offset_surface 3 |
doc |
| Surfaces | extend_surface 4, boundary_* 5, patch_* 3, ruled_surface_with 1, stitch/sew 4, untrim 1, match_surface 1, fair_faces 1 |
doc, engine |
| Direct edit | delete_faces, remove_faces, copy_faces, reverse_faces, repair 2 |
doc |
| Queries | measure 375, PointClass 212, measure_mass 29, face_surface 57, edge_circle 17, cylinder_face_at 16, body_distance 6, edge_distance 9, continuity 40+, combs 6 |
everywhere |
| Display | MeshTolerance 154, mesh_body 20, Paint 12, and Body::mesh* |
doc, io, engine, ui, gpu |
| Import, export | step_import* 25, step_export* 25, iges_* 13, records_import* 14, encode/decode_native_body 12 |
io, engine, cli |
| History, naming | history::{FaceOrigin, EdgeOrigin, Change} 13, FaceSource 57, Body::history 37, Body::face_sources 35, with_*_certificate 10 |
doc, engine |
| Checks | Validation 102, validity 4, check_kept 10, heals_tolerance_defects 14 |
doc, engine, io, cli |
| Errors | KernelError 87, ErrorCode 12 |
doc, engine, io, ui |
| Runtime | guard 22, map_on_threads 16, kernel_thread 8, for_each_on_threads 8, hold_a_kernel 6, Stop 6, start 3 |
all |
On top of these, the code that bypasses crates/kernel today (§10) calls about 60 more
solidcore-ops items, mostly 2D curve fitting, projection, hatching, affine maps and sheet
development.
-
Body-making operations take bodies or profiles and return new bodies with a
History. These are the trait, and they are routed per operation. -
Record services read a body's record and decide nothing about its shape: queries and measures, point classification and picking, tessellation, the validity check, and the 2D and curve helpers the bypasses use. STEP and IGES are treated the same way:
- They live in solidcore and stay there. Import and export are solidcore's
(
solidcore-step), reached throughsolidcore-ops, and this design doesn't move them. - They are shared only in one sense. A body made by another backend is exported by converting it to the record and running solidcore's STEP or IGES writer on that record. An imported body is read by solidcore, and another backend receives it as a record, like any other operand.
- In v1 they run on solidcore for every backend. A body made by another backend is a record like any other, so they work on it unchanged.
- This keeps the comparison fair: every backend's result is measured, meshed, picked and checked by the same code, so the comparison in §8 compares only what the backends made.
- It also keeps names comparable, because names are worked out from picks and measures.
- Individual services can join the trait later (a faster classifier, say), each as its own
OpKind, measured like any other. The record and spline services used bysolidcraft-geomlive incrates/kernel/services, a leaf of the adapter that depends only on the public SolidCore operations crate. The router depends on geom, so geom calls this leaf directly. Higher layers use the same services throughsolidcraft_kernel::services.
- They live in solidcore and stay there. Import and export are solidcore's
(
-
Runtime services: guard, threads and stop tokens. The router wraps every backend call in
guard, so a panic in any kernel becomesKernelError::Internal.
A backend states its support per kind, before any conversion: Support::Yes, No, or
Some(reason).
| Group | OpKinds in v1 |
Why these |
|---|---|---|
| Primitives | Box, Cylinder, Sphere, Torus, Cone |
about 170 references; easy to compare |
| Profile solids | Extrude (blind, between, tapered), Revolve (partial, whole) |
the most common features |
| Booleans | Boolean (union, subtract, intersect; one tool or many) |
55 references, and every cut |
| Blends | Fillet (constant radius, mitred corners), Chamfer (equal, two distances) |
36 corpus files use fillets, 15 use chamfers |
| Offset | Shell, Thicken, OffsetFaces |
13 corpus files use shells |
| Sweep, loft | Sweep (path), Loft (sections, rails) |
the remaining common solid features |
Transforms (rigid moves, mirror, scale) are not routed. They are exact maps of the record
(placement::moved). Routing them would gain nothing and would put names at risk.
Each comes later as its own OpKind, once v1 is measured:
- More blends: variable fillets (points, spline, chord, tapered); G2 fillets and corners;
setbacks;
fillet_removing; fit notes and largest-size answers (*_max_why). - More of the offset family:
draftanddraft_corners; lips (raise_band,rim_band); emboss. - Surfaces: boundary, patch, ruled, extend, trim and untrim, stitch and sew, match, fair.
- Direct edit and repair: delete, remove, copy and reverse faces;
repairandheal_tolerance_defects. - Record services that measure slow: classification, distance and rays.
- Swept volume of a solid:
Modelling::swept_volume, a body carried along a slide, a turn or a screw (SolidMotion). It is in the interface already; solidcore builds it and the other backends refuse it until they do, so it is not routed yet.
What follows is the shape, not the final code; step 2 of §12 settles the details.
/// One kernel, as SolidCraft uses it. Implemented by unit structs (`Solidcore`, and one per
/// other kernel if anyone brings one). The router holds them in a closed enum (§9).
pub trait Backend: Sized + Send + Sync + 'static {
/// The backend's own body: built from a record, cached on `Body` (§3), shared by clones.
type Form: Send + Sync + 'static;
/// The stable name `SOLIDCRAFT_KERNEL`, route files and design files use.
const ID: BackendId;
/// What cache keys and design files record: the kernel's version and a digest of its
/// sources, so a different build of the same kernel is told apart.
fn version(&self) -> &'static str;
/// Whether this backend takes `op` on these operands at all (a record kind it can't hold, a
/// tolerance it can't keep). Asked before any conversion.
fn supports(&self, op: OpKind, operands: &[&Brep]) -> Support;
/// Record in: the form, and the map from record indices to the form's entities.
fn import(&self, record: &Brep) -> Result<(Self::Form, Order), BackendError>;
/// Form out: a record in canonical order, the map from the form's entities to it, and what
/// the conversion couldn't carry exactly (§3).
fn export(&self, form: &Self::Form) -> Result<(Brep, Order, ExchangeLoss), BackendError>;
fn primitive(&self, p: &Primitive) -> Result<Made<Self::Form>, BackendError>;
fn extrude(&self, p: &Profile, e: &Extent) -> Result<Vec<Made<Self::Form>>, BackendError>;
fn revolve(&self, p: &Profile, axis: &Axis2, angle: f64) -> Result<Vec<Made<Self::Form>>, BackendError>;
fn boolean(&self, op: BoolOp, a: &Self::Form, tools: &[&Self::Form]) -> Result<Option<Made<Self::Form>>, BackendError>;
/// `edges` are record edge indices of `body`, resolved by the router (§4), never points.
fn fillet(&self, body: &Self::Form, edges: &[usize], radius: f64, turn: FilletTurn) -> Result<Made<Self::Form>, BackendError>;
fn chamfer(&self, body: &Self::Form, edges: &[usize], sides: ChamferSides) -> Result<Made<Self::Form>, BackendError>;
fn shell(&self, body: &Self::Form, open: &[usize], thickness: f64) -> Result<Made<Self::Form>, BackendError>;
fn thicken(&self, sheet: &Self::Form, distance: f64) -> Result<Made<Self::Form>, BackendError>;
fn offset_faces(&self, body: &Self::Form, faces: &[usize], distance: f64) -> Result<Made<Self::Form>, BackendError>;
fn sweep(&self, p: &Profile, path: &[PathSeg], c: &SweepControl) -> Result<Made<Self::Form>, BackendError>;
fn loft(&self, sections: &[Section], rails: &[Rail], fit: RailFit) -> Result<Made<Self::Form>, BackendError>;
}
/// A result and its history, in the backend's own entity ids. The router renumbers both into the
/// exported record's order (§4).
pub struct Made<F> {
pub form: F,
pub history: BackendHistory,
}Three choices in this shape:
- Operands are the backend's own forms. The router converts each body once and caches the form (§3), so a run of operations on one backend converts once at each end, not once per operation.
- Edges and faces go in as record indices. The app picks edges by points
(
fillet(body, &[Vec3], r)). The router resolves those points with the shared record services, exactly asblend_edgesdoes today, and passes every backend the same indices. A backend never interprets a pick, so a pick can't land on a different edge because another kernel splits or orders edges differently. - The app's input types move to
kernel-api. These arePlane,Region2,Loop2,PathSeg,SweepControl,FilletTurn,ChamferSideand so on.crates/kernelre-exports them under their old paths.
Phase 1 has one kernel, so it builds the parts of this shape that the seam needs and no more:
- The operations take the inputs the app passes today: points for picked edges and faces, a plane and regions for a profile. Resolving picks to record indices belongs with the exchange (§12, step 12), where it first matters; until then the solidcore arm stays the exact call it is today.
- Each backend has its own error type, mapped to and from
BackendError. solidcore's isKernelErroritself, so the words a user sees can't change; another kernel's errors reach the app throughBackendError. - Sweep and loft join the trait later (§12, step 11):
PathSegandSweepControlcompute lengths and tangents of their own, so they can't move into a data-only crate yet.
The owner, 2026-11-28: "basically if solidcore is deleted it should still work". He wants high cohesion and low coupling. This section was first written with the record as SolidCraft's body format. It now says where a body lives, and keeps the record as the exchange format.
-
The body is its kernel's own representation. A body solidcore made is a solidcore body. A body another kernel made stays in that kernel's form. Nothing converts it while it is shown, picked, named, measured or saved, unless its kernel declines the question.
-
The app holds an opaque handle.
solidcraft_kernel::Bodywraps the kernel's form behind a handle. App code never reads the form's insides: norecord(), no face or edge arrays, no kernel types. -
The app talks to a body only through
kernel-apitraits. These are the families:Trait What it answers Modelthe modelling operations: today's Modellingfamily, and the extensions as they are routedQuerytopology; picks (ray, closest, classify); measure (mass, bounds, distance); face and edge evaluation and kinds Tessellatethe display and export mesh, and the display plan where the kernel has one Namethe operation's history in the kernel's own ids, which the router renumbers into canonical order (§4) Storeserialising and deserialising a body for the cache, tagged with the kernel and its version optional extras hidden-line drawing, section, and others as they come. A kernel without one answers Support::No, and the router falls back (below)The names are the target shape. Today's traits (
Modelling,Queries,Tessellate,Points,Sectionsand the rest) fold into them stage by stage (§12, "Decoupling stages"). -
Ids stay canonical. A kernel's own face and edge ids never reach names. The router renumbers them into a canonical order, so the naming rules in §4 hold whichever kernel made the body.
The record (solidcore_record::brep::Brep) and ExactBody are how a body crosses a boundary,
and nothing more. A body is converted into one of them in three places:
- on export: STEP, IGES and CADIR writing, which are solidcore's (§2);
- on fallback to another kernel: an operation or query the body's kernel declines runs on a kernel that takes it, and the body crosses once, as an exact body or a record (below);
- for the cache: only where a kernel has no
Storeof its own. The cache entry is then the record's encoding, tagged with the kernel and version like any other entry.
Each conversion is counted per call site, so the rig shows what each stage still converts (§12).
- The app binary's entry point is the composition root. It is the one place that names a concrete kernel. It builds the router with the kernels compiled in and hands it to the app.
- Nothing else names one. doc, engine, io, ui-egui and the other app crates see
kernel-apiand the router'sBodyhandle only. They never name solidcore, its crates or its types. - A kernel is a build feature of the composition root. solidcore is the default kernel and the one we ship. A build without it still compiles, with a stub kernel in its place (below).
- The timeline is the source of truth. A design file holds the feature history, which names no kernel and holds no kernel ids. Any kernel replays it.
- The cache is tagged with its kernel and version. A cached body is its kernel's own
serialised form (
Store), with that kernel's id and version (§5). - A missing kernel or another version replays. When the tag is unknown, or that kernel isn't compiled in, the design replays its timeline. It never refuses to open.
"One implementation in solidcore" now reads:
- Kernel-specific geometry lives in its kernel. A body's topology, surfaces and curves, and the
maths of blends, booleans and the other operations, are solidcore's, in
solidcore/, with one implementation each. - Generic maths goes in a kernel-neutral crate. These are value types and maths with no
topology:
Vec3,Vec2,Plane,Seg2/Loop2/Region2, the mesh data shape (positions, normals, triangles,tri_face, edge polylines), and the per-feature data. They are defined once, in a crate that belongs to no kernel, and both the app and solidcore depend on it. They are not copied into a SolidCraft version, which would be a second implementation of one job. - A feature's maths is the app's. Maths on plain values one feature owns (a cell grid's layout
in a sketch region, hole spacing, frame member lines, a tube cope's template, a shaft spline's
teeth, a flat pattern) lives in that feature's SolidCraft crate (
crates/feature-*). It is not a kernel job and not akernel-apifamily, so no second kernel re-implements it; it hands the kernel bodies, curves or surfaces only to build or cut, throughkernel-api. A feature crate depends on nosolidcore*crate: its plain values arecad-values', and the maths several features share is SolidCraft's own, incrates/math, which no kernel depends on either. Each side keeps its own maths, so a kernel behind the interface needs none of ours. - The rule for new code: if it computes on a body, its curves or its surfaces, it goes in the kernel. If it is one feature's maths on plain values, it goes in that feature's crate. If it is plain-value maths the kernel needs too, it goes in the neutral crate.
- Three cases the rule decides, so nobody decides them again (owner, 2026-12-02):
- A dome is a kernel operation. It builds a face over a body's own face, on that face's surface and boundary, so it computes on a body. It lives in solidcore behind a general entry, and the plastic feature calls it; the feature keeps what it chooses (which face, how high).
- A weld bead is a blend. Its face is set by its two legs on two faces of a body, as a round's is by its radius, so its construction is solidcore's blend code, reached through the interface's foot blend entries. The weld feature keeps what is the feature's: weld symbol marks, lengths and spacing, and which edges get a bead.
- Mesh reconstruction is a feature. Recognising a mechanical part in a mesh and choosing
what to rebuild it as is
crates/feature-mesh-fit's. It is not a kernel operation and not an interface family; the kernel only builds the bodies it asks for.
The neutral crate is cad-values, at solidcore/crates/cad-values. Why there, and what it holds:
- It sits in the solidcore subtree only so the mirror stays whole. solidcore's own repository
builds on its own (
.github/workflows/solidcore-mirror.yml), and solidcore-record must name the same types, so the crate lives where both trees see it. It belongs to no kernel: it depends on serde alone, names no solidcore crate, and its name says nothing about solidcore. A build with the solidcore crates removed keeps it, as it keeps serde. - It holds plain values and computes nothing. Like the record, it has clippy's
disallowed-methodsban on square roots, trigonometry and the rest. A function that measures or builds goes in a kernel; maths on plain values that several kernels would share is a later decision, and until then stays solidcore's. - solidcore-record re-exports it under the record's own paths.
solidcore_record::Vec3andcad_values::Vec3are one type, so no caller changes when a type moves, and nothing converts.
What moves, one landable pull request each, with no path change for any caller:
- Values.
Vec2,Vec3,Plane,Seg2,Loop2,Region2and the Bézier limits. The operation metadata on profiles (BoundaryLoop,InputBoundary,RegionWithHistory,line_family) stays in the record for now. - kernel-api names the values from
cad-values. Itspub useof the value types comes from the neutral crate. App crates that use only values (the shared display crates, layer-0 crates that cannot depend on kernel-api) depend oncad-valuesinstead of solidcore-record, and their lines inxtask/kernel-coupling.txtfall. - Feature data leaves kernel-api; it does not come here. Feature and product maths is not
the kernel's (owner, 2026-12-01): sheet development and flat patterns, shaft splines, cams,
dogbones, weld marks, embossing, hole stacks, tube copes and frame members move out of
kernel-api into SolidCraft's feature crates, with their data types. They are not moved into
cad-values, which holds only values a kernel itself takes or gives (and the mesh shape), andHeldKernelgains no feature-level operation: only kernel operations (extrude, revolve, booleans, sweep, loft, blends, offsets, queries, tessellation, mass). - The exchange record's schema. The body record (
brep:Brep,Surface,Curve,Curve2, the history records) is exact data with no kernel inside (§3, "The record as the exchange format"), so its types move too. solidcore-record keeps what is solidcore's about it: structural validation, the native body file and the STEP model and parser. A schema change is still made in the solidcore tree, and still updates every adapter (as above). - kernel-api drops solidcore-record. Once the feature modules have left (step 3), its only
geometry dependency is
cad-values, and acargo xtask layersrule keeps it that way: kernel-api may depend on nosolidcore*crate.
Steps 1 and 2 change no type and no behaviour, so they need no rig or ladder run (gates: the naming corpus on solidcore and through the loopback, the app tests of the crates touched).
A build with solidcore removed, and a stub kernel in its place, compiles and runs the app's
non-modelling paths: start, open a design (it replays, reports the features the stub can't build,
and never refuses to open), sketch, parameters, the timeline, Preferences, save and close. The
stub kernel answers every operation with a typed Support::No (§6).
This is the exit test of stage 5 (§12). Until then, xtask/kernel-coupling.txt (checked by
cargo xtask layers) freezes every app crate's direct solidcore dependencies and its references
into solidcore crates, and lets them only fall.
When a body crosses, it crosses as a solidcore_record::brep::Brep, or as an exact body (below):
between two kernels, to a file, and into the cache of a kernel with no Store. It is schema 4,
kept in canonical order. Until stage 4 of §12 it is also what every body still carries, since
today Body is the record plus caches. That is the state the stages move away from, not the
target.
Why the record and not a new exchange format:
- It is what bodies are today. Every name, mesh and saved model is in the record's order. A second exchange format would be a second implementation of one job, which solidcore's layers.md §5 calls a bug. A solidcore body keeps its record as its own form, so the default path converts nothing (§9).
- It is exact data with no kernel inside. It holds:
- analytic surfaces (
Plane,Cylinder,Cone,Sphere,Torus); - B-splines and NURBS (
Spline,RationalSpline); - revolutions, as their producer holds them (
PlacedRevolution); - corner balls (
BallPatch); - blends by their definition plus a certified net (
Blend { definition }; seesolidcore/docs/definitions-and-certificates.md); - from the stages of screw-surface-record.md on, screw-swept walls
(threads, coils) by their definition (
Sweep { definition }); - pcurves, and tolerances per body, edge and vertex.
- analytic surfaces (
- Its validator gives one canonical order. Persistent names follow history in that order. Once a backend's history is renumbered into it, which kernel made the body doesn't matter (§4).
The cost is that the trait is tied to the record's schema. A record schema change in solidcore
becomes a change for every adapter, and that pull request updates them. An adapter refuses
(Support::No) a schema it wasn't built for.
This is today's path, while every body still carries its record. Stage 0 of §12 makes the record lazy, so a body another kernel made exports it only when something asks for it.
record (the Body) record (the result Body)
│ import, once per body per backend, cached ▲ export, once per result
▼ │
Body ──► Body.forms[backend] ──► backend op(s) ──► Made { form, history } ──► router: renumber
- solidcore forms stay as they are.
Bodykeeps them exactly as today (smlib,ops). - Other backends get one lazily filled slot. With any other backend compiled in,
Bodygainsforeign: Option<Arc<ForeignForms>>, holding one form per backend. The slot is cfg-gated, so a solidcore-only build has the very sameBodystruct as today. - A result keeps the form that made it. A solidcore result's
smlibcell is seeded when it is made, and another backend's result has its form set the same way. Two operations in a row on one backend convert the record in once and out once per result; the app needs each result's record anyway, for names and display. - Backends don't convert directly into each other. They always go through the record, so N backends need N adapters, not N².
A kernel that can't write the record's canonical order itself (its radial edge order, each
round face's NURBS form, its measured tolerances, seams on closed surfaces) crosses as an
exact body instead (solidcraft_kernel_api::ExactBody): vertices, edges on record curves,
faces on record surfaces with their bounds, and shells, in the kernel's own order, each face
and edge with the kernel's own id. Pcurves are optional per use. It is the input the record is
assembled from, not a second body format: solidcore assembles it with the one stage that
assembles every body read from a file (solidcore/docs/import-assembly.md), with no STEP on
the way, and keeps the pcurves the kernel holds instead of fitting them again.
- Out of solidcore:
Backend::import_exactgets each operand as an exact body (solidcraft_kernel::exact::exact_body) when the adapter saystakes_exact: round faces as the analytic surfaces they are, edges on conics bounded by their vertices, pcurves where they are in the given surface's own (u, v). - Into solidcore:
Backend::export_exactgives the result as an exact body with the operation's history in its own indices (ExactHistory). The router assembles it (solidcraft_kernel::exact::body_from_exact) and renumbers the history through the face and edge each record item came from. Where an edge can't be followed (the record's edges were rebuilt), the body comes back without history rather than with a guessed one. - Measured (
cargo run --release -p solidcraft-kernel --example exact_exchange), a thread as the thread feature makes it, out of solidcore and back: M20 × 2.5 (103 faces) 0.29 s by STEP against 0.13 s exact; M30 × 1.5 over 64 turns (453 faces) 1.34 s against 0.59 s. What is left is fitting the pcurves of helices on the core's cylinder, which has no closed form on the cylinder's NURBS form, on either path. - The OCCT adapter still crosses by STEP; moving it onto exact bodies is its own change.
What matters for naming and saving is the trip into the record. What matters for the backend's own results is the trip into the backend. The "another kernel" column is written from that kind of kernel's published design: one linear tolerance, analytic and NURBS geometry, and no procedural blend definitions. Its adapter pull request confirms it, case by case.
| Record → backend → record | solidcore | loopback (§12, step 12) | another kernel (illustration) |
|---|---|---|---|
| Plane, cylinder, cone, sphere, torus | exact | exact | exact, where it holds the same five in closed form; PlaneThrough gets its axes worked out from its three points (one rounding) |
Spline, RationalSpline |
exact | exact | exact, up to the backend's degree limit; a higher degree is Support::No |
PlacedRevolution |
exact | exact | exact as its surface of revolution, or as the exact rational form |
BallPatch |
exact | exact | exact as a rational net, but the "lies on this sphere" label is lost, so a later offset of it is no longer closed form |
Blend { definition } |
exact (S and B) | exact | the net B only, as a rational spline, and the definition S is lost. For an exact round, B is S: the geometry is exact but the class label is lost. For a procedural blend, B is within the certified ε. Back in solidcore it is a plain spline that is no longer re-certified as a round, so a later solidcore blend that rolls on it can differ. |
| Pcurves | exact | exact | rebuilt: affine where the backend has an affine pcurve, otherwise fitted within tolerance by the record's own pcurve routine, as every record pcurve off a plane is today |
| Tolerances per edge and vertex | exact | exact | lost where the backend holds one global tolerance. A record with looser edges is Support::No, so tolerant imports stay on solidcore. |
Face sources and certificates (FaceSource, with_*_certificate) |
kept | kept, through history | carried through history (BodyHistory::face_sources, §4); not re-proved by the backend |
| Backend → record | another kernel (illustration) |
|---|---|
| Analytic, B-spline and NURBS surfaces and curves | exact |
| Extrusion and ruled surfaces of rational curves | exact, as RationalSpline |
| Fitted intersection curves | exact, as the backend's own spline (the record takes it as it is) |
| Its blends | exact as RationalSpline where its sections are rational; no Blend definition |
| Face names or tags | read as history (§4), then dropped, because the record carries no names |
ExchangeLoss is the per-face report of each lossy row above that actually happened. The router
logs it and the rig (§8) counts it per case, so a pass that cost a definition shows as a loss,
not as a clean pass.
- History comes from the kernel. Each operation returns an exact
History(solidcore_record::brep::history). For every result face and edge, it gives the origins among the operands asFaceOrigin::{Face, Profile, Cap, Edge, Offset}, plus aChange, in record indices. - The document turns history into names.
crates/doccomposes histories along the timeline (lineage.rs) and turns them into names such asF5:side:l1andF2:top#[F2:side:l4,F4:side:l4](history_names.rs,naming.rs). It finds stored names again withname_lookup.rs. - Some names come from geometry. Faces with no exact history, and split pieces nothing around them tells apart, are named from geometry and marked unverified.
- Edges are named after their faces:
A|B, with~kwhere the same two faces meet more than once.
None of that changes. The history types are already kernel-neutral data in the record, and the
document never sees a kernel's ids. The naming rule of this design: every backend reports the
same History in record indices, or it doesn't take the operation.
This is the tag-and-read pattern that offset_backend.rs and smlib_boolean.rs already use with
solidcore.
- Tag. Before the call, every face and edge of every operand gets the tag
(operand, record index), in the backend's own provenance mechanism:- solidcore uses its attribute store (
solidcore_ops::history); - a kernel that carries face name sets through its edits (a split face keeps its names, a merged face takes the union) gets one synthetic name per face;
- a kernel that returns a per-operation history of its input faces is read from that.
- solidcore uses its attribute store (
- Run the operation.
- Read. Turn the tags each result face carries into origins:
- one tag:
Face { operand, face }, kept or modified; - one tag on several result faces:
Split; - several tags on one face:
Merged; - no tag: a generated face, named by the operation's own role. A profile segment gives
Profile { segment }, a cap givesCap { end }, a blend face givesEdge { operand, edge }(the record edge the adapter was given), and an offset copy givesOffset { operand, face }.
- one tag:
- Renumber.
exportreturns the map from the backend's entities to the result record's canonical indices. The router rewrites the history through it and checks it withBodyHistory::check: one entry per face and edge, and every origin in range. - Hand over.
Body::history()returns it as today, and the document names the body as today.
A backend that can't report a role exactly for an operation returns Support::No for that
OpKind. No adapter falls back to geometric naming. That fallback exists for old bodies and
imports, not to make a new backend easier to add.
A kernel that reshuffles its output (faces in another order, a face split differently, new ids on every rebuild) is the classic topological naming problem: names tied to a kernel's entities break when the kernel changes. This design defends against it in three ways:
- No name ever comes from a kernel id or an order. Names come only from the
Historyeach operation reports, in record indices, composed by the app (above). A backend that reorders faces changes nothing: its history is renumbered into the record's canonical order before the app sees it. - The naming gate is the defence. A backend takes an operation only if it reports a
Historythat gives identical verified names on every corpus design using that operation (rule 2 of §8, andNAMING_CORPUS_KERNEL). A backend that splits or merges faces differently fails that gate for that operation and is not routed for it. - Routing is deterministic. The route is fixed for the session and recorded in the design (§5). The same design therefore replays every operation on the same backend, and the same input to a backend must give the same topology and the same history. The rig checks this per backend: each case runs twice, and on two thread counts, and its records and histories must be byte-identical. The naming corpus already builds every design twice and compares. A backend whose output varies from run to run isn't routed for any operation.
On solidcore nothing changes: the same functions run in the same order and make the same records, so they produce the same histories and the same names.
| What differs | How it moves names | The answer |
|---|---|---|
| Topology granularity: a periodic face split in two, an extra vertex, coplanar faces merged differently | Two faces of F2:side:l4 become pieces #1/#2; an extra edge adds a ~k |
export normalises to the record's conventions: one face per periodic surface with a seam edge, same-domain faces merged as solidcore merges them, no valence-2 vertex on a smooth edge. This is record-level work, and the history is composed through it. |
| Blend corners: a ball patch in one kernel, setback patches in another | The corner faces' Edge origins differ |
A corner face's origins are the set of edges meeting there, so its name is set-based. A backend whose corner topology still differs fails the naming comparison for Fillet and isn't routed for it. |
| Unverified names: geometric fallbacks, and pieces numbered by place | They follow where faces lie | They are unstable by definition. The comparison (§8) reports them apart from verified names. Routing needs 100% of verified names to match. |
Face sources and certificates: FaceSource (Box, CertifiedExtrudeCap/Side, ShellPlanar, CylinderCap, Imported) and the with_*_certificate calls |
A certificate that assumes solidcore's face order would be wrong on another order | Certificates are carried by role through history, never by index (BodyHistory::face_sources). Each with_*_certificate call is audited in the pull request that routes its operation. |
These counts come from grepping feature kinds over the corpus sources on origin/main:
apps/solidcraft-cli/tests/corpus, examples/**, tests/action_matrix/designs, the engine
fixtures, the hole, taper and projection designs, and tests/oracle. The generated samples
aren't counted, and one design can appear in several rows.
| Risk | Designs (files) | Why |
|---|---|---|
| Low | designs built only from primitives, extrudes, revolves and booleans | few faces, and fully exact histories on both sides |
| Medium | fillet 36, chamfer 15, offset 14, shell 13, sweep 7, loft 10 | blend corners, offset roles and sweep caps are where topology and roles can differ |
| High | sheet metal 4, and any design with an unverified name on the default backend | sheet names ride on rules built for solidcore's topology (docs/design/sheet-metal-naming.md), and unverified names move with geometry |
| None in v1 | STEP and IGES imports, mesh bodies, transforms, pattern copies | not routed in v1 |
The real list comes from the first cross-backend run (§8). It prints one row per design: identical, verified names differ, only unverified names differ, or fails to build.
The default path must stay byte-identical: the same records, histories, names and saved models. That holds by construction and is checked on every pull request.
By construction:
- No solidcore operation changes in this series. The router's solidcore arm is the existing call.
- A solidcore-only build has one backend. The router's
matchhas one arm and folds away, and theSOLIDCRAFT_KERNELread isn't compiled in (§9). Body's layout doesn't change in a solidcore-only build. Itsforeignslot is cfg-gated.- Nothing new is stored on the all-solidcore route. Cache keys and
ErrorCodestay as they are, and design files carry nokernelfield when the route is all-solidcore (§5).
Checked in every pull request of §12:
- The naming corpus
(
cargo test --profile ci -p solidcraft-cli --test naming_corpus) is identical twice:- on the default build;
- on a build with an alternative backend compiled in but
SOLIDCRAFT_KERNELunset, which proves that compiling a backend in changes nothing.
- The app's tests for every crate the pull request touches pass, and NLT (Native Linux tests) shows no REGRESSION lines.
- The kernel rig and the ladder only when solidcore changes. The owner, 2026-11-30: "kernel
rig is for when the kernel changes". A pull request that moves app plumbing (the router, the
adapter's call sites, the held-body path) and changes no geometry in
solidcore/and nosolidcore-opsresult skips them. One that does change solidcore shows a rigresults.jsonidentical byte for byte to main's (an emptydiff) and the ladder'sgolden.jsonunchanged, as every kernel pull request does. - The loopback backend (§12, step 12) must give 180/180 identical names. Loopback is
solidcore forced through
export→importand tag-and-read history on every operation. It proves the exchange and the renumbering exact before any foreign kernel is involved.
Stage 1 (§12, "Decoupling stages") draws and picks a held body without its record. Stage 2 names
it without its record, and resolves saved names against it. Nothing about names moves into the
file: a saved name stays the string it is today (F5:side:l1, F2:top#[F2:side:l4,F4:side:l4],
A|B~k), and it resolves through the timeline's histories and the body's topology as today.
Only where that topology and those histories come from changes.
What the kernel gives. Two optional answers on HeldBody, both in the kernel's own ids:
topology(): regions, each a list of shells; each shell a list of oriented faces; each face its loops in the kernel's stored order, each loop its oriented edges; each edge its two vertices. Topology only, no geometry. This is the walk the record's canonical order is defined on (docs/native-brep.md, "Canonical order").- the op's history as
ExactHistory, which already exists for exact bodies (§3), over the operands' kernel ids.
A kernel that gives neither has the router read the record, counted, as in stages 0 and 1.
What the router does with them. It walks the topology in canonical order (regions, shells,
oriented faces, loops, oriented edges, vertices) and numbers faces, edges and vertices as they
are first met. That gives a map from the kernel's ids to canonical indices with no record and no
geometry. The walk is the same one that orders an exported record, so the numbers are the ones
the record would have. The router renumbers the history through the map, checks it as today
(BodyHistory::check: one entry per face and edge, every origin in range), and answers
Body::history(). Display and pick answers (stage 1) are renumbered through the same map, so
they no longer need the kernel to number its answers as its record does.
What the document reads. Today naming and lookup read record().faces[f].loops,
record().edges[e].uses and record().vertices (naming.rs, name_lookup.rs,
history_names.rs; about 25 sites). They move onto one kernel-neutral view, Body::topology():
faces with their loops of oriented edges, edges with their faces and vertices, all in canonical
indices. A solidcore body answers it by borrowing its record, with no copy and nothing new
computed, so its names cannot change. A held body answers it from the renumbered topology. Every
site keeps its order of iteration, so the strings it builds are byte-identical.
Geometric fallback names. Names made from geometry (faces with no exact history, pieces told
apart by place) already read the display mesh's tri_face. For a held body, that mesh comes from
the kernel (stage 1) and is renumbered like everything else. These names stay marked unverified,
as on solidcore.
What still reads the record after stage 2. Face certificates that read a face's surface
(with_*_certificate, FaceSource), the edge nearest a point (Body::edge_lines), and sheet
metal's role rules read geometry, not topology. They move with stage 3's queries.
Gates, on every stage 2 pull request:
- the naming corpus (180/180 identical) on solidcore, and again with the loopback kernel, which
holds every result as a held body that answers
topology()and its history and exports nothing unless asked: the proof that names come out identical without the record; - the app's tests for the crates it touches, and NLT with no REGRESSION lines (the kernel rig only when it changes solidcore, as above);
- real saved designs (the corpus's
.scfiles and the action-matrix designs) opened, rebuilt and saved before and after, with identical stored names and identical rebuilt bodies; - the record-read counter from stage 0, showing naming and lookup of a held body read no record.
A design opened on another backend must replay and report what changed. It must never quietly come out different.
The feature history is unchanged: it holds no kernel ids, and any backend replays it.
When a design is saved under a route other than all-solidcore, it adds one field, kernel:
"kernel": {
"route": { "fillet": "alt", "boolean": "solidcore" },
"versions": { "solidcore": "<version and source digest>", "alt": "<version and source digest>" },
"names": { "F3": "<digest of the face and edge names F3's bodies had>", "F7": "…" }
}routelists only the operations that weren't on solidcore.namesholds a digest of each feature's face and edge names as built. The full names are already in the saved model when the model cache is saved; the digest makes the comparison possible without it.- A missing
kernelfield means all-solidcore. Every design saved today, and every design saved on the default route afterwards, has no such field. Their bytes don't change, so the corpus's "opened and saved again is the same bytes" check still holds. - The field is a design-format change. It is one new file in
crates/doc/src/format/pending/, in the pull request that adds routing (§12, step 15).
When the running route differs from the one the design records, or from all-solidcore for a
design with no kernel field:
- The evaluation cache isn't reused. Its key includes the route, so the design replays in full. This is the same path as opening a design saved without a cache.
- Names are compared. After the replay, each feature's names are checked against the stored digest. Where a saved model exists, they are also checked against the saved names, face by face.
- A kernel differences report is shown. It uses the same channel as an import report, and
lists:
- features whose names differ;
- features whose face counts, volume or area moved past tolerance;
- features that failed on this backend but built on the recorded one.
- References fail as they do today. A stored name that no longer finds its face or edge fails its feature and asks for the reference to be picked again. Another kernel's face is never taken silently.
- The design is not rewritten. Saving afterwards records the route it was saved under.
So triage knows which kernel made a body, every report carries the route and the backend
versions. This covers the in-app bug report, a crash report, the system block a ticket gets, and
diagnostics.* over MCP.
- Always recorded, the default included. The field reads, for example,
kernel: { route: "all solidcore", versions: { solidcore: "<version and source digest>" } }. Reports aren't designs, so adding the field to them changes no design file's bytes. - The failing call says which backend. A failed operation's
ErrorCodealready names it: a non-solidcore backend'soperationstarts with its adapter's crate path (§6). A report also names the backend that made each body the failing feature read, which the router knows. - Triage replays on solidcore first. A report on a non-default route is replayed with
solidcraft-cli run replay.json --in <design>.sc --kernel solidcore, then on the reported route. That separates the cases:- fails on both routes: an app or solidcore bug, triaged as today;
- fails only on the reported route: a bug in that backend or its adapter, labelled with the backend and filed against its adapter. A kernel defect is reported upstream from there.
- Design files already record the route for non-default routes (above), so a design attached to a report carries it as well.
pub enum BackendError {
/// The input is wrong whatever the kernel: not finite, out of range, an open profile, an
/// index past its list. Only for input every backend must refuse.
Invalid(String),
/// This backend doesn't build this (yet). Never shown to a user while a fallback exists.
Unsupported(String),
/// A size too large for the geometry around it, with the largest size that builds where the
/// kernel names one.
TooLarge { why: String, largest: Option<f64> },
/// No room: an inward offset leaves none, walls touch, a wall folds (largest where named).
NoRoom { why: String, largest: Option<f64> },
/// A numerical step failed: no convergence, a singular system.
Numerical(String),
/// The kernel made something, and it fails the shared check (§7).
InvalidResult(String),
/// Stopped by the cancel token.
Cancelled,
/// The kernel panicked (caught by `guard`).
Internal(String),
/// The conversion failed: a record the backend's form can't hold, or a form that doesn't
/// export.
Exchange(String),
}BackendError |
solidcore (solidcore_ops::Error) |
alternative kernel (typical error kinds) | KernelError the app sees |
|---|---|---|---|
Invalid |
Argument; Refused only where the app's own checks agree the input is invalid |
"invalid input", only after the same agreement check | Invalid |
Unsupported |
Unsupported, CornerUnsupported, TurnRefused { room: false } |
"unsupported" | Failed ("not supported yet"), or fallback |
TooLarge |
TooLarge { size, … }, RoundsCross { fit } |
where the kernel names a largest size | TooLarge |
NoRoom |
NoRoom, WallsTouch, WallFolds { largest } |
where the kernel names it | Failed, with the same text as today |
Numerical |
Status(_), BlendNotCertified |
"numerical failure" | Failed |
InvalidResult |
NotSolid, NotSolidBecause(_), Empty where the input was solid |
"invalid result" with the checker's issues | Failed |
Internal |
guard |
guard |
Internal |
- The solidcore row is today's mapping, moved, not changed. The words a user sees on the default path stay the same.
ErrorCode { call, kind, operation }gains no field, because a new field would change every stored report. Another backend's codes keepcallas is ("blend"), takekindfrom that backend's own numbering, and startoperationwith that adapter's crate path. A solidcore code is byte-identical to today's, and two backends' codes never collide.
The kernel rule (.agents/skills/solidcraft-kernel-rules) holds within each backend and across
them:
- Fallback. When a non-default backend answers a routed operation with
Unsupported,Numerical,InvalidResult, or anInvalidthat the agreement check doesn't confirm, the operation runs again on solidcore. The user gets solidcore's answer, and the miss is logged and counted (§8). This isFallback::ToDefault, the mode a routed run uses. - Strict mode. In the rig and in cross-backend runs (
Fallback::Strict), the miss is the result: it counts as "refused" for that backend on that case. - Routing. An operation is routed to a backend only when, on that operation's cases, the backend refuses nothing solidcore builds (§8). The fallback is a safety net, not the plan.
- Agreement on
Invalid. A non-default backend'sInvalidis shown asInvalidonly when the app's own input checks, the ones that run before any kernel (box_solid's size test, for example), refuse that input too. Otherwise it counts asUnsupported, and the operation falls back.
The check that decides whether a feature's bodies stand runs on the record. It is the same
check whatever made the body: today's validity() and check_kept, meaning Brep::validate,
record_check::agreement, and solidcore's own check of the record.
- One judge makes the comparison fair. A body only its own kernel's checker passes isn't yet a valid SolidCraft body. With one judge, "valid" means the same in every column of §8's table.
- The default path doesn't change. It runs the same check on the same record.
- A foreign body costs one conversion to check. It is checked through its solidcore form,
built once and then kept in the
Body's cache. That cost is part of what §8 measures.
An adapter may run its kernel's own checker:
- It may refuse. A result the backend's checker refuses becomes
InvalidResultbefore export. That is cheap, and the operation falls back. - It never accepts. Its verdict goes in a new field,
Validity::native, set only for foreign bodies. The router treats that verdict as a refusal or as information, never as a pass.
The rig lists every disagreement as a finding:
- the shared check refuses and the native check passes: a backend bug, or a solidcore check that is too strict (a solidcore issue);
- the native check refuses and the shared check passes: a gap in the shared check.
A design's "Certify geometry" setting reaches the kernel as solidcraft_kernel_api::Rigor
(Fast, or Certified, the default): a session setting of the calling thread, which the doc
evaluation installs around a design's work (solidcraft_kernel::rigor::with_rigor, carried to
the worker threads as the validation mode is) and the router tells each kernel through
Runtime::set_thread_rigor. solidcore maps it onto its proofs (Kernel::certify_geometry); a
kernel with nothing to prove ignores it. Until the application asks to follow each design's
setting (rigor::follow_designs, called by the app, the web app and the CLI's design commands),
every design's work is certified: tests, the rig and the naming corpus never run fast.
A face a kernel built fast comes back Certainty::Unchecked. The application keeps that per
face, beside the body's record (Body::unchecked_faces, the saved model's unchecked_faces),
not in the record, and hands it back whenever the record goes into a kernel again, so the kernel
takes those faces as built and never refuses them for want of a proof. One query proves them, the
same one that checks a body: HeldBody::check(faces, rigor) gives the body's Validity and, with
Rigor::Certified, each asked face's certainty after its proof (Proved within its stated bound,
Checked within a looser one, Unchecked not proved). The router's Body::prove asks it of a
held body and runs solidcore's proof for its own; a check of the bodies on request
(diagnostics.validation with prove), a feature that fails fast and is run again certified,
and a STEP export of a design with the setting on call it. With the setting off, an export
writes the bodies as built, unproved, as other CAD programs write theirs. Nothing is refused for
an unproved face: it is kept as built, and reported.
#21689 lets the window show a feature's result before its check ends. If the check then refuses,
it flips the feature to failed through Checks::refuse, with the same error an evaluation that
waited would show. This design fits that unchanged:
- The background check runs the same code whichever backend made the body. It is the shared record check above.
- Fallback happens inside the operation, before the result is shown. The background check only sees results the router accepted. If it refuses a foreign body, the feature fails exactly as #21689 describes. There is no second, silent rebuild on solidcore: a rebuild nobody asked for would change results behind the user's back.
- The report names the backend. The router knows which backend made the body
(
Validity::nativeand the log), so the refusal says so, and the comparison counts it (§8). - Cached results key on the route (§5). A design built on one route never loads results checked under another.
| Level | How | Default | When |
|---|---|---|---|
| Build | Cargo features on solidcraft-kernel: backend-solidcore (always on), one backend-<name> per other kernel whose authors bring an adapter, and backend-loopback (tests only). The apps forward them. |
solidcore only | phase 1 has the solidcore feature only |
| Run, whole session | SOLIDCRAFT_KERNEL=<name> or solidcraft-cli --kernel <name>: every routable OpKind the named backend supports goes to it; the rest stay on solidcore |
unset (solidcore) | later, not phase 1 |
| Run, per operation | SOLIDCRAFT_KERNEL_ROUTE=fillet=<name>,boolean=solidcore, or --kernel-route route.toml; this wins over SOLIDCRAFT_KERNEL |
none | later, not phase 1 |
| Shipped route | crates/kernel/route.toml, compiled in: the per-operation choices measurement supports |
all solidcore | later; changes are the owner's (§13) |
| Per design | the design's recorded route (§5), offered when the design opens on a build that has those backends | follow the running route | future |
| Preferences | a kernel choice in Preferences, among the compiled backends | solidcore | future, a UX decision |
These hold at every level:
- Compile time decides what can be chosen (owner decision, see Decisions). In phase 1 the router's choice is a constant: solidcore is the only kernel compiled in, so there is nothing to read at launch.
- When run-time selection comes, the route is read once, into a
OnceLock<Route>. Switching takes a restart (§11). - A bad name never crashes the app. An unknown backend, or one this build doesn't have, is logged once and ignored.
- The route enters the evaluation cache key only when it isn't all-solidcore. Existing caches stay valid.
docs/kernel-support.md (added with the router, §12) lists every kernel with an adapter to our
interface: who maintains its adapter, the commit it pins, each OpKind it supports, and its
results on the naming gate and the accuracy gate below. In phase 1 it has one row, solidcore,
maintained by us. A kernel that isn't in the matrix, or that fails either gate on an operation,
isn't routed for that operation.
Three measures each gain a --kernel switch and strict mode, and one new xtask joins their
results:
-
The kernel rig (
cargo xtask kernel-cases --kernel <name>) runs every case on that backend, in strict mode.results.jsongains these fields per case:backend, status, counts, volume and area;- time in the operation, and time in the exchange;
ExchangeLoss;- the shared check's verdict and the native check's verdict;
- accuracy, all in millimetres at the case's own scale:
- the largest edge and vertex tolerance the result record carries (the gap the kernel had to declare);
- the largest gap the shared check measures between each edge's curve, its pcurves and its
faces (
record_check::agreement); - the relative error in volume and area against the case's analytic answer.
The rig's answers come from analysis, never from a kernel (tests/kernel-cases/README.md), so they are already neutral.
-
brep-bench (bmander/brep-bench, Apache-2.0) gets a runner,
solidcraft-kernel --kernel <name>. The runner builds each case through the router, converts the result to the record, and writes STEP with solidcore's STEP writer. That measures a backend as SolidCraft would use it, conversions included, graded by the bench's own closed-form answers. -
The naming corpus gains
NAMING_CORPUS_KERNEL=<name>. It builds each design on solidcore and on that backend. For each design it reports one of:identical;verified names differ, with the diff;only unverified names differ;fails to build, with the step and the error.
cargo xtask kernel-compare out/solidcore out/<name> … joins the runs into one table, written to
target/kernel-compare/table.md and .json. It has one row per OpKind and one column group
per backend:
OpKind |
cases | solidcore pass / refused / wrong / median ms / worst tolerance | <name> pass / refused / wrong / median ms / exchange ms / losses / worst tolerance |
cases looser than solidcore | names identical (designs) |
|---|
Each row expands to its cases. A scheduled CI job (nightly, not per pull request) builds the non-default features and publishes the table. Nothing in it gates the default build.
These apply only if someone brings another kernel; none is planned. The adapter is theirs to
write and maintain. An OpKind may go to another backend only when all six hold on its rows.
Rules 2 (the naming gate) and 5 (the accuracy gate) are the owner's hard requirements:
- No new refusals. No case solidcore passes is refused or wrong on that backend (§6).
- Same names. Verified names are identical on every corpus design that uses the operation.
- Shared check. No result fails the shared check.
- No loss. There is no
ExchangeLosson a case solidcore builds losslessly, unless the loss is a label only and every later case on that body still passes. - As accurate (a hard gate). On every case, the backend's result holds the same linear
tolerance as solidcore's or a tighter one. Each of the three accuracy measures (the worst
tolerance it carries, the worst gap the shared check measures, and the volume and area error
against the analytic answer) is no larger than solidcore's on the same case. The comparison is
made after the exchange, on the whole body, so a conversion that loosens faces the operation
didn't touch counts against it.
- Why it is hard: solidcore results typically hold about 1e-12 mm at part scale, while some kernels work to a single global tolerance near 1e-7. That is invisible on one part, but on a large assembly placed and combined many times over it compounds to millimetre-level error.
- Speed never buys back accuracy. A faster backend that is looser on any case isn't routed. The "cases looser than solidcore" column must read 0.
- Clearly better. End to end, conversions included, the backend is at least 1.2× faster at the median and never more than 1.5× slower on any case, or it passes cases solidcore refuses.
The decision is recorded on the operation's tracking issue, with the table. The shipped route stays all-solidcore until the owner says otherwise (§13).
The owner asked whether dyn or static dispatch at the app boundary costs the solidcore path
anything. A microbenchmark compared three ways of calling the same out-of-line operation:
- a direct call;
- a closed
enumof backends, chosen at run time from aOnceLockroute; &'static dyn Backendchosen at run time.
Setup: 200 million calls per round, three rounds, rustc 1.100.0 -O -C codegen-units=1, on an
x86-64 Linux build machine.
| Round | direct | enum | dyn |
|---|---|---|---|
| 0 | 3.30 ns | 2.39 ns | 2.39 ns |
| 1 | 2.39 ns | 2.59 ns | 2.39 ns |
| 2 | 2.39 ns | 2.59 ns | 2.39 ns |
The three are within 0.2 ns of each other, which is noise. The cheapest kernel operation the router dispatches (a box) takes microseconds, and the common ones take milliseconds to seconds, so run-time selection costs nothing measurable either way.
The choice is a closed enum, not dyn:
enum Which { Solidcore, #[cfg(feature = "backend-alt")] Alt, /* … */ }
pub fn fillet(body: &Body, edges: &[Vec3], radius: f64) -> Result<Body> {
match route::of(OpKind::Fillet) {
Which::Solidcore => blend::fillet(body, edges, radius), // today's code path, unchanged
#[cfg(feature = "backend-alt")]
Which::Alt => routed::<Alt>(OpKind::Fillet, body, |b, f, idx| b.fillet(f, idx, radius, FilletTurn::Mitre)),
}
}- The solidcore-only build makes the same call as today. With one variant,
route::ofis aconst fn, thematchdisappears, and the call is the call it is today. That is zero overhead by construction, not just too small to measure. - A build with several backends still selects at run time. The enum holds every compiled backend, and the route picks among them on each call. No rebuild is needed to switch.
dynwould buy nothing. The trait has an associatedFormtype, so it isn't object-safe. Making it object-safe means boxing every form and erasing every signature, for no measured gain. And if a hot record service is routed later (measurehas 375 references,classify_pointover 200, called in loops), an enum arm can still be inlined.dynstays possible later. If a backend ever has to load as a plug-in without a rebuild, it can be wrapped behind a boxed adapter that is one more enum variant (Which::Plugin(Box<dyn DynBackend>)). That is out of scope here.
| Cost | When | How it's kept down |
|---|---|---|
| Record → backend form | once per body per backend | cached on Body (the foreign slot), shared by clones, like the smlib cache |
| Backend form → record | once per result | needed anyway, for names, meshes and saving. Pcurve fitting is the expensive part; it reuses the record's own routine. |
| Back and forth between backends | each time the route alternates on one body | counted in the measured end-to-end time (§8); routes go per family (all blends on one backend), not per call |
| The shared check of a foreign body | once per kept body | the record → solidcore conversion it needs is cached, and its time is measured |
On the default path there's no conversion beyond today's.
- What ships by default. Release builds (desktop, CLI and web) compile solidcore only. Builds with other backends are developer and nightly measurement builds until the owner routes an operation to another backend by default.
- Size. Each backend adds its kernel's code and its dependencies. The adapter pull request
measures it (release binary size and wasm size, before and after, plus
cargo bloat --crates) and states it in its description. No number is guessed here. - Dependencies. An alternative kernel brings its own dependency tree (linear-algebra crates
and the like). Builds with the feature run
cargo denyandcargo xtask licences. A dependency with a licence SolidCraft doesn't accept blocks the adapter. - wasm. The application builds for wasm (AGENTS.md), so a backend can be routed by default
only once its feature builds for wasm and passes
cargo xtask web-offline-test. - Build time. A feature that isn't selected costs nothing to build. The nightly comparison job builds each backend's feature.
The owner's rule: SolidCraft uses solidcore-ops fully, and only through the solidcore
adapter. This section is the inventory of what reaches into solidcore today, the plan for each
item, and how the rule is enforced.
| SolidCraft crate | solidcore crates |
|---|---|
crates/kernel |
record, ops, tess, step |
crates/smlib |
solidcore (the kernel crate, via xtask/solidcore-seam.txt), record, ops |
crates/geom |
solidcore (seam), record, ops, tess |
crates/io |
record, ops, tess, step, cadir |
crates/doc |
record, ops, tess |
crates/engine |
record, ops |
crates/sketch |
record, ops |
crates/feature-sheet-metal |
record, ops |
crates/ui-egui |
record, ops, tess |
crates/gpu, crates/render, crates/viewport, crates/viewport-gpu |
record, tess |
crates/dynamics, apps/solidcraft-cli |
record |
tools/bench/tess (path dependency) |
record, ops, tess |
xtask/solidcore-public.txt currently lets SolidCraft use -ops, -tess, -record, -step
(until RFC 0003 1.6) and -cadir (crates/cadmpeg only, the cadmpeg boundary of RFC 0021 §3.2) directly. The seam list has two lines:
crates/smlib -> solidcore and crates/geom -> solidcore.
The classes are: data types, computation, tessellation, file formats, and validation. Record data
types (Vec3, Vec2, Plane, Seg2/Loop2/Region2, brep::{Brep, Curve, Surface, Frame, …}, history::*, part::*) appear in about 2,700 lines across nearly every crate. They are
summarised under "May stay" below. Every other use is listed here.
These are the pre-ops wrapper. The seam line already says they go at "the switch commit of the
solidcore ops stage 3b plan". The plan for each is to route it through the ops family that
already exists on main. Where a needed entry point is missing, it is first added to
solidcore-ops in its own solidcore/ pull request.
| smlib file:function | Kernel items used | Plan |
|---|---|---|
core.rs:run, answer |
kernel::{Kernel, KernelOptions, CancelToken, UpstreamFixes}, attribute store, brep_volume, create_box/cone/cylinder/sphere/torus, SolidError status |
ops::session, ops::cancel, ops::Body primitives and volume (exist) |
core/boolean.rs:merged |
boolean::api_brep::boolean, BooleanOperation, update_tolerances_after_boolean |
ops::boolean (exists) |
core/blend.rs (incl. finish) |
edge_closest_point, brep_copy, validate_and_update_tolerances, MIXED_CORNER_RAILS_CROSS, failure types |
ops::blend, ops::check, ops::error (exist). Add ops::pick edge-closest if it is missing. |
core/convert.rs |
curve, NURBS, surface, attribute and extent types, bounding boxes, make_topology_from_data, brep_data* |
ops::Body::from_record and to_record (exist; solidcore-convert is their implementation) |
core/file.rs |
read_brep_from_file, write_brep_to_file |
ops::file (exists) |
core/history.rs |
attribute store, edge_closest_point, brep_copy |
ops::history, ops::provenance (exist) |
core/measure.rs (incl. check_scoped) |
assert arrays, context_xsect_tol_3d, GapFunction, brep_properties_in_box, face_properties, brep_bounding_box, brep_is_manifold_solid, brep_material_census, face_bounding_box, check_brep_scoped, PPF_AREA |
ops::measure, ops::check, ops::query (exist). Add ops::measure in-box properties if missing. |
core/merge.rs |
is_manifold_solid, delete_face, orient_trimmed_surfaces, stitch_faces, remove_topological_edges_and_vertices |
ops::stitch, ops::heal (exist). Add face-delete and edge/vertex-removal recipes if missing. |
core/offset.rs |
offset_brep_simple, local_operation_simple, OffsetFacesExecutive, shell_brep, face_classify_uv, face_closest_point_in_shape, face_internal_point, BrepQuery, PointClassType |
ops::offset, ops::query (exist) |
core/split.rs |
boolean_with_options, MergeOptions, is_sheet, new_brep, create_face_from_surface, orient_sheet_surfaces, merge_curves_on_surface_through_surface, face_planar_section_curves, is_embedded, brep_cache |
ops::split, ops::boolean (exist) |
core/ssi.rs:surface, domain, evaluate, intersect |
surface_intersector::do_intersection, SurfaceIntersection, TsectCurveType |
Add an app-agnostic surface/surface intersection entry point to solidcore-ops (solidcore pull request), then call it |
core/sweep.rs |
create_linear_sweep, create_rotational_sweep, create_curve_sweep_with_placements, create_taper_extrude_with_corner, create_skin_primitive, compute_crvs_normal, api_stitch_into_solid, create_parallel_projection_curves, stitch_faces, stitch_and_orient, copy_faces, create_face(s)_*, create_planar_section_curves, context_zone_tol_3d |
ops::sweep, ops::prism, ops::stitch (exist). Add the tapered extrude with corner if missing. |
core/trim.rs |
edge_closest_point, face_closest_point_in_shape, face_internal_point, Continuity, BoxSide, copy_source_ref, delete_face, new_brep, make_edge_in_face, copy_faces_from, create_face_from_surface, make_vertex_loop, get_or_create_uv_trim_curve, create_missing_uv_trim_curves |
ops::trim, ops::untrim, ops::extend (exist) |
core/transform.rs |
mirror::transform_matrix |
ops::affine (exists) |
core/picked.rs, dump.rs |
brep_copy, edge, vertex, Point3 |
ops::pick, ops::Body::copy (exist) |
stop.rs, lib.rs |
CancelToken, SolidError (crash test) |
ops::cancel, ops::session (exist) |
*_tests.rs |
FilletSession, boolean_difference/merge, create_box/plane/rectangle/line_segment, trim_surface_with_3d_curves, create_linear_sweep, brep_area, merge_brep, new_brep, copy_faces, points_in_face |
tests move with their code into the adapter and call ops; the kernel-level ones move to solidcore's own tests |
| geom file:function | Item | Plan |
|---|---|---|
bspline.rs (top-level pub use) |
eval::plan::basis::{Side, basis_derivatives, binomial, local_basis, local_basis_array} |
Add solidcore-ops curve-evaluation entry points (B-spline point and derivatives at a parameter; the kernel computes, ops sequences) in a solidcore pull request. geom's B-spline evaluation then moves into the adapter, and its callers (sketch, doc) call it through crates/kernel. This is RFC 0003 item 1.8. |
bspline.rs:interpolate, bspline.rs:eval |
eval::plan::{span_of, basis_ders} |
as above |
lib.rs mod tess |
pub use solidcore::eval::plan::* (EvalCurve, EvalSurface, uv, …) |
the plan types are solidcore-tess's display plan. Their users take them from the adapter's re-export, or, in the shared display crates, from solidcore-tess under the display exception (§13, question 2) |
lib.rs tess::partials, to_kernel, from_kernel(3) |
MAX_PARTIAL_ORDER, orders, trig_derivative, Partials, solidcore::Vec3 |
move into the adapter with the evaluator |
Through geom's tess re-export, these reach the plan evaluator: kernel blend.rs:curve_derivative,
bridge.rs:station, splitface.rs (tess::uv::Starts), and tests in kernel, gpu, doc and
engine. They are all solidcore-adapter code or tests, so they move with it.
| file:function | Item | Plan |
|---|---|---|
kernel body.rs (re-exports), mesh_plan_untimed, export_mesh; lib.rs From<TessError>; tests |
plan, mesh, MeshSpec, MeshTolerance, PlanStats, DISPLAY_ANGLE, MESH_MIN_ANGLE, TessError |
adapter code; it stays, inside crates/kernel-solidcore |
io kicad_in.rs:extrude_regions, add_surface_region; test |
triangulate_union, triangulate_planar |
route through crates/kernel re-exports (the adapter's tess face) |
io lib.rs test |
Unshaped, ShapeLimit |
the same |
doc eval.rs (fields, gpu_plan_at, refined_display), gpu_plan.rs:gpu_plan |
TessPlan type |
take the type from crates/kernel's re-export |
ui-egui display_lod.rs, viewport.rs:drawn_plan, wireframe_highlight_plan |
TessPlan type |
the same |
viewport scene.rs, raster.rs (test); viewport-gpu lib.rs:face_surface, view.rs (about 19 sites), gpu_cull.rs, capture.rs, tests; gpu tests |
Mesh, TessPlan, FacePlan, EvalCurve, EvalSurface, simplify::Level, PoleNode, PoleRule |
these are shared crates, used by other front ends and allowed solidcore by docs/architecture.md. They can't depend on SolidCraft's adapter. Proposal: they keep solidcore-tess as the display-format exception (display data, and the display-only plan evaluator that solidcore's layers.md §3 allows); see §13, question 2 |
tools/bench tess/src/main.rs:main |
plan, MeshTolerance::{display_of, export_of} |
a tool, not app code: it goes through crates/kernel, or is listed as a tool exception |
| file:function | Item | Plan |
|---|---|---|
kernel step_in/* (p21.rs:parse, check_memory, set_max_bytes; mod.rs:body_item, with_checks, context_units, frame_matrix, placement_matrix, mapped_shapes, rep_bodies, step_orientation_errors, step_validate, with_workers, finish_checking; parallel.rs:smlib_part, solid_part, surface_part; tessellated.rs) |
solidcore_step::{p21, read, topology, units, geom}, solidcore_record::step::protocol |
adapter code, and it stays in the adapter. To meet "ops fully", add a STEP read entry point (parse, assemble, build, heal) to solidcore-ops in a solidcore pull request, which is layers.md §2 "Importers are solidcore's", then call it |
kernel step_out.rs (product_header, export_body, step_export_products, step_export_bodies_with_face_ids) |
solidcore_step::write::product::* |
add a STEP write entry point to solidcore-ops, then call it |
kernel iges_out.rs:mapped_domain, shell, iges_export_bodies |
solidcore_step::geom::*, write::topology::* |
add an IGES write entry point to solidcore-ops (or the STEP write op takes a format), then call it |
kernel native.rs:encode_native_body, decode_native_body; tests |
solidcore_record::native::{encode, decode, write_value, read_value, check, check_value} |
adapter code; it stays. The native encoding is the record's own serialisation. |
io native_cad.rs:step_producer; native_cad/tests.rs |
solidcore_record::step::p21::parse |
through crates/kernel (a header-read call next to step_import) |
cadmpeg records.rs:traced_records; staged.rs:write_body |
solidcore_cadir::{read_bodies, write_body, Written} |
the cadmpeg boundary's (RFC 0021 §3.2): crates/cadmpeg is solidcore-cadir's one caller, and the kernel carries no CADIR |
io native_cad/convert/step_route.rs:name_unnamed_products |
solidcore_step::write::string |
through crates/kernel (a STEP string-escape helper re-exported by the adapter) |
io limits.rs:memory_short and its test |
p21::{Error::NeedsMemory, PEAK_PER_BYTE} |
use solidcraft_kernel::step_check_memory, which already exists |
| file:function | Item | Plan |
|---|---|---|
kernel body.rs:with_history_counts, with_checked_history, with_rounds_of; blend.rs:over_body_alone, corner_history; history.rs:check; test |
record History::check_counts |
may stay: a structural check on record data (counts and indices), which is the record's job (layers.md §1) |
smlib core/blend.rs:finish, core/boolean.rs:merged, core/measure.rs:check_scoped |
validation::{validate_and_update_tolerances, update_tolerances_after_boolean, check_brep_scoped} |
ops::check and the ops families above (step 8 of §12) |
| smlib, doc, geom tests | Brep::validate, check_curve2, Budget::input |
may stay: the record's structural validation |
These already use ops, but not through the adapter. The plan for each crate:
crates/kernelre-exports the items, in asolidcraft_kernel::servicesmodule grouped like ops' own modules;- one mechanical pull request per crate switches its
uselines and drops itssolidcore-opsdependency.
Results don't change, because they are the same functions.
| Crate | file:function | ops items |
|---|---|---|
| develop | lib.rs (use), lib.rs:develop, fold |
develop::*, query::Query |
| doc | assembly.rs:shift; canvas.rs:frame_corners; eval.rs:square_face_level, tapered_reach, move_turn_line |
affine::{pivot_displacement, picture_frame, span_along, same_sense}, SquareFaceLevel |
| doc | config_certificates.rs:find_free_form; drawing/fill.rs:fill_profiles |
prism::{cubic_contains, counterclockwise_sweep} |
| doc | document.rs:is_separate; eval_cell_grid.rs:tools |
cell_grid::* |
| doc | eval_frame_trim.rs; frame.rs:member_axes; frame_paths.rs; gusset.rs, gusset.rs:geometry_error |
frame_trim, frame_member, prism::tapered_flange_ends, frame_gusset, Error::* |
| doc | eval_surface.rs:loft_blend, point_frames |
sweep::railed::{open_section_turns, point_frames}, Error::Unsupported |
| doc | feature_geometry.rs:restored_thread_pick |
point_distance |
| doc | project.rs:resolve_uncached, edge_section, exact_edges, projection_links, meet_at_shared_ends, outline_piece, link_of_piece, loop_contains, project_sketch_curve, exact_silhouette_traced |
curve::*, conic_projection::*, spline_projection::*, outline::*, pcurve::eval, query::Query |
| engine | cmd/canvas_sketch.rs:to_sketch; cmd/component_link.rs:design_images; cmd/file.rs:usd_decals, urdf_decals; cmd/sketch_canvas.rs:corners_in_sketch |
affine::* |
| engine | cmd/hole_stacks.rs:hole_stacks; cmd/inspect.rs:classify_points |
hole_stacks::*, ClassifiedPoint, PointNormalFace |
| engine | cmd/sketch_freeform.rs:project, recorded, support_hits, record_crossings; cmd/sketch_import.rs:insert_airfoil; cmd/sketch_rational.rs:interval |
curve::*, sweep::Curve::from_seg2, curve_fit::fit_spline_bounds |
| engine | drawing_scene/fill.rs:dot_item; drawing_view_hatch.rs; drawing_scene/sketch.rs:check_arc_sweep |
profile::*, prism::counterclockwise_sweep |
| engine | plugin/form.rs:pick_exists |
Body::from_record; use a solidcraft_kernel::Body method instead |
| geom | brep/eval.rs:face_flux; brep/placement.rs:frame, surface, revolution; hlr.rs, section.rs; network.rs:network_surface |
pcurve::*, affine::*, hlr::*, measure::points_meet. geom is L0, below the adapter, so these functions move up into the adapter; their callers call them through crates/kernel |
| io | airfoil.rs:normalized_points; dxf.rs:layered_ellipse; dxf/text_entity.rs:read_text_entity; dxf_out.rs:admit_bulged, sample_bulged_edge, shape_preflight, shape_emission_preflight, extend_extents; dxf_out/file_model*.rs (transformed, bounds, export_error, union, supporting_circle, point_bounds, ellipse_bounds, transformed_point, transformed_shape); dxf_out/path.rs; native_cad/cadir_textures.rs:decal_quad; urdf.rs:decal_dae; svg.rs:cubic |
dxf::import::*, dxf::export::*, affine::{chord_coordinates, lifted_quad}, curve::cubic_pieces |
| sketch | cancel.rs; curves.rs:fit_spans, fit_beziers, fit_beziers_mode; link.rs:update_link_read; link_rebuild.rs:named_curve_identities; nurbs.rs:from_fit_points, check, homogeneous, reversed, linear_image; periodic.rs:validate_periodic_points, periodic_beziers; solver.rs:freeform_dist |
cancel::CancelToken, fit_projection::*, point_identity::*, curve::closest_point. sketch then depends on crates/kernel (both are L1, and there is no cycle) |
| ui-egui | dialogs_assembly.rs:world_preview, placed_snap; dialogs_gusset.rs:for_feature; navigation.rs; pencil.rs:filter; ref_images.rs:show |
affine::*, frame_gusset::support_pick, point_displacement, point_distance, point_set_summary |
| tools/bench | tess/src/main.rs |
face_surface::FaceSurface |
Amended 2026-11-28 (§3): in the end state, nothing of solidcore stays outside the adapter. The
list below is what may stay until stage 5 of §12. xtask/kernel-coupling.txt freezes it: a
new use fails, and the list only shrinks. In stage 5 the record's value types move to the
kernel-neutral crate (§3), and its body types (brep::*, history::*) are reached only through
kernel-api.
- The record's data types, in any crate:
Vec3,Vec2,Plane,Seg2/Loop2/Region2,brep::{Brep, Curve, Surface, Frame, Edge, Loop, …},history::*andpart::*, with their serde and their structural validation (validate,check_counts,Budget).- They were the body format itself, the way a file format crate is. Since 2026-11-28 they are the exchange format only (§3).
solidcore-recordforbids maths (itslib.rsbans sqrt, trig and solves), so using it computes nothing below ops.- Moving about 2,700 lines to a SolidCraft copy would make a second implementation of one job.
- Not allowed outside the adapter: the record's file-format modules,
solidcore_record::step(the STEP parser) andsolidcore_record::native(encode and decode). Those are import and export, so they belong in the adapter.
- The shared display crates'
solidcore-tessdisplay types, if the owner agrees (§13, question 2).
-
Only
crates/kernel-solidcoredepends onsolidcore-ops,solidcore-tess,solidcore-stepandsolidcore-cadir. It reaches no crate below ops, soxtask/solidcore-seam.txtis empty and stays empty. -
No app crate depends on any solidcore crate,
solidcore-recordincluded (§3). The value types come from the kernel-neutral crate. Until stage 5 of §12,solidcore-recordis allowed wherextask/kernel-coupling.txtlists it, and nowhere new. -
xtask/solidcore-public.txtbecomes a list per crate:# crate may depend on crates/kernel-solidcore solidcore-ops solidcore-tess solidcore-step solidcore-cadir solidcore-record * (none: the value types come from the kernel-neutral crate, §3) crates/viewport solidcore-tess # display-format exception, if approved crates/viewport-gpu solidcore-tess # display-format exception, if approved -
cargo xtask layerschecks two things:- every crate's
Cargo.tomldependencies against that list; - item paths: no
solidcore_record::step,solidcore_record::nativeorsolidcore_ops::path outsidecrates/kernel-solidcore.
It is the same mechanism that kept truck inside
crates/kernel. The list never grows; each migration pull request removes the line it makes unnecessary. - every crate's
| v1 | Future | |
|---|---|---|
| How | change SOLIDCRAFT_KERNEL/SOLIDCRAFT_KERNEL_ROUTE, or the CLI flag, and restart (owner decision: no hot swap in v1) |
a Preferences or per-design choice, applied without restarting (hot swap, not v1) |
| What's required | nothing beyond §5: on reopening, the design replays under the new route and shows the kernel differences report | the route becomes a session value instead of a OnceLock; the evaluation cache is dropped (its key changes); a full replay from the first feature runs under the new route; names are compared and the report is shown; selection is re-resolved by name, as after any rebuild |
| Undo | not involved | the switch is a session setting, not a document change. It adds no undo step and doesn't mark the design modified. Saving records the new route (§5). |
| Bodies in memory | discarded by the restart | discarded. A body's cached forms are per backend, so nothing needs invalidating beyond the evaluation cache; the replay makes new bodies |
A partial replay (only the features whose operations changed backend, and everything after them) is a later optimisation. A full replay is simpler and is always correct.
Rules for every step:
- one pull request, landable alone; a series is stacked into
main, bases first; - no change to the default path;
- each one shows the checks from §4: an identical naming corpus (on solidcore, and through the loopback kernel once a stage moves a concern off the record), the app's tests for the crates it touches, and NLT with no REGRESSION lines. The kernel rig and the ladder golden are shown only by a pull request that changes solidcore's geometry or an ops result (§4).
The steps that move existing call sites don't change any function that runs.
These deliver §3: a body lives in its own kernel's form, and the app compiles without solidcore. They run alongside the steps below and follow the same rules. Stages 1 to 3 are gated on the naming corpus (180/180 identical), run with a loopback adapter that keeps a native form and exports nothing until asked, and on the app's tests. That is the cheapest proof that each stage really removes its conversions. The solidcore path stays at zero cost throughout: a solidcore body keeps its record as its form (§9).
| Stage | What it does | What still converts a body to a record |
|---|---|---|
| 0. A lazy record, counted (S–M) | RecordCell gains a Native(BackendId, Arc<dyn NativeBody>) arm, beside Ready and Moved. Body::record() exports on first use and counts each call site, like route/foreign.rs::fell_back. kernel-api gains an object-safe NativeBody trait next to Backend::Form. Nothing else changes. The ratchet (xtask/kernel-coupling.txt) lands here. |
everything that reads the record: display, picks, names, measure, projection, drawings, save, every op that isn't routed, checks, sheet metal. From now on the rig reports how many conversions each concern forces |
| 1. Display and picking (M; picking S–M) | Tessellate: the mesh with tri_face and edge_faces in the kernel's ids, and an optional display plan (Support::No draws the CPU mesh). Query: bounds, ray, classify, closest, face info, face and edge counts, and whether the body is a surface. |
storing a pick as a reference (naming), measure, Project and sketch on a face, exact drawings, save, ops that aren't routed, checks, sheet metal |
| 2. Naming and history in kernel ids (L) | Name and Query topology: faces, edges with their faces and vertices, face loops, vertices, and the op's history (ExactHistory) in the kernel's ids. The router renumbers into canonical order without a record. Features can reference a native body's faces and edges, and fillets and sketch on a face resolve their references. |
measure and exact queries, projection, exact hidden lines, save, ops that aren't routed, sheet metal, checks |
| 3. Queries for measure, sketch and projection (M–L) | Query: mass, face and edge evaluation, face and edge kinds, edge curves, face loops, face planes, distance. Queries is re-keyed from &Brep to the kernel's form, and geom's CurveEval/SurfaceEval callers move onto these queries. The inspect panel, snaps, Project and sketch on a face run natively. |
exact hidden lines, save, ops that aren't routed, sheet metal, checks |
| 4. Save, load and rebuild (S–M) | Store: a cache entry tagged with the kernel and version; tolerance and region count on the form. A natively built design saves and reopens with no record round trip; opened without that kernel, it replays its timeline. A file-format change, reviewed under the file-formats rules. |
exact hidden lines, file export (STEP and IGES, by design), ops that aren't routed, sheet metal, checks |
| 5. The long tail, and the cut (L, ongoing) | Exact hidden lines become an optional hidden_lines extra, or stay solidcore-only beside the mesh-line drawings that already work. More op families join Model; check(form); sheet metal on topology queries. The value types move to the kernel-neutral crate (§3), the composition root becomes the only crate that names solidcore, and the acceptance test (§3) passes: a build with solidcore removed and a stub kernel compiles and runs the non-modelling paths. |
only file export and op families a kernel declines. Those are designed fallbacks, not coupling |
Rough totals: about 1 to 1.5 weeks to stage 1, 3 to 4 weeks to stage 3, 4 to 5 weeks to stage 4; stage 5 is open-ended.
- This document, docs only.
crates/kernel-api. TheBackendtrait,OpKind,Support,BackendErrorand the neutral input types whose definitions are plain data (BoolOp,FilletTurn,ChamferSide, the primitives and profile extents).crates/kernelre-exports the moved types under their old paths and mapsKernelErrorto and fromBackendError. It also adds the architecture table row and thextask layersrow. Nothing calls the trait yet.- The solidcore adapter and the router.
crates/kernelimplementsBackend for Solidcoreby delegating to its existing functions, and its public functions for eachOpKindbecome the router: a one-variant choice, fixed at compile time, whose solidcore arm is the existing call. It addsdocs/kernel-support.mdwith solidcore's row. It moves no code and changes no result. With it,crates/kernelre-exports thesolidcore-opsandsolidcore-tessitems the other crates use (§10), grouped like ops' own modules, so every call site can move without the interface changing again. - The bypasses, by area, in parallel. One pull request per area, with no file shared between
areas (engine commands, sketch, sheet metal, assemblies and joints, drawings, import and export
glue, ui-egui, the MCP and CLI front ends, and so on). Each switches its
uselines tocrates/kerneland, once a crate has no direct use left, drops itssolidcore-opsandsolidcore-tessdependencies. Each is the same functions under new paths. - The check, last.
cargo xtask layersfails when a SolidCraft crate other than the adapter (crates/kernel,crates/smlib) depends on a solidcore crate other thansolidcore-record, apart from the listed exceptions of the later phases (geom, the shared display crates), each with its reason, in a list that only shrinks.
Phase 1 ends when every crate but the adapter, geom (step 6) and the shared display crates
(§13, question 2) reaches solidcore only through crates/kernel.
These finish "solidcore only through ops" and make the seam usable by another kernel's adapter. The owner approved them on 2026-11-26. Each step follows the rules at the top of this section.
- geom's ops and seam uses move up.
- Before any move, the missing
solidcore-opscurve-evaluation entry points go in as their own solidcore pull request, which is RFC 0003 item 1.8. - Then one pull request per family moves geom's functions (placement, pcurve flux, hlr and
section, network, the B-spline basis) into
crates/kernel, and their callers follow. - The
crates/geom -> solidcoreseam line goes in the last one.
- Before any move, the missing
- io's file-format uses. STEP stays in solidcore.
- First the solidcore pull requests that add the missing ops entry points: STEP read and write, IGES write, CADIR read and write.
- Then one io pull request switches its
solidcore-step,-cadirand record STEP uses tocrates/kernel. - The
solidcore-cadirline leaves the public list. - This step follows RFC 0021 (
docs/rfcs/0021-cadmpeg-boundary.md).kernel-apicarries no CADIR or cadmpeg types. Foreign formats come in through io's readers, then exchange to the active kernel.
- smlib below ops. This is the existing stage 3b switch, one ops family per pull request
(boolean, blend, offset, sweep, split, trim, measure and check, merge, convert and file,
history, ssi, transform). Each family's missing ops entry points go to solidcore first. The
crates/smlib -> solidcoreseam line goes in the last one. - The kernel's own STEP and IGES code switches to the new ops entry points. The
solidcore-stepline leaves the public list. This step follows RFC 0021: STEP is read and written by our own reader, andkernel-apicarries no CADIR or cadmpeg types. - The split.
git mvthe solidcore code ofcrates/kernel, together with all ofcrates/smlib, intocrates/kernel-solidcore, leavingcrates/kernelas the router with the same public API.xtask layersswitches to the end-state rule (§10). From here, only the adapter depends on solidcore crates beyondsolidcore-record. Until stage 5 of the decoupling stages (above),solidcore-recordstays allowed wherextask/kernel-coupling.txtlists it, so this step lands on its own whichever comes first.- This is the only large diff in the series, and it is purely mechanical: moves and paths, with the same functions.
- Sweep and loft in the trait.
PathSegandSweepControlcarry geometry of their own (lengths, tangents), so they joinkernel-apionce that geometry is solidcore's. - Exchange and loopback.
- The cfg-gated
foreignslot,export/import, and history renumbering in the router. backend-loopback, which forces solidcore through record → form → record and tag-and-read history on every operation.- A scheduled CI job runs the naming corpus and the rig under loopback; both must be identical to the default. Any difference is a bug in the exchange path, fixed here.
- This step follows RFC 0021.
kernel-apicarries no CADIR or cadmpeg types. Foreign formats come in through io's readers, then exchange to the active kernel. - A backend may also declare native import/export formats. The router then prefers that backend's native path for those formats, and every other format goes through our readers plus exchange.
- The cfg-gated
- Measurement.
--kerneland strict mode on the rig,NAMING_CORPUS_KERNEL,xtask kernel-compare, and the brep-bench runner. The loopback table is the first table, and every row in it equals solidcore's. - Run-time selection.
SOLIDCRAFT_KERNEL,SOLIDCRAFT_KERNEL_ROUTE, the route file, the fallback policy, and the route in the cache key. The shipped route stays all-solidcore. - Designs record their kernel. The
kernelfield (one pending format file), the name digests, the replay comparison and the kernel differences report (§5). - Future: run-time UI. A per-design choice and a Preferences choice, and switching without a restart (§11). These are UX decisions for the owner.
Another kernel's adapter is not a step of this plan. If someone brings one, they write it to the interface, behind a feature that is off by default, with its licence review (§13), its size and dependency report (§9), and its rows in the support matrix. It is routed for an operation only when it passes the gates in §8, and moving the shipped route off solidcore is always the owner's decision.
Steps 2 to 10 stand on their own, even if no other kernel ever comes. They finish "solidcore only
through ops", which makes solidcore-ops a complete, documented API.
- Topology differences. Two exact kernels can make different topologies that are both valid:
corner patches, seams, split periodic faces. Normalising in
exportand the "verified names identical" rule (§8) contain this. Blends are likely the last family another backend wins. - Lost blend definitions. A body that passes through a kernel without blend definitions comes back without them, and later solidcore blends can't re-certify those faces. The rig's chained blend cases measure this, and rule 4 of §8 blocks it.
- Tolerant bodies. Imports with loose tolerances stay on solidcore (
Support::No) until a backend can hold local tolerances. - Mixed routes. Switching kernels for alternate operations converts the body at every switch. The end-to-end timing in §8 decides, and routes go by family.
- Kernels that move fast. Each adapter pins a commit. The kernel's version and source digest go into cache keys and design files, so upgrading rebuilds rather than mixing results.
- wasm. No backend is routed by default until its feature builds and runs for wasm.
- Cancellation. solidcore honours SolidCraft's stop token inside a call; an alternative kernel may not. Long operations stay on solidcore until a backend can be stopped.
- The size of §10. Steps 4 to 9 touch many crates. Each pull request is mechanical and checked byte-identical, but together they are the bulk of the series.
- Accuracy. A backend that works to a looser global tolerance can look correct on single parts and still drift by millimetres across a large assembly. Rule 5 of §8 is a hard gate on every case, with no trade for speed, and the tolerance column keeps the gap visible.
Every backend that can be built multiplies what support has to cover. This is an explicit cost to weigh against any speed win.
- Triage. A report now has a route as well as a version. The triage matrix grows with the number of backends, and with every combination of per-operation routes in use. Replaying on solidcore separates the kernels (§5), but it is extra work on every report from a non-default route.
- Upstream defects. Bugs in another kernel are fixed upstream, on its maintainers' schedule. Until they are, the operation falls back or is un-routed, and someone has to own reporting it and tracking the fix.
- Upgrades. Each pinned kernel needs upgrading, its adapter re-measured (the full comparison table), and cached results rebuilt.
- Documentation and tests. Each backend needs its rig, corpus and bench runs kept green, plus its own known-failing lists.
How this design limits the cost:
- release builds ship solidcore only, so ordinary users report against one kernel until the owner routes an operation elsewhere by default;
- each backend routed by default needs a named owner for its adapter and for upstream liaison;
- a backend that wins nothing in the table after an agreed period is removed, adapter and feature together, rather than kept compiling.
Only questions 1 and 2 touch phase 1, and phase 1 goes ahead on the leaning given for each. The others matter only if someone brings another kernel.
-
Answered 2026-11-28 (§3): the record is an exchange format only, and in the end no app crate depends on any solidcore crate, the record included. The value types move to a kernel-neutral crate. The original question and the CADIR option follow, for the record.
The record as the neutral format, allowed everywhere.
solidcore-recordis solidcore's data crate, not its kernel. The recommendation is to use it as the exchange format and allow its data types in every crate (§10): it computes nothing, and a SolidCraft copy would be a second implementation. Is that within "only the adapter depends on solidcore crates", or should every crate take the record types throughkernel-apire-exports? That would be about 2,700 mechanical line changes.Another option to weigh: CADIR as the exchange format. cadmpeg's vendor-neutral CADIR could be the exchange format instead of the record, validated by round trips on a large corpus. This is an option for the owner to weigh. The design as written uses the record, and it doesn't change because of this option.
- What CADIR carries. It holds exact geometry on STEP's topology conventions: analytic and
NURBS carriers, in millimetres and radians, with per-vertex and per-edge tolerances and a
document linear tolerance. Bodies carry a name, and entities carry ids. SolidCraft already
reads and writes it (
solidcore-cadir, used bycrates/io). - What a record → CADIR → record round trip loses, per
solidcore-cadir's own documentation:- procedural surfaces (blends, ball patches, placed revolutions) go as their NURBS nets, with no definition and no certificate (a blend's bound ε is written as the face's tolerance, which isn't read back);
- pcurves aren't read back; the reader makes them again on its own parameters;
- a record holding several regions comes back as one record per region, and wire edges are dropped;
- CADIR has no field for persistent names or the operation
Historythe naming rule needs (§4), so they would travel beside it in any case.
- What a round trip costs. Each way is a full write and a full read, and the read is the STEP-style assembly: pcurves, seams, tolerances, canonical order. The record needs none of that between two operations: the solidcore backend uses it as it stands, with zero conversions.
- For CADIR:
- it is vendor-neutral and documented outside solidcore;
- other tools already read and write it;
- a round-trip corpus would test every backend's exchange against one independent format.
- Against CADIR:
- the losses above (blend definitions and certificates, pcurves, regions);
- names and history would travel separately;
- two conversions per operation, where the default path has none today;
- the default path would no longer be byte-identical.
- For the record: it is exact, it keeps blend definitions and certificates, it costs nothing on the default path, and names, meshes and the model cache already use it.
- Against the record: it is solidcore's data crate, so the trait is tied to its schema.
- Which to use is the owner's call. The design as written uses the record.
- What CADIR carries. It holds exact geometry on STEP's topology conventions: analytic and
NURBS carriers, in millimetres and radians, with per-vertex and per-edge tolerances and a
document linear tolerance. Bodies carry a name, and entities carry ids. SolidCraft already
reads and writes it (
-
The shared display crates. viewport, viewport-gpu and gpu are shared with other front ends and use
solidcore-tessdisplay types:TessPlan,Mesh, and the display-only plan evaluator. Keep them as a listed display-format exception, or route them through a display-data crate? Phase 1 keeps them as the listed exception, and changes nothing there. -
Licence review for third-party kernels. Each kernel gets a licence and provenance review before its adapter, covering its test kits and generated test suites. SolidCraft takes no GPL/LGPL code and doesn't read it, and a test kit derived from an LGPL kernel's suites disqualifies that kernel or that part of it. Who signs off on the review?
-
Per-operation routing and "one implementation per job". solidcore's rule is one implementation per job, chosen by measurement. Routing an operation elsewhere in shipped builds runs a second implementation in production. When another backend wins, should we:
- (a) route to it;
- (b) take the idea into solidcore, clean-room and within its licence, and stay all-solidcore;
- (c) route first, then do (b)?
The recommendation is (c).
-
Who changes the shipped route? Moving an
OpKindoff solidcore in default builds changes kernel results. Under the defaults rule that's a "no" (it isn't UX), but it is a product choice. Is it yours each time, or ours once the table clears §8's bar? -
Showing the kernel. Should the History timeline show which kernel built a feature? The recommendation is not for now: only in logs, the kernel differences report and
diagnostics.*over MCP. Anything visible is a UX decision. -
The run-time choice in the app. The per-design and Preferences choices are marked as future work (§8, §11). When should they come, and which should come first?
-
How another kernel would come in. Decided in part: whoever brings it writes and maintains its adapter, behind an off-by-default feature, and it must pass the naming and accuracy gates and appear in the support matrix (§8). Still open: a git dependency pinned by commit, or vendored? The recommendation is a pinned git dependency, so the default build and
cargo denysee nothing new.