From cc12011fe2346a88c4c523786e527b335f5aa6e1 Mon Sep 17 00:00:00 2001 From: Brett Lawson Date: Sun, 15 Nov 2026 19:22:06 +0100 Subject: [PATCH 1/5] solidcore: claim shell cavity-region owner fix and offset_keep_cavity_regions retirement Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SdcgEtsWyH5fjgiavRsRdt From 70746bbc23dffa9c19a0b50b904f951bcbbd51f3 Mon Sep 17 00:00:00 2001 From: Brett Lawson Date: Sun, 15 Nov 2026 20:13:03 +0100 Subject: [PATCH 2/5] solidcore: keep an inset's cavity regions by default; ask only between two or more regions Retire `UpstreamFixes::offset_keep_cavity_regions` (WR-667): an inset solid offset always passes make_manifold only the finite regions that are cavity. The cavity verdicts (and the body's point-solve cache they need) are now asked only when the merge leaves two or more finite regions: with one, make_manifold keeps it whatever the verdict, so the selection cannot change the result. The swept bar of issue_1476 (read with every entity under one name, so no geometry owner tells its edges or faces apart) failed with Unsupported ("point-solve geometry owners must identify one edge or face each") building that cache under the flag, although its merge has one finite region. It now shells to its closed form on the default kernel. Tests: the frame of fork_37af643 runs on the default kernel with check_brep at every level, its 1.0-floor control is checked against its closed form, and its flag-off test of the old path is deleted; issue_1476 gains a distinct-names test and a SolidCraft-set test validated at every level. The flag leaves SolidCraft's preset, fixes.json and issue_2260's list. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SdcgEtsWyH5fjgiavRsRdt --- crates/smlib/src/core.rs | 1 - solidcore/crates/solidcore/src/kernel.rs | 2 - .../src/offset/offset_executive/cavity.rs | 4 +- .../src/offset/offset_executive/p2.rs | 33 ++--- ...fork_37af643_inset_keeps_cavity_regions.rs | 116 ++++-------------- .../tests/issue_1476_swept_bar_shell.rs | 70 +++++++++-- .../issue_2260_gn_pipe_refined_range_end.rs | 1 - .../solidcore/tests/kernel_cases/fixes.json | 1 - solidcore/docs/offset-and-shell.md | 12 +- ...g-retired-single-region-no-point-solves.md | 6 + 10 files changed, 115 insertions(+), 131 deletions(-) create mode 100644 solidcore/plan/upstream-issues/WR-667--addendum-2026-11-15-flag-retired-single-region-no-point-solves.md diff --git a/crates/smlib/src/core.rs b/crates/smlib/src/core.rs index d60125d4a04..d5e7e867a8c 100644 --- a/crates/smlib/src/core.rs +++ b/crates/smlib/src/core.rs @@ -180,7 +180,6 @@ pub(crate) fn fixes() -> UpstreamFixes { f.fillet_statuses_pass_on = true; f.fillet_corner_per_vertex_fan = true; f.fillet_rail_trim_at_near_knot = true; - f.offset_keep_cavity_regions = true; f.ellipse_step_interval_checks = true; f.corner_patch_face_side_twist = true; f.boolean_union_refuses_solid_leak = true; diff --git a/solidcore/crates/solidcore/src/kernel.rs b/solidcore/crates/solidcore/src/kernel.rs index ad582a9ffea..cf8a8fd776d 100644 --- a/solidcore/crates/solidcore/src/kernel.rs +++ b/solidcore/crates/solidcore/src/kernel.rs @@ -714,8 +714,6 @@ pub struct UpstreamFixes { pub edgeuse_convexity_propagates_step_off_failure: bool, /// `SmBrep::LocalOperation` sizes the offset executive's distance (by which it extends the neighbouring surfaces to meet the moved ones) from a box that also holds the replacement surfaces, not from the original body alone, so a face moved further than about the body's size away is still reached (WR-534; the fork's tangency-labs/smlib@a1ee273). pub local_operation_box_holds_new_surfaces: bool, - /// An inset's `do_extended_offset` makes manifold only the finite regions of the merged offset that are cavity, not every finite region (upstream's own TODO there: "we will need to select regions to keep"): a region is cavity where one of its faces has the body's face the wall's thickness behind it and none has the body's face that far ahead. Where a floor is no thicker than the wall its two faces' offsets cross and the merge closes the region between them; kept, the cavity was no manifold solid and the shell failed with `SM_ERR` (1001) (WR-667; the fork's tangency-labs/smlib@37af643). - pub offset_keep_cavity_regions: bool, /// In a local operation (`SmBrep::LocalOperation`), `SmOffsetGeometryCreation::ExtendTrimEdges` fails a tangent or lamina edge whose lift onto one face's new surface drops onto the other's farther than ten times `max(the offset edge's tolerance, the approximation tolerance)`, and `EdgeuseOffset` passes that failure on, so the operation is refused; upstream ignores it ("will be fixed later", which no later step of a local operation does) and returns a body with an edge as loose as the gap between a moved face and its unmoved tangent neighbour (WR-530, #402; the fork's tangency-labs/smlib@23c5b0a). Offsets and shells are unchanged. pub local_operation_refuses_loose_tangent_edges: bool, /// A local operation that moves one of two tangent faces along its normal builds the step: `EdgeuseOffset` finds the two faces parallel but apart across the edge (`IsStepAcrossEdge`) and builds the ruled wall between their edges (`CreateStepWall`, rails of uniform weight made non-rational), kept out of the face extensions; `CloseLoopGaps` closes the gaps the wall leaves at its ends and the edges running past its corners are split; a vertex moved past an edge's other end is `SM_ERR_OFFSET_EDGE_VANISHES` (1043) (WR-530 addendum; tangency-labs/smlib 5d428ae, 90aabff, 34318f4). diff --git a/solidcore/crates/solidcore/src/offset/offset_executive/cavity.rs b/solidcore/crates/solidcore/src/offset/offset_executive/cavity.rs index 7c2a8396183..e5ca2efc552 100644 --- a/solidcore/crates/solidcore/src/offset/offset_executive/cavity.rs +++ b/solidcore/crates/solidcore/src/offset/offset_executive/cavity.rs @@ -8,8 +8,8 @@ //! |-----------------------------|-----------------------| //! | `is_cavity_region` (crate) | `sm_IsCavityRegion` | //! -//! Deviations: opt-in (`Kernel::fixes.offset_keep_cavity_regions`, read by -//! `do_extended_offset`). The body's `BrepPointSolve` runs on one point-solve cache of the +//! Deviations: `do_extended_offset` asks only when the merge left two or more finite +//! regions (with one there is nothing to select). The body's `BrepPointSolve` runs on one point-solve cache of the //! body made by the caller (`p1`'s original-body solve, as `RemoveExcessFaces` uses it); //! a failed internal point, point solve or normal skips the face as the fork does, but an //! unported dependency still propagates. No recursion. diff --git a/solidcore/crates/solidcore/src/offset/offset_executive/p2.rs b/solidcore/crates/solidcore/src/offset/offset_executive/p2.rs index 3de0d1820d8..8a6fc847f53 100644 --- a/solidcore/crates/solidcore/src/offset/offset_executive/p2.rs +++ b/solidcore/crates/solidcore/src/offset/offset_executive/p2.rs @@ -1126,25 +1126,28 @@ impl OffsetExecutive { } else { crate::error::ignore_status(stitch::stitch_into_solid(kernel, &mut result))?; } - // Opt-in (WR-667; tangency-labs/smlib@37af643): an inset keeps the regions - // that are cavity, not every finite region (upstream's TODO here: "we will - // need to select regions to keep"). Where the body is no thicker than the - // wall, the offsets of a floor's two faces cross and the merge closes the - // region between them, touching the cavity's pieces along edges; kept, the - // cavity was no manifold solid and the shell failed (1001). (SER.) + // WR-667 (tangency-labs/smlib@37af643): an inset keeps the regions that are + // cavity, not every finite region (upstream's TODO here: "we will need to + // select regions to keep"). Where the body is no thicker than the wall, the + // offsets of a floor's two faces cross and the merge closes the region + // between them, touching the cavity's pieces along edges; kept, the cavity + // was no manifold solid and the shell failed (1001). (SER.) + // + // Only a choice between two or more finite regions can select anything: with + // one, `make_manifold` keeps it whether it is cavity or not (a lone cavity + // region is every region; a lone other region leaves no cavity to keep), so + // the body's point solves are not run for it. let mut cavities = Vec::new(); let mut select = false; - if kernel.fixes.offset_keep_cavity_regions - && self.inset() - && self.operation() == OffsetOperation::SolidOffset + let infinite = result.infinite_region(); + let finite: Vec = bp1::regions(&result, None)? + .into_iter() + .filter(|®ion| Some(region) != infinite) + .collect(); + if self.inset() && self.operation() == OffsetOperation::SolidOffset && finite.len() > 1 { - let infinite = result.infinite_region(); - let regions = bp1::regions(&result, None)?; let mut body_cache = None; - for region in regions { - if Some(region) == infinite { - continue; - } + for region in finite { if body_cache.is_none() { body_cache = Some(super::p1::make_original_brep_cache(kernel, original)?); } diff --git a/solidcore/crates/solidcore/tests/fork_37af643_inset_keeps_cavity_regions.rs b/solidcore/crates/solidcore/tests/fork_37af643_inset_keeps_cavity_regions.rs index fb8c27d4604..c9cfc14dfeb 100644 --- a/solidcore/crates/solidcore/tests/fork_37af643_inset_keeps_cavity_regions.rs +++ b/solidcore/crates/solidcore/tests/fork_37af643_inset_keeps_cavity_regions.rs @@ -1,5 +1,5 @@ -//! Fork tangency-labs/smlib@37af643 under `Kernel::fixes.offset_keep_cavity_regions` -//! (WR-667): an inset keeps the regions that are cavity, not every finite region. +//! Fork tangency-labs/smlib@37af643 (WR-667), the kernel's default: an inset keeps the +//! regions that are cavity, not every finite region. //! //! SolidCraft rig case shell/545's frame, rebuilt from the commit message: a 20 x 20 x 5 //! block with a recess from the top ((5, 5)..(15, 15), z 3..5) and a square ring cut from @@ -8,7 +8,7 @@ //! edges, merged) open at the ring cut's outer wall x = 18: the floor is no thicker than //! the wall, its two faces' offsets cross, and the merge closes the region between them. //! Upstream's `MakeManifold` keeps every finite region ("we will need to select regions -//! to keep"), so the result is no manifold solid. With the flag only the cavity is kept. +//! to keep"), so the result is no manifold solid. The kernel keeps only the cavity. //! //! Closed form (sharp offsets, the open face's neighbours' walls ending at its plane): //! the cavity is z 0.5..2.5 over the core (7.5..12.5)^2 and the outer band @@ -27,8 +27,6 @@ mod offset_fixture; use offset_fixture::{planar_faces_at, volume, Notifications}; use solidcore::boolean::api_brep::boolean_difference; -use solidcore::error::offset::{OffsetFailure, Unsoundness}; -use solidcore::error::Reason; use solidcore::kernel::UpstreamFixes; use solidcore::math::Point3; use solidcore::offset::offset_executive::p1::OffsetExecutive; @@ -36,7 +34,7 @@ use solidcore::offset::offset_executive::p2::{OffsetOptions, ShellOptions}; use solidcore::primitive::api_primitives::create_box; use solidcore::query::api_queries::brep_is_manifold_solid; use solidcore::topology::brep::validation::{check_brep, CheckLevel}; -use solidcore::{Brep, Kernel, SolidError}; +use solidcore::{Brep, Kernel}; /// The frame, the ring cut's top at `ring_top` (2.5: a 0.5 floor under the recess). fn frame(k: &mut Kernel, ring_top: f64) -> Brep { @@ -94,97 +92,26 @@ fn shell(fixes: &UpstreamFixes, ring_top: f64) -> (bool, f64) { (manifold, volume(&k, &mut wall).unwrap()) } -fn keep_cavity() -> UpstreamFixes { - let mut f = UpstreamFixes::default(); - f.offset_keep_cavity_regions = true; - f -} - -/// With cavity selection off, the sliver between the crossing offsets leaves no -/// manifold cavity. The shell refuses it with `OffsetFailure::Unsound` and retains -/// the original frame. +/// Only the cavity is made manifold; the shell is the closed form and passes `check_brep` +/// at every level. #[test] -fn flag_off_refuses_the_sliver_and_retains_the_input() { - let mut k = Kernel::default(); - let mut part = frame(&mut k, 2.5); - part.refresh_cached_topology(); - let open = planar_faces_at(&k, &part, 0, 18.0); - assert_eq!(open.len(), 1); - let mut notifications = Notifications::new(&mut part); - let key = part.key(); - let tolerance = part.tolerance(); - let ids = ( - part.face_list().to_vec(), - part.edge_list().to_vec(), - part.vertex_list().to_vec(), - ); - let points: Vec<_> = part - .vertices() - .iter() - .map(|(id, v)| (id, v.point, v.tolerance)) - .collect(); - let outcome = OffsetExecutive::shell_brep( - &mut k, - part, - shell_options(), - &open, - &mut notifications.context(), - ); - let error = outcome.result.as_ref().unwrap_err(); - let SolidError::Failed(failure) = error else { - panic!("not a refusal: {error}"); - }; - assert_eq!( - failure.reason, - Reason::Offset(OffsetFailure::Unsound { - what: Unsoundness::NotManifoldSolid - }) - ); - assert!(!outcome.input_ownership_transferred()); - let mut retained = outcome.retained_input.unwrap(); - assert_eq!(retained.key(), key); - assert_eq!(retained.tolerance(), tolerance); - assert_eq!( - ( - retained.face_list().to_vec(), - retained.edge_list().to_vec(), - retained.vertex_list().to_vec() - ), - ids - ); - assert_eq!( - retained - .vertices() - .iter() - .map(|(id, v)| (id, v.point, v.tolerance)) - .collect::>(), - points - ); - // Check the returned caches as-is, without refreshing away an inconsistency. - assert!(solidcore::topology::integrity::check(&retained).is_ok()); - assert!(brep_is_manifold_solid(&retained).unwrap()); +fn keeps_only_the_cavity() { + let (mut k, wall) = shell_result(&UpstreamFixes::default(), 2.5); + let mut wall = wall.unwrap(); for level in [CheckLevel::Level0, CheckLevel::Level1, CheckLevel::Level2] { - let checked = check_brep(&mut k, &mut retained, level).unwrap(); + let checked = check_brep(&mut k, &mut wall, level).unwrap(); assert!(checked.is_valid(), "{level:?}: {:?}", checked.lines()); } - let v = volume(&k, &mut retained).unwrap(); - // Block 2000, less the recess 200 and square ring (256 - 36) * 2.5 = 550. - assert!((v - 1250.0).abs() <= 1e-9 * 1250.0, "{v}"); -} - -/// The flag: only the cavity is made manifold; the shell is the closed form. -#[test] -fn flag_on_keeps_only_the_cavity() { - let (manifold, v) = shell(&keep_cavity(), 2.5); + let (manifold, v) = shell(&UpstreamFixes::default(), 2.5); assert!(manifold); assert!((v - 638.75).abs() <= 1e-9 * 638.75, "{v}"); } /// With the SolidCraft set's offset fixes that touch this path as well (WR-345's crossing -/// loops, WR-455's one-pass stitch), the flag gives the same shell. +/// loops, WR-455's one-pass stitch), the same shell. #[test] -fn flag_on_with_offset_fixes() { - let mut fixes = keep_cavity(); +fn keeps_only_the_cavity_with_offset_fixes() { + let mut fixes = UpstreamFixes::default(); fixes.offset_resolve_crossing_loops = true; fixes.offset_stitch_at_body_tolerance = true; fixes.offset_extended_edges_mated = true; @@ -193,12 +120,13 @@ fn flag_on_with_offset_fixes() { assert!((v - 638.75).abs() <= 1e-9 * 638.75, "{v}"); } -/// Control: a 1.0 floor (ring top at 2) has no crossing offsets, one finite region, and -/// shells the same with the flag off and on. +/// Control: a 1.0 floor (ring top at 2) has no crossing offsets and one finite region, so +/// there is nothing to select. Closed form as above: the body is 2000 - 200 - 220 x 2 = +/// 1360; the cavity is z 0.5..2.5 over the core and the band ((25 + 80.5) x 2: 211) and +/// z 2.5..4.5 over (0.5..19.5)^2 less the recess walls (240 x 2: 480), 691; a shell of 669. #[test] -fn thicker_floor_is_unchanged() { - let off = shell(&UpstreamFixes::default(), 2.0); - let on = shell(&keep_cavity(), 2.0); - assert!(off.0 && on.0); - assert_eq!(off.1.to_bits(), on.1.to_bits()); +fn thicker_floor_is_the_closed_form() { + let (manifold, v) = shell(&UpstreamFixes::default(), 2.0); + assert!(manifold); + assert!((v - 669.0).abs() <= 1e-9 * 669.0, "{v}"); } diff --git a/solidcore/crates/solidcore/tests/issue_1476_swept_bar_shell.rs b/solidcore/crates/solidcore/tests/issue_1476_swept_bar_shell.rs index 66ba9eff36d..cd80ab464b5 100644 --- a/solidcore/crates/solidcore/tests/issue_1476_swept_bar_shell.rs +++ b/solidcore/crates/solidcore/tests/issue_1476_swept_bar_shell.rs @@ -46,19 +46,29 @@ use solidcore::offset::offset_executive::p2::{OffsetOptions, ShellOptions}; use solidcore::query::api_queries::brep_is_manifold_solid; use solidcore::topology::brep::p10::TopologyEnv; use solidcore::topology::brep::p7::read_from_file; +use solidcore::topology::brep::validation::{check_brep, CheckLevel}; use solidcore::topology::database_io::FileType; +use solidcore::topology::loopuse::notify_ref; use solidcore::topology::topology::NotifyRecords; use solidcore::{Brep, EntityRef, Kernel}; -/// `SmBrep::ReadFromFile` of the rig's operand. -fn operand(k: &mut Kernel) -> Brep { +/// `SmBrep::ReadFromFile` of the rig's operand. With `distinct_names` each entity is named +/// by `notify_ref`, as `solidcore-ops` reads a file; otherwise every entity gets the same +/// name, so no geometry owner tells its edge or face apart. +fn operand(k: &mut Kernel, distinct_names: bool) -> Brep { let bytes = include_bytes!("data/issue_1476_swept_bar.smd").to_vec(); let mut b = Brep::new_with_infinite_region().unwrap(); let mut records = NotifyRecords::new(); let mut attributes = AttributeStore::default(); - let key = |_: EntityRef| ObjectRef { - key: ObjectKey(0), - type_code: 0, + let key = move |e: EntityRef| { + if distinct_names { + notify_ref(e) + } else { + ObjectRef { + key: ObjectKey(0), + type_code: 0, + } + } }; let mut env = TopologyEnv { all_attributes: &[], @@ -125,11 +135,11 @@ fn solidcraft_fixes() -> UpstreamFixes { } /// The shell of the operand (`SmApiShellBrepFull(b, -0.5, TRUE, TRUE, TRUE, [start -/// cap])`), with its run time. -fn shell(fixes: &UpstreamFixes) -> (Kernel, solidcore::Result) { +/// cap])`), with its run time; the operand named as [`operand`] says. +fn shell(fixes: &UpstreamFixes, distinct_names: bool) -> (Kernel, solidcore::Result) { let mut k = Kernel::default(); k.fixes.clone_from(fixes); - let mut part = operand(&mut k); + let mut part = operand(&mut k, distinct_names); assert_eq!(part.face_list().len(), 14); let start = planar_faces_at(&k, &part, 2, 0.0); assert_eq!(start.len(), 1); @@ -157,10 +167,28 @@ fn shell(fixes: &UpstreamFixes) -> (Kernel, solidcore::Result) { /// Checks the shell and returns its number of line edges. fn check(fixes: &UpstreamFixes, want: Option) -> usize { - let (k, result) = shell(fixes); + check_named(fixes, want, false, false) +} + +/// [`check`] of the operand named as [`operand`] says; with `validate`, the shell also +/// passes `check_brep` at every level (`Level2` runs every test, SolidCraft's +/// `CheckLevel::All`; validation needs the entities named apart). +fn check_named( + fixes: &UpstreamFixes, + want: Option, + distinct_names: bool, + validate: bool, +) -> usize { + let (mut k, result) = shell(fixes, distinct_names); let mut b = result.unwrap(); b.refresh_cached_topology(); assert!(brep_is_manifold_solid(&b).unwrap()); + if validate { + for level in [CheckLevel::Level0, CheckLevel::Level1, CheckLevel::Level2] { + let checked = check_brep(&mut k, &mut b, level).unwrap(); + assert!(checked.is_valid(), "{level:?}: {:?}", checked.lines()); + } + } let v = volume(&k, &mut b).unwrap(); let kinds: Vec<&str> = b .edge_list() @@ -190,11 +218,35 @@ fn check(fixes: &UpstreamFixes, want: Option) -> usize { kinds.iter().filter(|&&k| k == "line").count() } +/// The default kernel, which keeps an inset's cavity regions (WR-667). The operand's +/// entities all share one name here, so no geometry owner identifies its edge or face; the +/// merge leaves one finite region, which `make_manifold` keeps whatever its cavity verdict, +/// so the verdict's point solves over the operand are not run. They used to be, and the +/// shell failed with `Unsupported` ("point-solve geometry owners must identify one edge or +/// face each") while building the operand's point-solve cache (#17393). #[test] fn issue_1476_swept_bar_shells() { assert_eq!(check(&UpstreamFixes::default(), None), 16); } +/// The operand named as `solidcore-ops` reads a file (each entity apart): the same shell. +#[test] +fn issue_1476_swept_bar_shells_with_distinct_names() { + assert_eq!( + check_named(&UpstreamFixes::default(), None, true, false), + 16 + ); +} + +/// SolidCraft's configuration (which also keeps cavity regions, now the default) with the +/// operand named apart: the shell is the closed form and passes `check_brep` at every +/// level. Slow in debug builds, as below. +#[test] +#[ignore = "slow in debug builds (two 38 000-sample curve offsets)"] +fn issue_1476_swept_bar_shells_with_solidcraft_fixes_validates() { + assert_eq!(check_named(&solidcraft_fixes(), None, true, true), 16); +} + /// About 6 s at opt-level 3 but over 4 min in a debug build (the two 38 000-sample /// offsets' knot removal): run with `--ignored` (`--profile difftest`). The default /// test above keeps the extrusion fix live; `nurbs::crv_offset`'s unit tests keep the diff --git a/solidcore/crates/solidcore/tests/issue_2260_gn_pipe_refined_range_end.rs b/solidcore/crates/solidcore/tests/issue_2260_gn_pipe_refined_range_end.rs index fecfb0b8020..68931fadfa8 100644 --- a/solidcore/crates/solidcore/tests/issue_2260_gn_pipe_refined_range_end.rs +++ b/solidcore/crates/solidcore/tests/issue_2260_gn_pipe_refined_range_end.rs @@ -131,7 +131,6 @@ const SOLIDCRAFT_C494A18: &[&str] = &[ "offset_extended_edges_mated", "offset_extension_as_itself", "offset_extension_from_base", - "offset_keep_cavity_regions", "offset_open_edge_second_trim_point", "offset_point_vertex_caps", "offset_resolve_crossing_loops", diff --git a/solidcore/crates/solidcore/tests/kernel_cases/fixes.json b/solidcore/crates/solidcore/tests/kernel_cases/fixes.json index a2a748b6316..cc42c61663e 100644 --- a/solidcore/crates/solidcore/tests/kernel_cases/fixes.json +++ b/solidcore/crates/solidcore/tests/kernel_cases/fixes.json @@ -52,7 +52,6 @@ "offset_resolve_crossing_loops", "edgeuse_convexity_propagates_step_off_failure", "local_operation_box_holds_new_surfaces", - "offset_keep_cavity_regions", "local_operation_refuses_loose_tangent_edges", "local_operation_step_walls", "local_operation_closes_walls_to_nothing", diff --git a/solidcore/docs/offset-and-shell.md b/solidcore/docs/offset-and-shell.md index 8f286d10176..da5f3dd74d2 100644 --- a/solidcore/docs/offset-and-shell.md +++ b/solidcore/docs/offset-and-shell.md @@ -275,10 +275,10 @@ face's surface and intersects neighbouring offsets instead of filling convex edg curve whose trimmed midpoint is nearest the original edge's, trims it and gives it to both offset edge uses. With `offset_analytic_mate_edges` a marched piece lying on an exact line or conic of the two surfaces is replaced by that curve. -- **The merge** joins the offset faces into one body. An inset keeps every finite region unless - `offset_keep_cavity_regions` is on; then `cavity::is_cavity_region` keeps a region whose face - has the input's face one wall behind it (a point solve along the normal). This is a local test, - not S4's winding number. +- **The merge** joins the offset faces into one body. When it leaves two or more finite regions, + an inset keeps those `cavity::is_cavity_region` finds cavity: a region with a face that has the + input's face one wall behind it and none with it one wall ahead (a point solve along the + normal). This is a local test, not S4's winding number. Without `extend_convex_edges` the rounded offset closes convex edges with cylinders and vertices with spheres (`edgeuse_offset`, `vertex_offset`, `offset_geometry_creation.rs`). @@ -434,8 +434,8 @@ local operation. sharp sector angle: print `extension_reach` for the face; a meeting outside the extension, or one that only touches its side, is the cause. A local operation uses its fixed bound instead. - **Check the side and the regions.** A face use opposite its surface negates the distance - (`faceuse_offset_with_backend`). An inset that keeps a sliver region: with - `offset_keep_cavity_regions` off, every finite region of the merge is kept (§5.2). + (`faceuse_offset_with_backend`). An inset that keeps a sliver region: check + `cavity::is_cavity_region`'s verdict for each finite region of the merge (§5.2). - **Look at the tolerances.** Edge tolerances far above the body's after an offset mean a face was built across a collapse or a fold; run `cargo run --release -p diagnostics -- FILE.smb --out DIR` and read the large-tolerance edges. diff --git a/solidcore/plan/upstream-issues/WR-667--addendum-2026-11-15-flag-retired-single-region-no-point-solves.md b/solidcore/plan/upstream-issues/WR-667--addendum-2026-11-15-flag-retired-single-region-no-point-solves.md new file mode 100644 index 00000000000..04add0625dd --- /dev/null +++ b/solidcore/plan/upstream-issues/WR-667--addendum-2026-11-15-flag-retired-single-region-no-point-solves.md @@ -0,0 +1,6 @@ +Updates: WR-667 + +- **Flag retired:** `Kernel::fixes.offset_keep_cavity_regions` is gone; its fixed path is the only path. For an inset solid offset, `do_extended_offset` (`crates/solidcore/src/offset/offset_executive/p2.rs`) passes `make_manifold` only the finite regions `cavity::is_cavity_region` finds cavity, as before under the flag. +- **Change to the fixed path:** the cavity verdicts are asked only when the merge leaves two or more finite regions. With one, the selection cannot change what `make_manifold` keeps (a lone cavity region is every region, and with none cavity nothing is selected), so the body's point-solve cache and its three point solves per face are not built. Before, the swept bar of `tests/issue_1476_swept_bar_shell.rs`, read with every entity under one name, failed with `Unsupported` ("point-solve geometry owners must identify one edge or face each") building that cache, although its merge has one finite region. A body whose geometry owners are ambiguous and whose merge leaves two or more finite regions is still refused that way: the point solve cannot tell its faces apart. +- **Why:** SolidCraft ran with the flag on (its `fixes()` preset); the kernel's default did not. With the flag on, no goldens row moves. +- **Tests:** `tests/fork_37af643_inset_keeps_cavity_regions.rs` runs on the default kernel and checks the frame with `check_brep` at every level; its flag-off test of the old path is deleted, and the 1.0-floor control is checked against its closed form 669. `tests/issue_1476_swept_bar_shell.rs` `issue_1476_swept_bar_shells` (one name for every entity) and `issue_1476_swept_bar_shells_with_distinct_names` shell on the default kernel to the closed form; `issue_1476_swept_bar_shells_with_solidcraft_fixes_validates` (ignored like its slow siblings) also passes `check_brep` at every level under SolidCraft's set. On the default kernel that shell has one edge 4.6e-5 off its surfaces (tolerance 1e-5), with or without this change; the cavity selection does not run for it. From b0acb8ad73570b610ea72268e5f531279ec98e68 Mon Sep 17 00:00:00 2001 From: Brett Lawson Date: Sun, 15 Nov 2026 21:49:31 +0100 Subject: [PATCH 3/5] solidcore: count an offset's finite regions only for an inset solid offset Review fixes: the region list for the cavity selection is built only for an inset solid offset (outsets and sheet offsets skip it); the docs say the selection is asked only with two or more finite regions and keeps every region when all or none are cavity; the swept-bar test's doc says the point solves ran under the former opt-in. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SdcgEtsWyH5fjgiavRsRdt --- .../src/offset/offset_executive/cavity.rs | 5 +++-- .../src/offset/offset_executive/p2.rs | 18 +++++++++++------- .../tests/issue_1476_swept_bar_shell.rs | 4 ++-- solidcore/docs/offset-and-shell.md | 10 ++++++---- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/solidcore/crates/solidcore/src/offset/offset_executive/cavity.rs b/solidcore/crates/solidcore/src/offset/offset_executive/cavity.rs index e5ca2efc552..dee2a448d09 100644 --- a/solidcore/crates/solidcore/src/offset/offset_executive/cavity.rs +++ b/solidcore/crates/solidcore/src/offset/offset_executive/cavity.rs @@ -9,8 +9,9 @@ //! | `is_cavity_region` (crate) | `sm_IsCavityRegion` | //! //! Deviations: `do_extended_offset` asks only when the merge left two or more finite -//! regions (with one there is nothing to select). The body's `BrepPointSolve` runs on one point-solve cache of the -//! body made by the caller (`p1`'s original-body solve, as `RemoveExcessFaces` uses it); +//! regions (with one there is nothing to select). The body's `BrepPointSolve` runs on +//! one point-solve cache of the body made by the caller (`p1`'s original-body solve, as +//! `RemoveExcessFaces` uses it); //! a failed internal point, point solve or normal skips the face as the fork does, but an //! unported dependency still propagates. No recursion. diff --git a/solidcore/crates/solidcore/src/offset/offset_executive/p2.rs b/solidcore/crates/solidcore/src/offset/offset_executive/p2.rs index 8a6fc847f53..3e698f0d8d1 100644 --- a/solidcore/crates/solidcore/src/offset/offset_executive/p2.rs +++ b/solidcore/crates/solidcore/src/offset/offset_executive/p2.rs @@ -1139,13 +1139,17 @@ impl OffsetExecutive { // the body's point solves are not run for it. let mut cavities = Vec::new(); let mut select = false; - let infinite = result.infinite_region(); - let finite: Vec = bp1::regions(&result, None)? - .into_iter() - .filter(|®ion| Some(region) != infinite) - .collect(); - if self.inset() && self.operation() == OffsetOperation::SolidOffset && finite.len() > 1 - { + let finite: Vec = + if self.inset() && self.operation() == OffsetOperation::SolidOffset { + let infinite = result.infinite_region(); + bp1::regions(&result, None)? + .into_iter() + .filter(|®ion| Some(region) != infinite) + .collect() + } else { + Vec::new() + }; + if finite.len() > 1 { let mut body_cache = None; for region in finite { if body_cache.is_none() { diff --git a/solidcore/crates/solidcore/tests/issue_1476_swept_bar_shell.rs b/solidcore/crates/solidcore/tests/issue_1476_swept_bar_shell.rs index cd80ab464b5..2128d99b058 100644 --- a/solidcore/crates/solidcore/tests/issue_1476_swept_bar_shell.rs +++ b/solidcore/crates/solidcore/tests/issue_1476_swept_bar_shell.rs @@ -221,8 +221,8 @@ fn check_named( /// The default kernel, which keeps an inset's cavity regions (WR-667). The operand's /// entities all share one name here, so no geometry owner identifies its edge or face; the /// merge leaves one finite region, which `make_manifold` keeps whatever its cavity verdict, -/// so the verdict's point solves over the operand are not run. They used to be, and the -/// shell failed with `Unsupported` ("point-solve geometry owners must identify one edge or +/// so the verdict's point solves over the operand are not run. With the former opt-in on +/// (SolidCraft's preset) they were, and the shell failed with `Unsupported` ("point-solve geometry owners must identify one edge or /// face each") while building the operand's point-solve cache (#17393). #[test] fn issue_1476_swept_bar_shells() { diff --git a/solidcore/docs/offset-and-shell.md b/solidcore/docs/offset-and-shell.md index da5f3dd74d2..be7364f5b8d 100644 --- a/solidcore/docs/offset-and-shell.md +++ b/solidcore/docs/offset-and-shell.md @@ -276,9 +276,10 @@ face's surface and intersects neighbouring offsets instead of filling convex edg edge uses. With `offset_analytic_mate_edges` a marched piece lying on an exact line or conic of the two surfaces is replaced by that curve. - **The merge** joins the offset faces into one body. When it leaves two or more finite regions, - an inset keeps those `cavity::is_cavity_region` finds cavity: a region with a face that has the - input's face one wall behind it and none with it one wall ahead (a point solve along the - normal). This is a local test, not S4's winding number. + an inset solid offset keeps those `cavity::is_cavity_region` finds cavity: a region with a face + that has the input's face one wall behind it and none with it one wall ahead (a point solve + along the normal). If all or none are cavity, every region is kept. This is a local test, not + S4's winding number. Without `extend_convex_edges` the rounded offset closes convex edges with cylinders and vertices with spheres (`edgeuse_offset`, `vertex_offset`, `offset_geometry_creation.rs`). @@ -435,7 +436,8 @@ local operation. one that only touches its side, is the cause. A local operation uses its fixed bound instead. - **Check the side and the regions.** A face use opposite its surface negates the distance (`faceuse_offset_with_backend`). An inset that keeps a sliver region: check - `cavity::is_cavity_region`'s verdict for each finite region of the merge (§5.2). + `cavity::is_cavity_region`'s verdict for each finite region of the merge (asked only with two + or more finite regions, §5.2). - **Look at the tolerances.** Edge tolerances far above the body's after an offset mean a face was built across a collapse or a fold; run `cargo run --release -p diagnostics -- FILE.smb --out DIR` and read the large-tolerance edges. From de806e834ce0e0263cfa2015145fe57e8b0c9ba3 Mon Sep 17 00:00:00 2001 From: Brett Lawson Date: Mon, 16 Nov 2026 07:31:41 +0100 Subject: [PATCH 4/5] solidcore: wr567 shells to the closed form now that the inset keeps its cavity wr567_default_fails_open_at_the_other_end pinned the 1001 the inset gave while it kept every finite region. With the cavity selection (WR-667) always on, that shell builds; the test becomes wr567_without_collapse_open_at_the_other_end_keeps_the_cavity and asserts the shell builds and passes check_brep at levels 0, 1 and 2. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BUqX4Moqx5bbkSocgEbsSV --- ...wr567_revolution_round_offset_collapses.rs | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/solidcore/crates/solidcore/tests/wr567_revolution_round_offset_collapses.rs b/solidcore/crates/solidcore/tests/wr567_revolution_round_offset_collapses.rs index 26c583d10b1..22fac210656 100644 --- a/solidcore/crates/solidcore/tests/wr567_revolution_round_offset_collapses.rs +++ b/solidcore/crates/solidcore/tests/wr567_revolution_round_offset_collapses.rs @@ -4,8 +4,10 @@ //! fillet's surface of revolution of an arc; moved in past its radius it has no offset, //! as a torus's, and the floor's and side's offsets meet across it in a circle. Upstream's //! `SmSurfOfRevolution` never collapses, and its offset builds the arc turned inside out -//! (r 0.1 or 0.5 round its centre): the shell fails with 1001 open at the rounded end's -//! other side, and is 0.85% and 4.2% low open at the rounded end. +//! (r 0.1 or 0.5 round its centre): upstream's shell fails with 1001 open at the rounded +//! end's other side, and is 0.85% and 4.2% low open at the rounded end. Without the +//! collapse test the kernel's cavity selection (WR-667) still gives the closed form open +//! at the other end. //! //! Expected: the cavity is the cylinder r 15 - t, 5 - t deep; the round takes //! r^2 (1 - pi/4) from the disc's section, its centroid r (10 - 3 pi) / (3 (4 - pi)) in @@ -27,6 +29,7 @@ use solidcore::blend::fillet_executive::api::fillet_edges; use solidcore::kernel::UpstreamFixes; use solidcore::math::Point3; use solidcore::primitive::api_primitives::create_cylinder; +use solidcore::topology::brep::validation::{check_brep, CheckLevel}; use solidcore::{Brep, Kernel}; const RD: f64 = 15.0; @@ -87,11 +90,23 @@ fn shelled(k: &mut Kernel, edge_z: f64, open_z: f64, t: f64) -> bool { ) } +/// Without the revolution's collapse test the round's offset is the arc turned inside out +/// (upstream), and the shell failed with 1001 open at the other end while the inset kept +/// every finite region. Keeping only the cavity regions (WR-667) gives the closed form, a +/// shell valid at every `check_brep` level. (The selection changes the result only when +/// the merge leaves two or more finite regions, so this merge leaves at least two.) #[test] -fn wr567_default_fails_open_at_the_other_end() { - // upstream: the round's offset is the arc turned inside out +fn wr567_without_collapse_open_at_the_other_end_keeps_the_cavity() { let mut k = kernel(false); - assert!(!shelled(&mut k, -H, 0.0, 1.6)); + assert!(shelled(&mut k, -H, 0.0, 1.6)); + let b = rounded_disc(&mut k, -H); + let open = planar_faces_at(&k, &b, 2, 0.0); + let mut result = shell(&mut k, b, -1.6, &open).unwrap(); + result.refresh_cached_topology(); + for level in [CheckLevel::Level0, CheckLevel::Level1, CheckLevel::Level2] { + let checked = check_brep(&mut k, &mut result, level).unwrap(); + assert!(checked.is_valid(), "{level:?}: {:?}", checked.lines()); + } } #[test] From dad68c03df991508feec4276b88af47e65da640e Mon Sep 17 00:00:00 2001 From: Brett Lawson Date: Mon, 16 Nov 2026 10:00:58 +0100 Subject: [PATCH 5/5] solidcore: scope the cavity-selection claims to which regions make_manifold keeps; the skipped live classification's side effects are measured, not argued Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01BUqX4Moqx5bbkSocgEbsSV --- solidcore/crates/solidcore/src/offset/offset_executive/p2.rs | 3 ++- .../crates/solidcore/tests/issue_1476_swept_bar_shell.rs | 5 +++-- .../tests/wr567_revolution_round_offset_collapses.rs | 5 +++-- ...-2026-11-15-flag-retired-single-region-no-point-solves.md | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/solidcore/crates/solidcore/src/offset/offset_executive/p2.rs b/solidcore/crates/solidcore/src/offset/offset_executive/p2.rs index 82764616a14..da4745ea227 100644 --- a/solidcore/crates/solidcore/src/offset/offset_executive/p2.rs +++ b/solidcore/crates/solidcore/src/offset/offset_executive/p2.rs @@ -1168,7 +1168,8 @@ impl OffsetExecutive { // Only a choice between two or more finite regions can select anything: with // one, `make_manifold` keeps it whether it is cavity or not (a lone cavity // region is every region; a lone other region leaves no cavity to keep), so - // the body's point solves are not run for it. + // the body's point solves are not run for it, nor the live classification + // whose trims, caches and tolerance growth they would leave on `result`. let mut cavities = Vec::new(); let mut select = false; let finite: Vec = diff --git a/solidcore/crates/solidcore/tests/issue_1476_swept_bar_shell.rs b/solidcore/crates/solidcore/tests/issue_1476_swept_bar_shell.rs index 477c23f3eb1..03a6dadfb63 100644 --- a/solidcore/crates/solidcore/tests/issue_1476_swept_bar_shell.rs +++ b/solidcore/crates/solidcore/tests/issue_1476_swept_bar_shell.rs @@ -151,8 +151,9 @@ fn check_validated(fixes: &UpstreamFixes, want: Option, validate: bool) -> } /// The default kernel, which keeps an inset's cavity regions (WR-667). The merge leaves one -/// finite region, which `make_manifold` keeps whatever its cavity verdict, so the verdict's -/// point solves over the operand are not run (#17393). +/// finite region (deduced: before #17064 the one-name fixture shelled with this selection, which +/// the verdicts' point-solve cache would have refused), which `make_manifold` keeps whatever its cavity +/// verdict, so the verdict's point solves over the operand are not run (#17393). #[test] fn issue_1476_swept_bar_shells() { assert_eq!(check(&UpstreamFixes::default(), None), 16); diff --git a/solidcore/crates/solidcore/tests/wr567_revolution_round_offset_collapses.rs b/solidcore/crates/solidcore/tests/wr567_revolution_round_offset_collapses.rs index 22fac210656..0d678c0d472 100644 --- a/solidcore/crates/solidcore/tests/wr567_revolution_round_offset_collapses.rs +++ b/solidcore/crates/solidcore/tests/wr567_revolution_round_offset_collapses.rs @@ -93,8 +93,9 @@ fn shelled(k: &mut Kernel, edge_z: f64, open_z: f64, t: f64) -> bool { /// Without the revolution's collapse test the round's offset is the arc turned inside out /// (upstream), and the shell failed with 1001 open at the other end while the inset kept /// every finite region. Keeping only the cavity regions (WR-667) gives the closed form, a -/// shell valid at every `check_brep` level. (The selection changes the result only when -/// the merge leaves two or more finite regions, so this merge leaves at least two.) +/// shell valid at every `check_brep` level. (Deduced, not checked: with fewer than two +/// finite regions the selection is skipped, so the result would not have changed; this +/// merge leaves at least two.) #[test] fn wr567_without_collapse_open_at_the_other_end_keeps_the_cavity() { let mut k = kernel(false); diff --git a/solidcore/plan/upstream-issues/WR-667--addendum-2026-11-15-flag-retired-single-region-no-point-solves.md b/solidcore/plan/upstream-issues/WR-667--addendum-2026-11-15-flag-retired-single-region-no-point-solves.md index 04add0625dd..b3951acfc89 100644 --- a/solidcore/plan/upstream-issues/WR-667--addendum-2026-11-15-flag-retired-single-region-no-point-solves.md +++ b/solidcore/plan/upstream-issues/WR-667--addendum-2026-11-15-flag-retired-single-region-no-point-solves.md @@ -1,6 +1,6 @@ Updates: WR-667 - **Flag retired:** `Kernel::fixes.offset_keep_cavity_regions` is gone; its fixed path is the only path. For an inset solid offset, `do_extended_offset` (`crates/solidcore/src/offset/offset_executive/p2.rs`) passes `make_manifold` only the finite regions `cavity::is_cavity_region` finds cavity, as before under the flag. -- **Change to the fixed path:** the cavity verdicts are asked only when the merge leaves two or more finite regions. With one, the selection cannot change what `make_manifold` keeps (a lone cavity region is every region, and with none cavity nothing is selected), so the body's point-solve cache and its three point solves per face are not built. Before, the swept bar of `tests/issue_1476_swept_bar_shell.rs`, read with every entity under one name, failed with `Unsupported` ("point-solve geometry owners must identify one edge or face each") building that cache, although its merge has one finite region. A body whose geometry owners are ambiguous and whose merge leaves two or more finite regions is still refused that way: the point solve cannot tell its faces apart. +- **Change to the fixed path:** the cavity verdicts are asked only when the merge leaves two or more finite regions. With one, the selection cannot change which regions `make_manifold` keeps (a lone cavity region is every region, and with none cavity nothing is selected), so the body's point-solve cache and its three point solves per face are not built. The verdicts' own side effects on the merged body (the UV trim curves, gap and trimmed surface caches and any tolerance growth the live point classification leaves on it) are then not made either; under SolidCraft's preset, which ran the verdicts, that is the only difference for a single-region inset (measured: the goldens and the app suites). Before #17064, the swept bar of `tests/issue_1476_swept_bar_shell.rs`, read with every entity under one name, failed with `Unsupported` ("point-solve geometry owners must identify one edge or face each") building that cache, although its merge has one finite region; since #17064 the reader refuses such a body and the fixture names entities apart. A body whose geometry owners are ambiguous and whose merge leaves two or more finite regions is still refused that way: the point solve cannot tell its faces apart. - **Why:** SolidCraft ran with the flag on (its `fixes()` preset); the kernel's default did not. With the flag on, no goldens row moves. -- **Tests:** `tests/fork_37af643_inset_keeps_cavity_regions.rs` runs on the default kernel and checks the frame with `check_brep` at every level; its flag-off test of the old path is deleted, and the 1.0-floor control is checked against its closed form 669. `tests/issue_1476_swept_bar_shell.rs` `issue_1476_swept_bar_shells` (one name for every entity) and `issue_1476_swept_bar_shells_with_distinct_names` shell on the default kernel to the closed form; `issue_1476_swept_bar_shells_with_solidcraft_fixes_validates` (ignored like its slow siblings) also passes `check_brep` at every level under SolidCraft's set. On the default kernel that shell has one edge 4.6e-5 off its surfaces (tolerance 1e-5), with or without this change; the cavity selection does not run for it. +- **Tests:** `tests/fork_37af643_inset_keeps_cavity_regions.rs` runs on the default kernel and checks the frame with `check_brep` at every level; its flag-off test of the old path is deleted, and the 1.0-floor control is checked against its closed form 669. `tests/wr567_revolution_round_offset_collapses.rs`: without the collapse test, the disc open at the other end now shells to its closed form (to 1e-6, the fixture's tolerance) and passes `check_brep` at every level, where the inset that kept every finite region failed with 1001. `tests/issue_1476_swept_bar_shell.rs` `issue_1476_swept_bar_shells` (entities named apart) shells on the default kernel to the closed form; `issue_1476_swept_bar_shells_with_solidcraft_fixes_validates` (ignored like its slow siblings) also passes `check_brep` at every level under SolidCraft's set. On the default kernel that shell has one edge 4.6e-5 off its surfaces (tolerance 1e-5), with or without this change; the cavity selection does not run for it.