From 170c73892d31c9f444b97031f8974eef228881a6 Mon Sep 17 00:00:00 2001 From: bherbruck Date: Tue, 27 Oct 2026 12:09:37 -0400 Subject: [PATCH] difftest: heal runner names imported geometry under arena identities topology_vertexuse::import_raw leaves edge curves unowned and keys owned face surfaces as {SmFace_TYPE, 1+f}, so the library's BrepQuery::of_brep on the heal runner's B-rep found an empty brep cache: FindInfiniteRegion's ray fire missed and took the no-hit fallback. own_imported_geometry (util.rs's own_edge_curves, plus a relabel of the export-owned face surfaces) runs right after restore(). Fixes v1.0.1's infinite_region_void_flags_swap on the upstream test port; no heal p1/p2/p3 case moves on main (fixer-5). Co-Authored-By: Claude Opus 5.5 (1M context) --- .../difftest/src/units/heal_heal_data_p2.rs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/crates/difftest/src/units/heal_heal_data_p2.rs b/crates/difftest/src/units/heal_heal_data_p2.rs index a9a7cf7e60..c1c3a1a104 100644 --- a/crates/difftest/src/units/heal_heal_data_p2.rs +++ b/crates/difftest/src/units/heal_heal_data_p2.rs @@ -1171,6 +1171,38 @@ fn dump(h: &HealData, b: &Brep, o: &mut Vec) -> Result<(), SolidError> { Ok(()) } +/// The owners a native B-rep's geometry has (set by the B-rep build upstream), under the +/// arena identities the library's own queries of the B-rep resolve (`BrepQuery::of_brep` +/// of an `Unknown`-named B-rep, e.g. `FindInfiniteRegion`'s ray fires): every edge curve +/// its edge, and a face surface its face only when the export says the face owns it (the +/// import keys those `1 + index` and leaves the others unowned), as `topology_brep_p3`. +/// Without it the B-rep cache holds no curves or surfaces and every ray misses. +fn own_imported_geometry(b: &mut Brep) -> Result<(), HarnessError> { + use solidcore::topology::brep_cache::{arena_identity, CacheObject}; + crate::util::own_edge_curves( + b, + &|e| arena_identity(CacheObject::Edge(e)), + Some(arena_identity(CacheObject::Brep)), + ); + let faces: Vec = b.faces().ids().collect(); + for f in faces { + if let Some(surface) = b + .face_mut(f) + .map_err(|e| harness(e.to_string()))? + .surface + .as_mut() + { + if surface.owner().is_some() { + let _ = surface.set_owner(Some(arena_identity(CacheObject::Face(f)))); + } + } + // a new owner drops the face tolerance the import cached on the surface + b.sync_face_surface_tolerance(f) + .map_err(|e| harness(e.to_string()))?; + } + Ok(()) +} + /// Restores what the import cannot carry: each vertex's vertex use order and the /// cached gap records of every edge use and vertex use (see the shim's /// `put_cached_gaps`). @@ -1321,6 +1353,7 @@ fn rust_heal( // each vertex's vertex use order and the cached gaps, as upstream has them let extra = ffi::vertex_lists(&path, &block).map_err(|e| harness(format!("c++ lists: {e}")))?; restore(&mut b, &extra, c)?; + own_imported_geometry(&mut b)?; let mut k = Kernel::default(); let mut marks = Marks::default();