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 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-29 19:44:26 -04:00
committed by Irakli Kourtis
parent 80d08659f3
commit 5c45570c91
11 changed files with 41 additions and 49 deletions
+1 -6
View File
@@ -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::<Vec<_>>());
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();
+1 -5
View File
@@ -473,11 +473,7 @@ fn thread_grooves(
let section_of = |g: &crate::thread_forms::GrooveProfile| -> (Vec<Vec2>, 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);
@@ -22,9 +22,9 @@
"step": 3,
"pointer": "/bodies/1/center",
"json": [
60,
0,
5
60.0,
0.0,
5.0
]
},
{
@@ -8,9 +8,9 @@
"step": 2,
"pointer": "/center",
"json": [
20,
15,
10
20.0,
15.0,
10.0
]
},
{
@@ -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
]
}
]
@@ -13,9 +13,9 @@
"step": 3,
"pointer": "/overlaps/0/center",
"json": [
4,
0,
0
4.0,
0.0,
0.0
]
}
]
@@ -18,9 +18,9 @@
"step": 3,
"pointer": "/interferences/0/center",
"json": [
10,
10,
10
10.0,
10.0,
10.0
]
}
]
@@ -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
]
}
]
@@ -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
}
]
}
+8 -8
View File
@@ -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"
}
+2 -1
View File
@@ -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();