From 5c45570c91526bd8c96b89d4da168f486c3bc4f9 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:44:26 -0400 Subject: [PATCH] Kernel rig: rustfmt; measured values in results are decimals, within tolerance; the ladder records 06/023 passing The single results form compares a whole number exactly (a count). The construction and inspect cases gave positions and volumes as whole numbers, which the form they were written for compared within tolerance; they are decimals now. The NPT groove fix makes ladder 06/023 pass: its golden entry is the passing run (51 faces, 8226.4042 mm3). Co-Authored-By: Claude Opus 5.5 --- apps/solidcraft-cli/src/kernel_cases.rs | 7 +------ crates/doc/src/eval_thread.rs | 6 +----- .../expected.json | 6 +++--- .../cov-center-of-mass-box/expected.json | 6 +++--- .../expected.json | 12 ++++++------ .../expected.json | 6 +++--- .../expected.json | 6 +++--- .../expected.json | 18 +++++++++--------- .../cov-isocurve-cube-top/expected.json | 4 ++-- tests/kernel-cases/ladder/golden.json | 16 ++++++++-------- xtask/src/kernel_ladder.rs | 3 ++- 11 files changed, 41 insertions(+), 49 deletions(-) diff --git a/apps/solidcraft-cli/src/kernel_cases.rs b/apps/solidcraft-cli/src/kernel_cases.rs index 12fd7c339..d07d8ca17 100644 --- a/apps/solidcraft-cli/src/kernel_cases.rs +++ b/apps/solidcraft-cli/src/kernel_cases.rs @@ -616,12 +616,7 @@ fn flat_pattern_checks(c: &mut Checks, want: &Value, results: &[Value], rel: f64 let (a, b) = (v.get(0)?, v.get(1)?); Some([a.get(0)?.as_f64()?, a.get(1)?.as_f64()?, b.get(0)?.as_f64()?, b.get(1)?.as_f64()?]) }; - let mut left: Vec<[f64; 4]> = got["bends"] - .as_array() - .into_iter() - .flatten() - .filter_map(|b| line(&json!([b["start"], b["end"]]))) - .collect(); + let mut left: Vec<[f64; 4]> = got["bends"].as_array().into_iter().flatten().filter_map(|b| line(&json!([b["start"], b["end"]]))).collect(); let got_lines = json!(left.iter().map(|l| [[l[0], l[1]], [l[2], l[3]]]).collect::>()); let near = |p: [f64; 4], q: [f64; 4]| (0..4).all(|k| (p[k] - q[k]).abs() <= abs); let mut ok = left.len() == w.len(); diff --git a/crates/doc/src/eval_thread.rs b/crates/doc/src/eval_thread.rs index b4427be8c..9bc4d941e 100644 --- a/crates/doc/src/eval_thread.rs +++ b/crates/doc/src/eval_thread.rs @@ -473,11 +473,7 @@ fn thread_grooves( let section_of = |g: &crate::thread_forms::GrooveProfile| -> (Vec, f64) { let (tl, th) = (g.flank_lo.tan(), g.flank_hi.tan()); if taper.is_none() { - let (r0, r1) = if t.internal { - (radius.min(g.crest_r) - 0.1 * p, g.root_r) - } else { - (g.root_r, radius.max(d / 2.0) + 0.05 * p) - }; + let (r0, r1) = if t.internal { (radius.min(g.crest_r) - 0.1 * p, g.root_r) } else { (g.root_r, radius.max(d / 2.0) + 0.05 * p) }; let ((lo0, hi0), (lo1, hi1)) = (g.extents(p, r0), g.extents(p, r1)); let wide = g.width(p, if t.internal { r0 } else { r1 }); return (vec![Vec2::new(r0, -lo0), Vec2::new(r1, -lo1), Vec2::new(r1, hi1), Vec2::new(r0, hi0)], wide); diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json index c20f419e4..a80f222f4 100644 --- a/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json @@ -22,9 +22,9 @@ "step": 3, "pointer": "/bodies/1/center", "json": [ - 60, - 0, - 5 + 60.0, + 0.0, + 5.0 ] }, { diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json b/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json index b6d028993..655d3ef01 100644 --- a/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json @@ -8,9 +8,9 @@ "step": 2, "pointer": "/center", "json": [ - 20, - 15, - 10 + 20.0, + 15.0, + 10.0 ] }, { diff --git a/tests/kernel-cases/inspect/cov-clearance-gap-between-two-spheres/expected.json b/tests/kernel-cases/inspect/cov-clearance-gap-between-two-spheres/expected.json index 108cd41fb..fefc66e17 100644 --- a/tests/kernel-cases/inspect/cov-clearance-gap-between-two-spheres/expected.json +++ b/tests/kernel-cases/inspect/cov-clearance-gap-between-two-spheres/expected.json @@ -28,18 +28,18 @@ "step": 3, "pointer": "/near/0/from", "json": [ - 5, - 0, - 0 + 5.0, + 0.0, + 0.0 ] }, { "step": 3, "pointer": "/near/0/to", "json": [ - 15, - 0, - 0 + 15.0, + 0.0, + 0.0 ] } ] diff --git a/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json b/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json index 16f8a2a5e..10c4e5007 100644 --- a/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json +++ b/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json @@ -13,9 +13,9 @@ "step": 3, "pointer": "/overlaps/0/center", "json": [ - 4, - 0, - 0 + 4.0, + 0.0, + 0.0 ] } ] diff --git a/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json b/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json index 3c1afa071..1c71afeb5 100644 --- a/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json +++ b/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json @@ -18,9 +18,9 @@ "step": 3, "pointer": "/interferences/0/center", "json": [ - 10, - 10, - 10 + 10.0, + 10.0, + 10.0 ] } ] diff --git a/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json b/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json index 1feba5a2b..7983b736f 100644 --- a/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json +++ b/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json @@ -23,27 +23,27 @@ "step": 3, "pointer": "/interferences/0/center", "json": [ - 35, - 25, - 15 + 35.0, + 25.0, + 15.0 ] }, { "step": 3, "pointer": "/interferences/0/bbox/min", "json": [ - 30, - 20, - 10 + 30.0, + 20.0, + 10.0 ] }, { "step": 3, "pointer": "/interferences/0/bbox/max", "json": [ - 40, - 30, - 20 + 40.0, + 30.0, + 20.0 ] } ] diff --git a/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json b/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json index 46ccc59d7..ff38fb408 100644 --- a/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json +++ b/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json @@ -17,12 +17,12 @@ { "step": 2, "pointer": "/faces/0/u_curves", - "json": 3 + "json": 3.0 }, { "step": 2, "pointer": "/faces/0/v_curves", - "json": 3 + "json": 3.0 } ] } diff --git a/tests/kernel-cases/ladder/golden.json b/tests/kernel-cases/ladder/golden.json index 13c200d8b..55ccea7e7 100644 --- a/tests/kernel-cases/ladder/golden.json +++ b/tests/kernel-cases/ladder/golden.json @@ -1106,15 +1106,15 @@ }, "ladder/06-threads/023-external-1-2-npt": { "measured": { - "area_mm2": 3317.0130177354845, + "area_mm2": 3023.0574338103247, "body_count": 1, - "edges": 144, - "faces": 63, - "vertices": 83, - "volume_mm3": 8227.34635260655 + "edges": 119, + "faces": 51, + "vertices": 70, + "volume_mm3": 8226.404188726101 }, - "seconds": 1.619294352, - "status": "fail" + "seconds": 1.41498452, + "status": "pass" }, "ladder/06-threads/024-internal-rc-1-2-taper": { "measured": { @@ -1993,5 +1993,5 @@ "status": "pass" } }, - "reason": "SMLib 60b1c6a: tiers 05 and 06 take the UNC, UNF, Rc and NPT tapped holes, the pipe threads, the steep flank and the tip options, tier 12 (sheet metal) is new; the 139 cases before keep their statuses and counts, their volumes and areas re-measured within 2e-6" + "reason": "06/023 (1/2-14 NPT) passes: a taper thread's groove follows its crest cone, so no sliver of the flanks is left (volume 8226.4042 against the standard's 8226.4049); the other cases as recorded on SMLib 60b1c6a" } diff --git a/xtask/src/kernel_ladder.rs b/xtask/src/kernel_ladder.rs index 5e384c7a5..7ea61f219 100644 --- a/xtask/src/kernel_ladder.rs +++ b/xtask/src/kernel_ladder.rs @@ -318,7 +318,8 @@ mod tests { "ladder/01-a/001-x": {"status": "pass", "seconds": 1.0, "measured": {"faces": 6}}, "ladder/01-a/002-y": {"status": "fail", "seconds": 1.0} }}); - let run = |x: Value, y: Value| gate(&t, &BTreeMap::from([("ladder/01-a/001-x".to_string(), x), ("ladder/01-a/002-y".to_string(), y)]), &golden); + let run = + |x: Value, y: Value| gate(&t, &BTreeMap::from([("ladder/01-a/001-x".to_string(), x), ("ladder/01-a/002-y".to_string(), y)]), &golden); // Ten times slower is the machine, not a change. assert!(run(json!({"status": "pass", "seconds": 10.0, "measured": {"faces": 6}}), json!({"status": "fail"})).is_ok()); let fixed = run(json!({"status": "pass", "measured": {"faces": 6}}), json!({"status": "pass"})).unwrap_err();