kernel-cases: shells as a graded count, no SMLib verdict where it can't take the record, $OUT

- `"shells": N` in expected.json grades the total number of shells: a body with a sealed void
  holds two, and some joins keep several lumps in one body. Those cases (#3175, #3455, #3526,
  #3730) are graded on validity again instead of being marked not valid.
- When SMLib's record conversion says "not supported yet" (revolved surfaces, traced intersection
  curves), its check gives no verdict. That's shown but not graded, since it isn't a fault of the
  body. solidcraft_kernel::SmlibCheck carries the three outcomes.
- `$OUT` in a recipe is a scratch directory outside the repository, for files a case writes. The
  two STEP-export crash cases write there instead of /tmp.
- cargo xtask kernel-cases --results FILE keeps every result as JSON.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bherbruckandClaude Opus 5.5 committed 2026-10-21 06:22:03 -04:00
1 parent 6dd104babb
commit 457e63acf3
12 files changed
+102 -52

No files matched your search

+1 -1
View File
@@ -223,7 +223,7 @@ pub use sweep_path::{RailFit, SweepControl, SweepOrientation, sweep_path, sweep_
pub use topo::{CylinderFace, cylinder_end_at, cylinder_face, cylinder_face_at};
pub use topo::{TopoCounts, merged_topology, seam_flags};
pub use tspline::tspline_sheet;
pub use validity::{Validity, boolean_kernel, smlib_built, validity};
pub use validity::{SmlibCheck, Validity, boolean_kernel, smlib_built, validity};
#[derive(Debug, Clone, PartialEq, thiserror::Error)]
pub enum KernelError {
+26 -9
View File
@@ -10,12 +10,22 @@ pub struct Validity {
/// The record: structure, then geometry against topology within tolerances.
pub record: Result<(), String>,
/// SMLib's `check(All)` of the record; `None` in a build without SMLib.
pub smlib: Option<Result<(), String>>,
pub smlib: Option<SmlibCheck>,
}
/// SMLib's verdict on a body.
#[derive(Clone, Debug)]
pub enum SmlibCheck {
Valid,
Invalid(String),
/// The record can't be built in SMLib yet (a geometry kind the conversion doesn't take): no
/// verdict, and no fault of the body's.
NotSupported(String),
}
impl Validity {
pub fn ok(&self) -> bool {
self.record.is_ok() && self.smlib.as_ref().is_none_or(Result::is_ok)
self.record.is_ok() && !matches!(self.smlib, Some(SmlibCheck::Invalid(_)))
}
}
@@ -30,16 +40,23 @@ pub fn validity(body: &Body) -> Validity {
}
#[cfg(feature = "smlib")]
fn smlib_validity(body: &Body) -> Option<Result<(), String>> {
let checked = crate::smlib_body(body).map_err(|e| e.to_string()).and_then(|b| {
let r = b.check(solidcraft_smlib::CheckLevel::All).map_err(|e| format!("SMLib check: {e}"))?;
if r.is_valid() { Ok(()) } else { Err(format!("SMLib check: {r}")) }
});
Some(checked)
fn smlib_validity(body: &Body) -> Option<SmlibCheck> {
let b = match crate::smlib_body(body) {
Ok(b) => b,
Err(e) => {
let e = e.to_string();
return Some(if e.contains("not supported yet") { SmlibCheck::NotSupported(e) } else { SmlibCheck::Invalid(e) });
}
};
Some(match b.check(solidcraft_smlib::CheckLevel::All) {
Ok(r) if r.is_valid() => SmlibCheck::Valid,
Ok(r) => SmlibCheck::Invalid(format!("SMLib check: {r}")),
Err(e) => SmlibCheck::Invalid(format!("SMLib check: {e}")),
})
}
#[cfg(not(feature = "smlib"))]
fn smlib_validity(_: &Body) -> Option<Result<(), String>> {
fn smlib_validity(_: &Body) -> Option<SmlibCheck> {
None
}