fix(skills): refresh Boolean checking facts that fail on current release (#1835) (#2093)

* fix(skills): refresh Boolean checking facts that fail on current release (#1835)

* fix(skills): restore warning coverage in test_run and use present tense in Boolean facts

* fix(skills): the slot keeps its side at zero since the solver takes the shortest step

The upstream solver now takes the shortest step that fits (#2060), so the slot
that other constraints also held slides to the origin when the distance reaches
0 and keeps the side it was drawn on when the value comes back. It no longer
comes back mirrored, so the trap and its test state the current behaviour.

---------

Co-authored-by: jeremymiribung-blip <jeremymiribung-blip@users.noreply.github.com>
This commit is contained in:
JEREMY
2026-10-21 00:41:45 +00:00
committed by GitHub
parent 316b49cd84
commit 382680d8e8
4 changed files with 55 additions and 56 deletions
@@ -38,19 +38,16 @@ def test_flags_underconstrained_sketch(tmp_path):
def test_reports_step_warnings(tmp_path):
result = report(tmp_path, [
{"command": "sketch.create", "params": {"plane": "XY", "offset": "12 mm", "name": "Plate"}},
{"command": "sketch.rectangle.center", "params": {"center": [0, 0], "corner": [40, 40]}},
{"command": "sketch.finish", "params": {}},
{"command": "solid.extrude", "params": {"sketch": "Plate", "distance": "12 mm", "direction": "negative",
"body_name": "P"}},
{"command": "sketch.create", "params": {"plane": "XY", "name": "Hole"}},
{"command": "sketch.circle.center", "params": {"center": [0, 0], "diameter": 20}},
{"command": "sketch.finish", "params": {}},
{"command": "solid.extrude", "params": {"sketch": "Hole", "distance": "12 mm", "taper": "-20 deg",
"operation": "cut", "targets": ["P"], "name": "Flush cut"}},
{"command": "parameters.add", "params": {"name": "h", "expression": "5 mm"}},
{"command": "solid.box", "params": {"length": 91, "width": 62, "height": 30, "center": [0, 0, 15], "body_name": "Case"}},
{"command": "solid.fillet", "params": {"edges": [[45.5, 31, 15], [-45.5, 31, 15], [45.5, -31, 15], [-45.5, -31, 15]], "radius": 3}},
{"command": "solid.shell", "params": {"faces": [[0, 0, 30]], "thickness": 2}},
{"command": "solid.fillet", "params": {"edges": [[0, -31, 30]], "radius": 1}},
{"command": "solid.cylinder", "params": {"diameter": "6 mm", "height": "h", "base": [-39, -24.5, 2], "operation": "join", "targets": ["Case"], "name": "Standoff"}},
{"command": "solid.cylinder", "params": {"diameter": "2.5 mm", "height": "h", "base": [-39, -24.5, 2], "operation": "cut", "targets": ["Case"], "name": "Pilot"}},
])
assert result.returncode == 0, result.stderr
assert 'WARN "Flush cut": Boolean retry' in result.stdout
assert 'WARN "Pilot": Boolean retry' in result.stdout
def test_fails_on_a_bad_step(tmp_path):
@@ -86,40 +83,38 @@ def test_execute_raises_on_failure():
@pytest.fixture
def flush_design(tmp_path):
"""A cut 10 mm deep into a 12 mm plate; at depth 13 mm its tapered end lies on the plate top."""
design = tmp_path / "plate.json"
"""A shelled case with a joined standoff and a cut pilot hole; Pilot warns tool displacement."""
design = tmp_path / "standoff.json"
built = report(tmp_path, [
{"command": "parameters.add", "params": {"name": "depth", "expression": "10 mm"}},
{"command": "sketch.create", "params": {"plane": "XY", "name": "Plate sketch"}},
{"command": "sketch.rectangle.center", "params": {"center": [0, 0], "corner": [40, 40]}},
{"command": "sketch.finish", "params": {}},
{"command": "solid.extrude", "params": {"sketch": "Plate sketch", "distance": "12 mm", "body_name": "P"}},
{"command": "sketch.create", "params": {"plane": "XY", "offset": "-1 mm", "name": "Cut sketch"}},
{"command": "sketch.circle.center", "params": {"center": [5, 5], "diameter": 20}},
{"command": "sketch.finish", "params": {}},
{"command": "solid.extrude", "params": {"sketch": "Cut sketch", "distance": "depth", "taper": "10 deg",
"operation": "cut", "targets": ["P"], "name": "Cut"}},
{"command": "parameters.add", "params": {"name": "h", "expression": "5 mm"}},
{"command": "solid.box", "params": {"length": 91, "width": 62, "height": 30, "center": [0, 0, 15], "body_name": "Case"}},
{"command": "solid.fillet", "params": {"edges": [[45.5, 31, 15], [-45.5, 31, 15], [45.5, -31, 15], [-45.5, -31, 15]], "radius": 3}},
{"command": "solid.shell", "params": {"faces": [[0, 0, 30]], "thickness": 2}},
{"command": "solid.fillet", "params": {"edges": [[0, -31, 30]], "radius": 1}},
{"command": "solid.cylinder", "params": {"diameter": "6 mm", "height": "h", "base": [-39, -24.5, 2], "operation": "join", "targets": ["Case"], "name": "Standoff"}},
{"command": "solid.cylinder", "params": {"diameter": "2.5 mm", "height": "h", "base": [-39, -24.5, 2], "operation": "cut", "targets": ["Case"], "name": "Pilot"}},
], "--save", design)
assert built.returncode == 0 and "WARN" not in built.stdout, built.stdout + built.stderr
assert built.returncode == 0, built.stdout + built.stderr
return design
def depth(value: str) -> dict:
return {"command": "parameters.change", "params": {"name": "depth", "expression": value}}
return {"command": "parameters.change", "params": {"name": "h", "expression": value}}
def test_reports_warnings_after_a_parameter_change(tmp_path, flush_design):
flush = report(tmp_path, [depth("13 mm")], "--in", flush_design)
assert 'WARN "Cut": Boolean retry' in flush.stdout
flush = report(tmp_path, [depth("7 mm")], "--in", flush_design)
assert flush.returncode == 0, flush.stderr
assert 'WARN "Pilot": Boolean retry' in flush.stdout
def test_reports_every_inspection_in_the_script(tmp_path, flush_design):
walk = report(tmp_path, [depth("13 mm"), {"command": "document.inspect", "params": {"measure": True}},
depth("10 mm")], "--in", flush_design)
walk = report(tmp_path, [depth("7 mm"), {"command": "document.inspect", "params": {"measure": True}},
depth("5 mm")], "--in", flush_design)
lines = walk.stdout.splitlines()
assert any(line.startswith('step 2 WARN "Cut": Boolean retry') for line in lines), walk.stdout
assert any(line.startswith("step 2 BODY P: volume") for line in lines)
assert not any(line.startswith("WARN") for line in lines)
assert any(line.startswith('step 2 WARN "Pilot": Boolean retry') for line in lines)
assert any(line.startswith("step 2 BODY Case: volume") for line in lines)
assert any(line.startswith('WARN "Pilot": Boolean retry') for line in lines)
def test_reports_bodies_inspected_without_measurements(tmp_path):