Official Codebase of 3DCodeVerse
Python
tests: threejs_render, urdf_joints, blender_cadquery, third pass — subprocess boots fold (166 → 120, −283 lines)
gaoypeng455a3ad2f2d3
diff --git a/harness/tests/blender_cadquery/test_artifact_stage.py b/harness/tests/blender_cadquery/test_artifact_stage.pyindex adb70f83..0ebbd909 100644--- a/harness/tests/blender_cadquery/test_artifact_stage.py+++ b/harness/tests/blender_cadquery/test_artifact_stage.py@@ -13,7 +13,7 @@ def _seed(ws: Workspace) -> None:(meshes / "old.glb").write_bytes(b"old mesh")-def test_enter_invalidates_immediately_and_exit_discards(tmp_ws: Workspace) -> None:+def test_stage_invalidates_on_enter_discards_on_exit_and_promotes(tmp_ws: Workspace) -> None:_seed(tmp_ws)with tmp_ws.stage_artifacts("build.json", "object.glb", "meshes") as stage:# the previous round's outputs are gone BEFORE any work (or early return) happens@@ -27,16 +27,14 @@ def test_enter_invalidates_immediately_and_exit_discards(tmp_ws: Workspace) -> Nstaging_root = tmp_ws.artifacts / ".staging"assert not staging_root.exists() or not any(staging_root.iterdir())--def test_default_promote_skips_names_never_written(tmp_ws: Workspace) -> None:+ # the default promote skips names never writtenwith tmp_ws.stage_artifacts("build.json", "object.stl") as stage:stage.path("build.json").write_text('{"ok": true}')published = stage.promote() # object.stl was never staged → skipped, not an errorassert [p.name for p in published] == ["build.json"]assert not (tmp_ws.artifacts / "object.stl").exists()--def test_promote_replaces_an_existing_dir(tmp_ws: Workspace) -> None:+ # promote replaces an existing dirmeshes = tmp_ws.artifacts / "meshes"meshes.mkdir()(meshes / "old.glb").write_bytes(b"old")diff --git a/harness/tests/blender_cadquery/test_blender_layout.py b/harness/tests/blender_cadquery/test_blender_layout.pyindex 4fddadfa..8586e4f1 100644--- a/harness/tests/blender_cadquery/test_blender_layout.py+++ b/harness/tests/blender_cadquery/test_blender_layout.py@@ -42,15 +42,6 @@ def _write(ws, rel: str, text: str) -> Path:return p-def test_lint_workspace_reports_a_source_too_deep_to_parse_instead_of_crashing(tmp_ws) -> None:- """A literal nested past the parser's stack is a finding, not a MemoryError that kills the round."""- deep = "x = " + "-" * 20_000 + "1\n"- _write(tmp_ws, "src/model.py", deep)- _write(tmp_ws, "src/parts/seat.py", deep)- rep = lint_workspace(tmp_ws)- assert not rep.passed and {f.target for f in rep.errors} >= {"src/model.py", "src/parts/seat.py"}--def test_lint_workspace_layout_rules(tmp_ws) -> None:_write(tmp_ws, "src/model.py", MODEL)_write(tmp_ws, "src/parts/seat.py", SEAT.replace("def build_seat", "def build_seat_cushion")) # wrong export@@ -70,8 +61,14 @@ def test_lint_workspace_layout_rules(tmp_ws) -> None:assert all(f.fix_hint for f in rep.errors)-def test_lint_workspace_forbidden_calls_in_part_files_and_missing_entry(tmp_ws) -> None:+def test_lint_workspace_missing_entry_too_deep_source_and_forbidden_calls(tmp_ws) -> None:assert not lint_workspace(tmp_ws).passed # no model.py at all+ # a literal nested past the parser's stack is a finding, not a MemoryError that kills the round+ deep = "x = " + "-" * 20_000 + "1\n"+ _write(tmp_ws, "src/model.py", deep)+ _write(tmp_ws, "src/parts/seat.py", deep)+ rep = lint_workspace(tmp_ws)+ assert not rep.passed and {f.target for f in rep.errors} >= {"src/model.py", "src/parts/seat.py"}_write(tmp_ws, "src/model.py", MODEL)_write(tmp_ws, "src/parts/seat.py", SEAT + "\nbpy.ops.render.render()\n")_write(tmp_ws, "src/parts/leg.py", LEG)diff --git a/harness/tests/blender_cadquery/test_blender_lint.py b/harness/tests/blender_cadquery/test_blender_lint.pyindex 7766c36e..45986e39 100644--- a/harness/tests/blender_cadquery/test_blender_lint.py+++ b/harness/tests/blender_cadquery/test_blender_lint.py@@ -22,6 +22,8 @@ bm.from_mesh(obj.data)bm.verts.ensure_lookup_table()v = bm.verts[0]bm.free()+with bpy.context.temp_override(object=obj):+ bpy.ops.object.modifier_apply(modifier='Bevel')'''@@ -34,6 +36,7 @@ def test_good_script_passes() -> None:assert r.gate == "lint:blender" and r.passed, _msgs(r)assert not _msgs(r, Severity.ERROR)assert any("Body" in m for m in _msgs(r, Severity.INFO))+ assert not any("modifier_apply" in m for m in _msgs(r, Severity.WARN)) # temp_override is the fix, not a pitfalldef test_missing_bpy_import_and_forbidden_calls() -> None:@@ -110,9 +113,3 @@ def test_headless_pitfalls() -> None:assert any("selected_objects" in m for m in w)assert any("context-dict" in m for m in e)assert any("use_auto_smooth" in m for m in e)---def test_modifier_apply_with_temp_override_is_fine() -> None:- src = "import bpy\nobj = bpy.context.object\nwith bpy.context.temp_override(object=obj):\n bpy.ops.object.modifier_apply(modifier='Bevel')\nobj.name = 'Body'\n"- r = lint_blender_source(src)- assert not any("modifier_apply" in m for m in _msgs(r, Severity.WARN))diff --git a/harness/tests/blender_cadquery/test_blender_live_gates.py b/harness/tests/blender_cadquery/test_blender_live_gates.pyindex aaa3845c..78b3b4fd 100644--- a/harness/tests/blender_cadquery/test_blender_live_gates.py+++ b/harness/tests/blender_cadquery/test_blender_live_gates.py@@ -37,7 +37,33 @@ def test_lint_bsdf_table_matches_real_principled_inputs(blender_bin) -> None:assert expected <= real, f"missing from Blender: {sorted(expected - real)}"-EXCLUDED_MODEL = '''import bpy+#: one build for three census findings: excluded-collection objects, unused / past-the-end+#: material slots (read off the EVALUATED mesh inside Blender, not a fixture), and a light+CENSUS_MODEL = '''import bmesh+import bpy+++def part(name, n_slots, location):+ me = bpy.data.meshes.new(name)+ bm = bmesh.new()+ bmesh.ops.create_cube(bm, size=0.2)+ bm.to_mesh(me)+ bm.free()+ for i in range(n_slots):+ me.materials.append(bpy.data.materials.new(f"{name}Mat{i}"))+ obj = bpy.data.objects.new(name, me)+ obj.location = location+ bpy.context.collection.objects.link(obj)+ return obj+++part("FlatArm", 3, (0, 0, 0.1)) # 3 materials, every polygon on slot 0+painted = part("PaintedArm", 3, (0.5, 0, 0.1))+for i, poly in enumerate(painted.data.polygons):+ poly.material_index = i % 3+overrun = part("OverrunArm", 1, (1.0, 0, 0.1))+for poly in overrun.data.polygons:+ poly.material_index = 2 # past the last slot: Blender clampsbpy.ops.mesh.primitive_cube_add(size=1, location=(0, 0, 0.5))main = bpy.context.object@@ -54,23 +80,36 @@ for c in list(extra.users_collection):c.objects.unlink(extra)coll.objects.link(extra)bpy.context.view_layer.layer_collection.children["Extra"].exclude = True++bpy.ops.object.light_add(type="SUN")'''@pytest.mark.blender-def test_census_matches_export_for_excluded_collections(tmp_ws, blender_bin) -> None:- """Finding: excluded-collection objects were counted in tri_count/bbox but never exported."""+def test_census_matches_export_and_reports_what_the_export_hides(tmp_ws, blender_bin) -> None:+ """Finding: excluded-collection objects were counted in tri_count/bbox but never exported.+ Plus the census warnings a model sees: unused / clamped material slots, a script light."""trimesh = pytest.importorskip("trimesh")rt = BlenderRuntime(blender=blender_bin)- (tmp_ws.src / "model.py").write_text(EXCLUDED_MODEL)+ (tmp_ws.src / "model.py").write_text(CENSUS_MODEL)r = rt.build(tmp_ws, timeout_s=120)assert r.ok, (r.error_type, r.error_message)c = r.censusrec = {o["name"]: o for o in c["objects"]}assert rec["InColl"]["in_scene"] and not rec["InColl"]["in_view_layer"] and rec["InColl"]["hidden"]- assert c["tri_count"] == 12 and c["n_mesh_objects"] == 1 # Main only+ assert c["tri_count"] == 4 * 12 and c["n_mesh_objects"] == 4 # Main + the three arms, never InCollassert c["scene_bbox_max"][2] <= 1.0 + 1e-4 # bbox not stretched to (10,10,10)- assert any("excluded from the view layer" in w and "InColl" in w for w in c["warnings"])- assert not any("no material" in w for w in c["warnings"]) # no spurious warning for InColl+ warns = c["warnings"]+ assert any("excluded from the view layer" in w and "InColl" in w for w in warns)+ assert not any("no material" in w for w in warns) # no spurious warning for InCollscene = trimesh.load(r.glb_path)- assert set(scene.graph.nodes_geometry) == {"Main"} # census now matches the export+ # census matches the export (a multi-material mesh loads as one node per material: <name>_<hash>)+ meshes = {"Main", "FlatArm", "PaintedArm", "OverrunArm"}+ assert {n if n in meshes else n.rsplit("_", 1)[0] for n in scene.graph.nodes_geometry} == meshes+ assert rec["FlatArm"]["material_indices_used"] == [0]+ assert rec["PaintedArm"]["material_indices_used"] == [0, 1, 2]+ (unused,) = [w for w in warns if "slots no polygon uses" in w]+ assert "'FlatArm' (3 slots, 1 used)" in unused and "PaintedArm" not in unused+ (clamped,) = [w for w in warns if "past the last slot" in w]+ assert "'OverrunArm'" in clamped+ assert any("light" in w for w in warns)diff --git a/harness/tests/blender_cadquery/test_blender_multifile.py b/harness/tests/blender_cadquery/test_blender_multifile.pyindex 84db89ed..d79e99f8 100644--- a/harness/tests/blender_cadquery/test_blender_multifile.py+++ b/harness/tests/blender_cadquery/test_blender_multifile.py@@ -1,6 +1,6 @@-"""Multi-file blender models on the real binary: the 4-part skeleton builds; a hand-written-2-part model builds and its errors map to the failing PART file + line; the prompt-examples (contract.md example A, cookbook "File layout") build and export."""+"""Multi-file blender models on the real binary: a hand-written 2-part model's errors map to+the failing PART file + line; the prompt examples (contract.md example A, cookbook "File+layout") build and export. (The multi-file skeleton build is test_blender_runtime's.)"""from __future__ import annotations@@ -10,7 +10,6 @@ from pathlib import Pathimport pytest-from codeverse3d.contracts.plan import BBox, PartPlan, StaticPlanfrom codeverse3d.languages.blender import BlenderRuntimefrom codeverse3d.prompts import PROMPTS_DIRfrom codeverse3d.workspace import Workspace@@ -73,53 +72,11 @@ main()'''-def four_part_plan() -> StaticPlan:- return StaticPlan(- object_name="Stool", summary="A bar stool with a round seat, a ring footrest and four legs.",- overall_bbox=BBox(center=(0, 0, 0.375), extents=(0.4, 0.4, 0.75)),- parts=[- PartPlan(name="Seat", role="seat", description="round padded seat", material="brown leather",- bbox=BBox(center=(0, 0, 0.73), extents=(0.36, 0.36, 0.04))),- PartPlan(name="Leg", role="support", description="steel tube leg", material="chrome steel",- bbox=BBox(center=(0.15, 0.15, 0.355), extents=(0.025, 0.025, 0.71)), attach_to="Seat",- instances=4, symmetry="mirror_x"),- PartPlan(name="FootRing", role="footrest", description="ring connecting the legs", material="chrome steel",- bbox=BBox(center=(0, 0, 0.25), extents=(0.33, 0.33, 0.02)), attach_to="Leg"),- PartPlan(name="SeatPlate", role="mount", description="plate under the seat", material="black steel",- bbox=BBox(center=(0, 0, 0.705), extents=(0.3, 0.3, 0.01)), attach_to="Seat"),- ],- )---def test_live_four_part_multifile_skeleton_builds(tmp_ws, four_part_plan, blender_bin) -> None:- trimesh = pytest.importorskip("trimesh")- rt = BlenderRuntime(blender=blender_bin)- paths = rt.skeleton(tmp_ws, four_part_plan)- assert [p.relative_to(tmp_ws.root).as_posix() for p in paths] == [- "src/model.py", "src/parts/seat.py", "src/parts/leg.py", "src/parts/foot_ring.py", "src/parts/seat_plate.py"]- assert rt.expected_files(four_part_plan) == [p.relative_to(tmp_ws.root).as_posix() for p in paths] # the layout IS the skeleton- lint = rt.lint(tmp_ws)- assert lint.passed, [(f.target, f.message) for f in lint.errors]- r = rt.build(tmp_ws, timeout_s=120)- assert r.ok, (r.error_type, r.error_message, r.error_file, r.error_line, r.stderr_tail)- scene = trimesh.load(r.glb_path)- assert set(scene.graph.nodes_geometry) == {"Seat", "Leg_0", "Leg_1", "Leg_2", "Leg_3", "FootRing", "SeatPlate"}- lo, hi = scene.bounds- assert abs(lo[1]) < 1e-4 and abs(hi[1] - 0.75) < 1e-3- assert "[selfcheck]" in r.stdout_tail--@pytest.mark.blenderdef test_live_multifile_errors_map_to_part_file_and_line(tmp_ws, blender_bin) -> None:rt = BlenderRuntime(blender=blender_bin)_write_files(tmp_ws, {"src/model.py": MODEL, "src/parts/seat.py": SEAT, "src/parts/leg.py": LEG})assert rt.lint(tmp_ws).passed- r = rt.build(tmp_ws, timeout_s=120)- assert r.ok, (r.error_type, r.error_message)- assert {o["name"] for o in r.census["objects"]} == {"Seat", "Legs", "Leg_0", "Leg_1", "Leg_2"}-leg = tmp_ws.src / "parts" / "leg.py"# (a) syntax error in the part file → src/parts/leg.py:8leg.write_text(LEG.replace(" for i in range(LEG_N):", " for i in range(LEG_N)"))diff --git a/harness/tests/blender_cadquery/test_blender_runtime.py b/harness/tests/blender_cadquery/test_blender_runtime.pyindex cd34d62b..bc4d0bc7 100644--- a/harness/tests/blender_cadquery/test_blender_runtime.py+++ b/harness/tests/blender_cadquery/test_blender_runtime.py@@ -2,7 +2,6 @@from __future__ import annotations-import jsonimport timefrom pathlib import Path@@ -12,7 +11,6 @@ from codeverse3d.languages.blender import (BlenderNotFoundError,BlenderRuntime,blender_env,- lint_blender_source,)@@ -38,13 +36,18 @@ def test_blender_env_scrubs_secrets_and_host_python(monkeypatch) -> None:def test_live_skeleton_builds_and_exports_canonical_glb(tmp_ws, table_plan, blender_bin) -> None:trimesh = pytest.importorskip("trimesh")rt = BlenderRuntime(blender=blender_bin)- rt.skeleton(tmp_ws, table_plan)- assert rt.lint(tmp_ws).passed+ paths = rt.skeleton(tmp_ws, table_plan)+ rels = [p.relative_to(tmp_ws.root).as_posix() for p in paths]+ assert rels == ["src/model.py", "src/parts/table_top.py", "src/parts/leg.py", "src/parts/shelf.py"]+ assert rt.expected_files(table_plan) == rels # the layout IS the skeleton+ lint = rt.lint(tmp_ws)+ assert lint.passed, [(f.target, f.message) for f in lint.errors]t0 = time.monotonic()r = rt.build(tmp_ws, timeout_s=120)dt = time.monotonic() - t0assert r.ok, (r.error_type, r.error_message, r.stderr_tail)assert dt < 60+ assert "[selfcheck]" in r.stdout_tailassert Path(r.extra_paths["stl"]).stat().st_size > 0scene = trimesh.load(r.glb_path)names = set(scene.graph.nodes_geometry)@@ -63,42 +66,12 @@ def test_live_skeleton_builds_and_exports_canonical_glb(tmp_ws, table_plan, blenassert abs(c["scene_bbox_min"][2]) < 1e-4 and abs(c["scene_bbox_max"][2] - 0.6) < 1e-3-BROKEN = '''import bpy-import bmesh--bpy.ops.mesh.primitive_cube_add(size=1)-body = bpy.context.object-body.name = "Body"-bpy.ops.object.light_add(type="SUN")-bm = bmesh.new()-bm.from_mesh(body.data)-v = bm.verts[0]-bm.free()-'''---def test_live_error_maps_to_line_and_lint_catches_it(tmp_ws, blender_bin) -> None:- rt = BlenderRuntime(blender=blender_bin)- (tmp_ws.src / "model.py").write_text(BROKEN)- lint = lint_blender_source(BROKEN)- assert not lint.passed and any("ensure_lookup_table" in f.message and f.data.get("line") == 10 for f in lint.errors)- r = rt.build(tmp_ws, timeout_s=120)- assert not r.ok and r.error_type == "IndexError" and r.error_file == "src/model.py" and r.error_line == 10- assert "ensure_lookup_table" in r.error_message- assert r.census["build_report"]["error_source"] == "v = bm.verts[0]"- assert any("light" in w for w in r.census["warnings"])- assert r.glb_path is None or Path(r.glb_path).stat().st_size > 0 # partial export may still exist- build_json = json.loads((tmp_ws.artifacts / "build.json").read_text())- assert build_json["error_line"] == 10--@pytest.mark.blenderdef test_live_timeout_and_memory_cap(tmp_ws, blender_bin) -> None:rt = BlenderRuntime(blender=blender_bin)(tmp_ws.src / "model.py").write_text("import bpy, time\nbpy.ops.mesh.primitive_cube_add(size=1)\nwhile True:\n time.sleep(0.1)\n")t0 = time.monotonic()- r = rt.build(tmp_ws, timeout_s=4)+ r = rt.build(tmp_ws, timeout_s=2)assert not r.ok and r.error_type == "BuildTimeout" and time.monotonic() - t0 < 20(tmp_ws.src / "model.py").write_text("import bpy\nimport numpy as np\nbpy.ops.mesh.primitive_cube_add(size=1)\nbig = np.ones((3_000_000_000,))\n")r = rt.build(tmp_ws, timeout_s=60)diff --git a/harness/tests/blender_cadquery/test_cadquery_lint.py b/harness/tests/blender_cadquery/test_cadquery_lint.pyindex 9dc66b2b..93ba727d 100644--- a/harness/tests/blender_cadquery/test_cadquery_lint.py+++ b/harness/tests/blender_cadquery/test_cadquery_lint.py@@ -10,12 +10,14 @@ def _msgs(r, sev=None):return [f.message for f in r.findings if sev is None or f.severity == sev]-def test_missing_result_and_guarded_result() -> None:+def test_missing_result_guarded_result_and_syntax_error() -> None:r = lint_cadquery_source("import cadquery as cq\nx = cq.Workplane().box(1, 1, 1)\n")assert not r.passed and any("module-level `result`" in m for m in _msgs(r, Severity.ERROR))r = lint_cadquery_source("import cadquery as cq\nif __name__ == '__main__':\n result = cq.Workplane().box(1, 1, 1)\n")f = [x for x in r.findings if "result" in x.message][0]assert f.severity == Severity.ERROR and "NOT under" in f.fix_hint+ r = lint_cadquery_source("import cadquery as cq\nresult = (\n")+ assert not r.passed and "SyntaxError" in r.findings[0].messagedef test_forbidden_imports_and_calls() -> None:@@ -56,8 +58,3 @@ def test_rotate_angle_expression_table() -> None:for expr in radians:r = lint_cadquery_source(_rotate_src(expr))assert not r.passed and any("DEGREES" in m for m in _msgs(r, Severity.ERROR)), (expr, _msgs(r))---def test_syntax_error() -> None:- r = lint_cadquery_source("import cadquery as cq\nresult = (\n")- assert not r.passed and "SyntaxError" in r.findings[0].messagediff --git a/harness/tests/blender_cadquery/test_cadquery_runtime.py b/harness/tests/blender_cadquery/test_cadquery_runtime.pyindex 96f847f4..a9264591 100644--- a/harness/tests/blender_cadquery/test_cadquery_runtime.py+++ b/harness/tests/blender_cadquery/test_cadquery_runtime.py@@ -59,7 +59,10 @@ def test_skeleton_builds_named_coloured_glb(tmp_ws, table_plan) -> None:@needs_cq-def test_assembly_with_subassembly_locations_and_bare_workplane(tmp_ws) -> None:+def test_assembly_selectors_and_bare_workplane(tmp_ws) -> None:+ """Sub-assembly locations/colours and trailing selectors in ONE assembly build; then the+ bare-Workplane and no-solid fallbacks. ``body.faces('>Z')`` / ``.edges('|Z')`` on the stack+ must not become a 2-triangle sheet / nothing."""trimesh = pytest.importorskip("trimesh")src = '''import cadquery as cqbase = cq.Workplane("XY").box(0.4, 0.4, 0.02).translate((0, 0, 0.01))@@ -70,13 +73,18 @@ pegs = cq.Assembly(name="Pegs", loc=cq.Location(cq.Vector(0, 0, 0.02)))pegs.add(peg, name="Peg_0", loc=cq.Location(cq.Vector(0.1, -0.1, 0)), color=cq.Color(1, 0, 0))pegs.add(peg, name="Peg_1", loc=cq.Location(cq.Vector(-0.1, 0.1, 0)))result.add(pegs, name="Pegs", color=cq.Color(0, 1, 0))+body = cq.Workplane("XY").box(0.1, 0.1, 0.01).edges("|Z").fillet(0.002)+result.add(body.faces(">Z"), name="Plate", color=cq.Color("gray"))+result.add(cq.Workplane("XY").box(0.02, 0.02, 0.02).edges("|Z"), name="Leg")+f = cq.Workplane('XY').box(0.1, 0.1, 0.01).faces('>Z').val()+result.add(f, name='Sheet')'''(tmp_ws.src / "model.py").write_text(src)rt = CadQueryRuntime()r = rt.build(tmp_ws, timeout_s=120)assert r.ok, (r.error_type, r.error_message)scene = trimesh.load(r.glb_path)- assert set(scene.graph.nodes_geometry) == {"Base", "Peg_0", "Peg_1"}+ assert {"Base", "Peg_0", "Peg_1", "Plate", "Leg"} <= set(scene.graph.nodes_geometry)p0 = scene.geometry[scene.graph["Peg_0"][1]]lo, hi = p0.bounds# world: x=0.1, y=-0.1 → glb z=+0.1; z from 0.02 (sub-assembly loc) to 0.12@@ -85,15 +93,29 @@ result.add(pegs, name="Pegs", color=cq.Color(0, 1, 0))assert list(p0.visual.material.baseColorFactor[:3]) == [255, 0, 0]p1 = scene.geometry[scene.graph["Peg_1"][1]]assert list(p1.visual.material.baseColorFactor[:3]) == [0, 255, 0] # inherited from parent assembly+ parts = {p["name"]: p for p in r.census["parts"]}+ assert parts["Plate"]["n_solids"] == 1 and abs(parts["Plate"]["volume_m3"] - 0.1 * 0.1 * 0.01) < 2e-6+ assert parts["Leg"]["n_solids"] == 1 and parts["Leg"]["tri_count"] == 12+ warns = r.census["build_report"]["warnings"]+ assert any("'Plate'" in w and "Face" in w and "trailing selector" in w for w in warns), warns+ assert any("'Leg'" in w and "Edge" in w for w in warns), warns+ # a bare cq.Face added to an assembly stays a face but is flagged (n_solids == 0 surfaced)+ assert parts["Sheet"]["n_solids"] == 0+ assert any("'Sheet'" in w and "contains no solid" in w for w in warns), warns- # bare workplane → single node 'Object' + warning- (tmp_ws.src / "model.py").write_text("import cadquery as cq\nresult = cq.Workplane('XY').box(1, 1, 1)\n")+ # bare-Workplane result with a trailing selector → single node 'Object' + warning, parent solid exported+ (tmp_ws.src / "model.py").write_text("import cadquery as cq\nresult = cq.Workplane('XY').box(0.1, 0.1, 0.01).faces('>Z')\n")r = rt.build(tmp_ws, timeout_s=120)assert r.ok and r.census["result_kind"] == "single"+ assert r.census["parts"][0]["n_solids"] == 1 and r.census["parts"][0]["tri_count"] == 12assert trimesh.load(r.glb_path).graph.nodes_geometry == ["Object"]assert any("bare Workplane" in w for w in r.census["build_report"]["warnings"])build_json = json.loads((tmp_ws.artifacts / "build.json").read_text())assert build_json["ok"] is True+ # no solid anywhere in the chain (2D wires only) → a typed error naming the stack, not a silent sheet+ (tmp_ws.src / "model.py").write_text("import cadquery as cq\nresult = cq.Workplane('XY').rect(0.1, 0.1)\n")+ r = rt.build(tmp_ws, timeout_s=120)+ assert not r.ok and r.error_type == "ExportError" and "Wire" in r.error_message and "not a Solid" in r.error_messagedef _wrapper_module():@@ -154,43 +176,6 @@ def test_helper_module_error_and_missing_result_report_src_paths(tmp_ws) -> Noneassert not r.ok and r.error_type == "MissingResult" and r.error_file == "src/model.py"-@needs_cq-def test_trailing_selector_exports_parent_solid_with_warning(tmp_ws) -> None:- """``body.faces('>Z')`` / ``.edges('|Z')`` on the stack must not become a 2-triangle sheet / nothing."""- trimesh = pytest.importorskip("trimesh")- rt = CadQueryRuntime()- src = '''import cadquery as cq-body = cq.Workplane("XY").box(0.1, 0.1, 0.01).edges("|Z").fillet(0.002)-result = cq.Assembly()-result.add(body.faces(">Z"), name="Plate", color=cq.Color("gray"))-result.add(cq.Workplane("XY").box(0.02, 0.02, 0.02).edges("|Z"), name="Leg")-'''- (tmp_ws.src / "model.py").write_text(src)- r = rt.build(tmp_ws, timeout_s=120)- assert r.ok, (r.error_type, r.error_message)- parts = {p["name"]: p for p in r.census["parts"]}- assert parts["Plate"]["n_solids"] == 1 and abs(parts["Plate"]["volume_m3"] - 0.1 * 0.1 * 0.01) < 2e-6- assert parts["Leg"]["n_solids"] == 1 and parts["Leg"]["tri_count"] == 12- assert set(trimesh.load(r.glb_path).graph.nodes_geometry) == {"Plate", "Leg"}- warns = r.census["build_report"]["warnings"]- assert any("'Plate'" in w and "Face" in w and "trailing selector" in w for w in warns), warns- assert any("'Leg'" in w and "Edge" in w for w in warns), warns- # bare-Workplane result with a trailing selector: same fallback- (tmp_ws.src / "model.py").write_text("import cadquery as cq\nresult = cq.Workplane('XY').box(0.1, 0.1, 0.01).faces('>Z')\n")- r = rt.build(tmp_ws, timeout_s=120)- assert r.ok and r.census["parts"][0]["n_solids"] == 1 and r.census["parts"][0]["tri_count"] == 12- # no solid anywhere in the chain (2D wires only) → a typed error naming the stack, not a silent sheet- (tmp_ws.src / "model.py").write_text("import cadquery as cq\nresult = cq.Workplane('XY').rect(0.1, 0.1)\n")- r = rt.build(tmp_ws, timeout_s=120)- assert not r.ok and r.error_type == "ExportError" and "Wire" in r.error_message and "not a Solid" in r.error_message- # a bare cq.Face added to an assembly stays a face but is flagged (n_solids == 0 surfaced)- (tmp_ws.src / "model.py").write_text("import cadquery as cq\nf = cq.Workplane('XY').box(0.1, 0.1, 0.01).faces('>Z').val()\n"- "result = cq.Assembly()\nresult.add(f, name='Sheet')\n")- r = rt.build(tmp_ws, timeout_s=120)- assert r.ok and r.census["parts"][0]["n_solids"] == 0- assert any("'Sheet'" in w and "contains no solid" in w for w in r.census["build_report"]["warnings"])--def test_cadquery_env_scrubs_secrets(monkeypatch) -> None:"""src/model.py executes under this env: credential-shaped vars must not reach it."""monkeypatch.setenv("GEMINI_API_KEYS", "k")diff --git a/harness/tests/blender_cadquery/test_common.py b/harness/tests/blender_cadquery/test_common.pyindex 9bd3b461..7f83e477 100644--- a/harness/tests/blender_cadquery/test_common.py+++ b/harness/tests/blender_cadquery/test_common.py@@ -19,20 +19,15 @@ def _proc(**kw) -> ProcResult:return ProcResult(**base)-def test_compose_timeout(tmp_path: Path) -> None:- r = compose_build_result(language="blender", proc=_proc(timed_out=True, returncode=-9), build_json=tmp_path / "b.json",+def test_compose_build_result(tmp_path: Path) -> None:+ r = compose_build_result(language="blender", proc=_proc(timed_out=True, returncode=-9), build_json=tmp_path / "t.json",census_json=tmp_path / "c.json", glb_path=tmp_path / "o.glb", extra_paths={})assert not r.ok and r.error_type == "BuildTimeout"- assert json.loads((tmp_path / "b.json").read_text())["error_type"] == "BuildTimeout" # a timeout is published too---def test_compose_wrapper_crash(tmp_path: Path) -> None:- r = compose_build_result(language="blender", proc=_proc(returncode=2, stderr="Traceback: bad"), build_json=tmp_path / "b.json",+ assert json.loads((tmp_path / "t.json").read_text())["error_type"] == "BuildTimeout" # a timeout is published too+ r = compose_build_result(language="blender", proc=_proc(returncode=2, stderr="Traceback: bad"), build_json=tmp_path / "w.json",census_json=tmp_path / "c.json", glb_path=tmp_path / "o.glb", extra_paths={})assert not r.ok and r.error_type == "WrapperCrash" and "bad" in r.stderr_tail---def test_compose_ok_requires_glb(tmp_path: Path) -> None:+ # ok requires the GLBb = tmp_path / "build.json"report = {"ok": True, "error_type": "", "error_message": "", "duration_ms": 42, "warnings": ["w"]}write_json_atomic(b, report)diff --git a/harness/tests/blender_cadquery/test_material_slots.py b/harness/tests/blender_cadquery/test_material_slots.pyindex 38f251ce..317fd0e4 100644--- a/harness/tests/blender_cadquery/test_material_slots.py+++ b/harness/tests/blender_cadquery/test_material_slots.py@@ -1,4 +1,6 @@-"""The census warns about material slots the polygons never use (a judge-capped flat-colour run)."""+"""The census warns about material slots the polygons never use (a judge-capped flat-colour run).++The real-Blender end-to-end build is test_blender_live_gates.py's census test."""from __future__ import annotations@@ -6,10 +8,6 @@ import importlib.utilfrom pathlib import Pathfrom typing import Any-import pytest--from codeverse3d.languages.blender import BlenderRuntime-CENSUS = Path(__file__).resolve().parents[2] / "codeverse3d" / "languages" / "wrappers" / "_census.py"@@ -27,7 +25,7 @@ def _mesh(name: str, n_slots: int, used: list[int]) -> dict[str, Any]:return {"name": name, "type": "MESH", "n_material_slots": n_slots, "material_indices_used": used}-def test_unused_slots_warn_and_a_fully_painted_mesh_does_not() -> None:+def test_material_slot_warnings() -> None:warn = _census_module().material_slot_warningsassert warn([_mesh("Body", 1, [0])]) == [] # the normal case: one material, one colourassert warn([_mesh("Arm", 3, [0, 1, 2])]) == [] # every slot reached by some polygon@@ -36,62 +34,12 @@ def test_unused_slots_warn_and_a_fully_painted_mesh_does_not() -> None:assert "'StandArm' (11 slots, 1 used)" in only and "material_index" in only(partial,) = warn([_mesh("Head", 4, [0, 2])])assert "'Head' (4 slots, 2 used)" in partial---def test_index_past_the_last_slot_is_its_own_warning() -> None:- warn = _census_module().material_slot_warnings+ # an index past the last slot is its own warning(only,) = warn([_mesh("Tube", 2, [0, 1, 5])])assert "'Tube' (index 5, 2 slot(s))" in only and "clamps" in only# a clamped mesh is reported once, not twice: the unused-slot line would be noise hereassert "slots no polygon uses" not in only---def test_many_offenders_collapse_into_one_capped_warning() -> None:- """The build shows 10 warnings; a systemic no-op must not evict the other nine."""- warn = _census_module().material_slot_warnings+ # many offenders collapse into one capped warning: the build shows 10 warnings, a+ # systemic no-op must not evict the other nine(only,) = warn([_mesh(f"Part{i}", 4, [0]) for i in range(9)])assert "(+3 more)" in only and "'Part5'" in only and "'Part6'" not in only---UNUSED_SLOT_MODEL = '''import bmesh-import bpy---def part(name, n_slots, location):- me = bpy.data.meshes.new(name)- bm = bmesh.new()- bmesh.ops.create_cube(bm, size=0.2)- bm.to_mesh(me)- bm.free()- for i in range(n_slots):- me.materials.append(bpy.data.materials.new(f"{name}Mat{i}"))- obj = bpy.data.objects.new(name, me)- obj.location = location- bpy.context.collection.objects.link(obj)- return obj---part("FlatArm", 3, (0, 0, 0.1)) # 3 materials, every polygon on slot 0-painted = part("PaintedArm", 3, (0.5, 0, 0.1))-for i, poly in enumerate(painted.data.polygons):- poly.material_index = i % 3-overrun = part("OverrunArm", 1, (1.0, 0, 0.1))-for poly in overrun.data.polygons:- poly.material_index = 2 # past the last slot: Blender clamps-'''---def test_real_build_reports_the_slots_its_polygons_never_use(tmp_ws, blender_bin) -> None:- """End to end: the indices come off the EVALUATED mesh inside Blender, not a fixture."""- (tmp_ws.src / "model.py").write_text(UNUSED_SLOT_MODEL)- r = BlenderRuntime(blender=blender_bin).build(tmp_ws, timeout_s=120)- assert r.ok, (r.error_type, r.error_message)- rec = {o["name"]: o for o in r.census["objects"]}- assert rec["FlatArm"]["material_indices_used"] == [0]- assert rec["PaintedArm"]["material_indices_used"] == [0, 1, 2]- warns = r.census["warnings"]- (unused,) = [w for w in warns if "slots no polygon uses" in w]- assert "'FlatArm' (3 slots, 1 used)" in unused and "PaintedArm" not in unused- (clamped,) = [w for w in warns if "past the last slot" in w]- assert "'OverrunArm'" in clampeddiff --git a/harness/tests/threejs_render/conftest.py b/harness/tests/threejs_render/conftest.pyindex 8d2f16cf..7c0803c0 100644--- a/harness/tests/threejs_render/conftest.py+++ b/harness/tests/threejs_render/conftest.py@@ -94,7 +94,7 @@ def stool_ws(tmp_path: Path) -> Workspace:@pytest.fixture(scope="session")-def stool_glb(tmp_path_factory: pytest.TempPathFactory) -> Path:+def stool_build(tmp_path_factory: pytest.TempPathFactory):"""Build the stool once per session (needs node); skipped when node is missing."""if shutil.which("node") is None:pytest.skip("node not available")@@ -102,5 +102,10 @@ def stool_glb(tmp_path_factory: pytest.TempPathFactory) -> Path:ws = write_stool(tmp_path_factory.mktemp("stool_session"))res = ThreeJsRuntime().build(ws)- assert res.ok, res.error_message- return Path(res.glb_path)+ assert res.ok, (res.error_type, res.error_message, res.stderr_tail)+ return res++[email protected](scope="session")+def stool_glb(stool_build) -> Path:+ return Path(stool_build.glb_path)diff --git a/harness/tests/threejs_render/test_build.py b/harness/tests/threejs_render/test_build.pyindex 20992042..52aece0a 100644--- a/harness/tests/threejs_render/test_build.py+++ b/harness/tests/threejs_render/test_build.py@@ -21,13 +21,14 @@ def _glb_json(glb: str) -> dict:return json.loads(raw[20:20 + int.from_bytes(raw[12:16], "little")])-def test_build_stool_glb_and_census(stool_ws: Workspace):- rt = ThreeJsRuntime()- res = rt.build(stool_ws)- assert res.ok, (res.error_type, res.error_message, res.stderr_tail)+def test_build_stool_glb_and_census(stool_build, stool_ws: Workspace):+ res = stool_build # the session's one stool buildassert Path(res.glb_path).is_file() and Path(res.glb_path).stat().st_size > 1000- assert (stool_ws.artifacts / "build.json").is_file()+ assert (Path(res.glb_path).parent / "build.json").is_file()c = res.census # what only the export knows; the object itself is measured off the GLB+ assert set(c) == {"placement_offset", "instanced_meshes_baked", "selfcheck_ran", "tick_present",+ "unnamed_meshes", "warnings", "glb_bytes", "three_revision"}+ assert c["three_revision"] == "182"assert c["tick_present"] is Trueassert c["placement_offset"] is Noneassert c["instanced_meshes_baked"] == 0 and c["selfcheck_ran"] is False@@ -43,6 +44,11 @@ def test_build_stool_glb_and_census(stool_ws: Workspace):lo, hi = scene.boundsassert np.allclose(lo, [-0.17, 0.0, -0.17], atol=2e-3)assert np.allclose(hi, [0.17, 0.45, 0.17], atol=2e-3)+ # no entry module: the exporter's typed error, with its record on disk+ (stool_ws.src / "object.js").unlink()+ res = ThreeJsRuntime().build(stool_ws)+ assert not res.ok and res.error_type == "MissingEntryFile"+ assert (stool_ws.artifacts / "export_error.json").is_file()@pytest.mark.parametrize("path, find, repl, etype, line", [@@ -72,11 +78,13 @@ def test_build_contract_errors(stool_ws: Workspace, source, message):def test_build_keeps_source_placement_and_warns(stool_ws: Workspace):- """Law 7: an off-ground / off-centre object is exported as authored, with a warning."""+ """Law 7: an off-ground / off-centre object is exported as authored, with a warning.+ (Same build: an exported selfcheck that passes is run and recorded.)"""p = stool_ws.src / "object.js"- p.write_text(p.read_text().replace("return root;", "root.position.set(0.5, 0.2, 0); return root;"))+ p.write_text(p.read_text().replace("return root;", "root.position.set(0.5, 0.2, 0); return root;")+ + "export function selfcheck(THREE_, root) { return true; }\n")res = ThreeJsRuntime().build(stool_ws)- assert res.ok+ assert res.ok and res.census["selfcheck_ran"] is Trueoff = res.census["placement_offset"]assert off is not None and abs(off[0] + 0.5) < 1e-4 and abs(off[1] + 0.2) < 1e-4assert any("off ground/centre" in w and "exported as authored" in w for w in res.census["warnings"])@@ -129,7 +137,7 @@ def test_build_nan_geometry_names_mesh_part_and_file(stool_ws: Workspace):assert rec["error"]["part"] == "Legs"-def test_build_runs_exported_selfcheck(stool_ws: Workspace):+def test_build_failing_selfcheck_is_a_typed_error(stool_ws: Workspace):p = stool_ws.src / "object.js"src = p.read_text()p.write_text(src + "export function selfcheck(THREE_, root) {\n const box = new THREE.Box3().setFromObject(root);\n"@@ -138,6 +146,3 @@ def test_build_runs_exported_selfcheck(stool_ws: Workspace):assert not res.ok and res.error_type == "SelfCheckError"assert res.error_message.startswith("selfcheck(THREE, root) threw: too short: 0.45")assert res.error_file == "src/object.js" and res.error_line == 13- p.write_text(src + "export function selfcheck(THREE_, root) { return true; }\n")- res = ThreeJsRuntime().build(stool_ws)- assert res.ok and res.census["selfcheck_ran"] is Truediff --git a/harness/tests/threejs_render/test_lint.py b/harness/tests/threejs_render/test_lint.pyindex 52bfb081..24f53ea8 100644--- a/harness/tests/threejs_render/test_lint.py+++ b/harness/tests/threejs_render/test_lint.py@@ -52,18 +52,20 @@ def test_forbidden_apis_and_imports(stool_ws: Workspace, no_node_syntax):assert not any("legs.js:5" in m or "legs.js:6" in m for m in errs)-def test_part_export_name_and_dead_file(stool_ws: Workspace, no_node_syntax):+def test_part_export_name_dead_file_and_build_export(stool_ws: Workspace, no_node_syntax):(stool_ws.src / "parts" / "extra.js").write_text("import * as THREE from 'three';\nexport function buildWrong(THREE_) { return new THREE.Group(); }\n")+ # the plan's ``TVStand`` lives in tv_stand.js and exports buildTVStand (to_pascal keeps+ # it); the lint must not ask for the snake-rebuilt ``buildTvStand`` instead+ (stool_ws.src / "parts" / "tv_stand.js").write_text(+ "import * as THREE from 'three';\nexport function buildTVStand(THREE_) { return new THREE.Group(); }\n")rep = lint_workspace(stool_ws)warns = _msgs(rep, Severity.WARN)assert any("expected `export function buildExtra(THREE)`" in m for m in warns)assert any("not imported by any module" in m for m in warns)+ assert not any("tv_stand.js: expected" in m for m in _msgs(rep))(stool_ws.src / "parts" / "extra.js").write_text("export const nothing = 1;\n")rep = lint_workspace(stool_ws)assert any("buildExtra" in m for m in _msgs(rep, Severity.ERROR))---def test_object_without_build_export(stool_ws: Workspace, no_node_syntax):(stool_ws.src / "object.js").write_text("import * as THREE from 'three';\nexport function make() {}\n")rep = lint_workspace(stool_ws)assert any("must `export function build(THREE)`" in m for m in _msgs(rep, Severity.ERROR))@@ -86,30 +88,3 @@ def test_syntax_error_reported_with_line(stool_ws: Workspace):rep = lint_workspace(stool_ws)assert not rep.passedassert any("seat.js:13" in m and "SyntaxError" in m for m in _msgs(rep, Severity.ERROR))---def test_one_node_checks_every_file_and_a_parsed_file_is_not_sent_again(tmp_path: Path, monkeypatch):- import codeverse3d.languages._js_lint as js_lint-- good = [tmp_path / f"ok_{i}.js" for i in range(3)]- for i, p in enumerate(good):- p.write_text(f"import * as THREE from 'three';\nexport const n{i} = await Promise.resolve({i});\n")- bad = tmp_path / "bad.js"- bad.write_text("export function f() {\n return 1;\n}\nconst = 2;\n")- calls = []- real = js_lint.run_node- monkeypatch.setattr(js_lint, "run_node", lambda *a, **k: calls.append(a) or real(*a, **k))- problems = js_lint.node_check_syntax([*good, bad])- assert list(problems) == [bad] and problems[bad].line == 4 and "SyntaxError" in problems[bad].message- assert len(calls) == 1 # one process for four files- assert js_lint.node_check_syntax(good) == {} and len(calls) == 1 # all three parsed already: no node at all- assert list(js_lint.node_check_syntax([bad])) == [bad] and len(calls) == 2 # a failure is never cached---def test_an_acronym_part_export_is_matched_by_snake(stool_ws: Workspace, no_node_syntax):- """The plan's ``TVStand`` lives in tv_stand.js and exports buildTVStand (to_pascal keeps- it); the lint must not ask for the snake-rebuilt ``buildTvStand`` instead."""- (stool_ws.src / "parts" / "tv_stand.js").write_text(- "import * as THREE from 'three';\nexport function buildTVStand(THREE_) { return new THREE.Group(); }\n")- assert not any("tv_stand.js: expected" in m for m in _msgs(lint_workspace(stool_ws)))diff --git a/harness/tests/threejs_render/test_render_retry.py b/harness/tests/threejs_render/test_render_retry.pyindex 21b3202e..d6c8e8d8 100644--- a/harness/tests/threejs_render/test_render_retry.py+++ b/harness/tests/threejs_render/test_render_retry.py@@ -27,49 +27,36 @@ def _glb(tmp_path: Path) -> Path:return p-def test_transient_failure_is_retried_with_double_timeout_on_the_shared_browser(tmp_path, monkeypatch):+# verbatim from a real run where Chrome reaped the render tab+DETACHED = "render_glb failed: Attempted to use detached Frame '10276B428E350BFA074A02AF37D52E6C'."+++def test_retry_policy(tmp_path, monkeypatch):calls: list[tuple[float, bool]] = []+ fail_with: list[str] = []def fake(glb, out_dir, params, *, gpu, timeout_s, own_browser=False):calls.append((timeout_s, own_browser))- if len(calls) == 1:- raise RenderError("render_glb failed: node script render_glb.mjs exited 1: Waiting failed: 30000 ms exceeded")+ if len(calls) == 1 or fail_with[0].startswith("render_glb failed: Cannot"):+ raise RenderError(fail_with[0])return {"views": [], "renderer": "fake", "duration_ms": 1}monkeypatch.setattr(R, "_run_render", fake)- rs = render_glb(_glb(tmp_path), tmp_path / "out", use_cache=False, timeout_s=100)+ glb = _glb(tmp_path)+ # a transient failure is retried once with twice the time on the shared browser:# a slow box is not a reason to give up browser reuse+ fail_with[:] = ["render_glb failed: node script render_glb.mjs exited 1: Waiting failed: 30000 ms exceeded"]+ rs = render_glb(glb, tmp_path / "out", use_cache=False, timeout_s=100)assert rs.renderer == "fake" and calls == [(100, False), (200, False)]---def test_real_failure_is_not_retried(tmp_path, monkeypatch):- calls: list[float] = []-- def fake(glb, out_dir, params, *, gpu, timeout_s, own_browser=False):- calls.append(timeout_s)- raise RenderError("render_glb failed: Cannot find module 'puppeteer'")-- monkeypatch.setattr(R, "_run_render", fake)+ # a real failure is not retried+ calls.clear()+ fail_with[:] = ["render_glb failed: Cannot find module 'puppeteer'"]with pytest.raises(RenderError):- render_glb(_glb(tmp_path), tmp_path / "out", use_cache=False, timeout_s=100)- assert calls == [100]---# verbatim from a real run where Chrome reaped the render tab-DETACHED = "render_glb failed: Attempted to use detached Frame '10276B428E350BFA074A02AF37D52E6C'."---def test_a_lost_browser_is_retried_on_a_browser_of_our_own(tmp_path, monkeypatch):- seen: list[bool] = []-- def fake(glb, out_dir, params, *, gpu, timeout_s, own_browser=False):- seen.append(own_browser)- if len(seen) == 1:- raise RenderError(DETACHED)- return {"views": [], "renderer": "fake", "duration_ms": 1}-- monkeypatch.setattr(R, "_run_render", fake)- rs = render_glb(_glb(tmp_path), tmp_path / "out", use_cache=False, timeout_s=100)+ render_glb(glb, tmp_path / "out", use_cache=False, timeout_s=100)+ assert calls == [(100, False)]+ # a lost browser is retried on a browser of our own+ calls.clear()+ fail_with[:] = [DETACHED]+ rs = render_glb(glb, tmp_path / "out", use_cache=False, timeout_s=100)assert rs.renderer == "fake"- assert seen == [False, True], "the retry must not go back to the browser that just died"-+ assert [own for _, own in calls] == [False, True], "the retry must not go back to the browser that just died"diff --git a/harness/tests/threejs_render/test_runtime_js.py b/harness/tests/threejs_render/test_runtime_js.pyindex 39871c3e..158ea356 100644--- a/harness/tests/threejs_render/test_runtime_js.py+++ b/harness/tests/threejs_render/test_runtime_js.py@@ -14,30 +14,20 @@ from codeverse3d.workspace import Workspacepytestmark = pytest.mark.node-def test_export_cli_writes_census_and_error_json(stool_ws: Workspace, tmp_path: Path):- rt = runtime_js_dir()- res = run_node(rt / "export_glb.mjs", ["--ws", str(stool_ws.root), "--out", "artifacts/o.glb", "--census", "artifacts/c.json"], three_hook=True, timeout_s=60)- rec = res.last_json- assert rec["ok"] and (stool_ws.root / "artifacts/o.glb").is_file()- census = json.loads((stool_ws.root / "artifacts/c.json").read_text())- assert set(census) == {"placement_offset", "instanced_meshes_baked", "selfcheck_ran", "tick_present",- "unnamed_meshes", "warnings", "glb_bytes", "three_revision"}- assert census["three_revision"] == "182"- # error path: unknown entry- with pytest.raises(NodeError) as ei:- run_node(rt / "export_glb.mjs", ["--ws", str(stool_ws.root), "--entry", "src/nope.js"], three_hook=True, timeout_s=60)- err = ei.value.result.last_json["error"]- assert err["type"] == "MissingEntryFile"- assert (stool_ws.artifacts / "export_error.json").is_file()--def test_serve_and_importmap(tmp_path: Path):+ """serve.cjs types, routes and escapes; workspace content is model-authored, so a+ symlink out of the root 404s."""script = tmp_path / "s.cjs"root = tmp_path / "root"root.mkdir()(root / "a.glb").write_bytes(b"glTF1234")(root / "sub").mkdir()(root / "sub" / "b.json").write_text("{}")+ (root / "ok.txt").write_text("fine")+ (tmp_path / "secret.txt").write_text("s3cr3t")+ (root / "inside.txt").symlink_to(root / "ok.txt")+ (root / "leak.txt").symlink_to(tmp_path / "secret.txt")+ (root / "dirlink").symlink_to(tmp_path)script.write_text(f"""const {{ serveDirs, importMapHtml }} = require({json.dumps(str(runtime_js_dir() / 'serve.cjs'))});(async () => {{@@ -49,6 +39,8 @@ const {{ serveDirs, importMapHtml }} = require({json.dumps(str(runtime_js_dir()escape: await get('/../s.cjs'), missing: await get('/nope.png'), fav: await get('/favicon.ico'),malformed: await get('/100%.png'), after: await get('/a.glb'), // decodeURIComponent throws on '%.p'importmap: importMapHtml(),+ links: {{ ok: (await get('/ok.txt')).status, inside: (await get('/inside.txt')).status,+ leak: (await get('/leak.txt')).status, dirleak: (await get('/dirlink/secret.txt')).status }},}};await srv.close();console.log(JSON.stringify(out));@@ -64,31 +56,7 @@ const {{ serveDirs, importMapHtml }} = require({json.dumps(str(runtime_js_dir()im = json.loads(out["importmap"].split(">", 1)[1].rsplit("<", 1)[0])["imports"]assert im["three"].startswith("/__runtime/") and im["three/addons/"].endswith("/examples/jsm/")assert "http" not in json.dumps(im)---def test_gpu_launch_probe(tmp_path: Path):- script = tmp_path / "g.cjs"- script.write_text(f"""-const {{ launchBrowser, rendererInfo }} = require({json.dumps(str(runtime_js_dir() / 'gpu_launch.cjs'))});-(async () => {{- const t0 = Date.now();- const handle = await launchBrowser({{ gpu: process.env.T_GPU || 'auto' }});- const {{ browser, gpu, renderer }} = handle;- const probe = await rendererInfo(browser);- await handle.release(); // never browser.close(): the browser may be shared- console.log(JSON.stringify({{ gpu, renderer, probe, shared: handle.shared, ms: Date.now() - t0 }}));-}})().catch((e) => {{ console.error(e); process.exit(1); }});-""")- env = {"C3D_CACHE_DIR": str(tmp_path / "cache")}- auto = run_node(script, [], timeout_s=120, env_extra=env).last_json- assert auto["renderer"] and auto["probe"]- if auto["gpu"]:- assert "swiftshader" not in auto["renderer"].lower()- off = run_node(script, [], timeout_s=120, env_extra={**env, "T_GPU": "off"}).last_json- assert off["gpu"] is False and "swiftshader" in off["probe"].lower()- with pytest.raises(NodeError):- run_node(script, [], timeout_s=60, env_extra={**env, "T_GPU": "bogus"})- _reap_daemons(tmp_path / "cache")+ assert out["links"] == {"ok": 200, "inside": 200, "leak": 404, "dirleak": 404}def test_two_runtime_trees_never_share_one_browser_endpoint(tmp_path: Path):@@ -136,62 +104,48 @@ def _reap_daemons(cache_dir: Path) -> None:os.kill(int(info[key]), signal.SIGTERM)-def test_gpu_launch_browser_reuse(tmp_path: Path):- """A second launch reconnects to the shared browser; C3D_BROWSER_REUSE=off owns every launch."""- script = tmp_path / "r.cjs"+def test_gpu_launch_probe_and_browser_reuse(tmp_path: Path):+ """The GPU/SwiftShader probe; a second launch reconnects to the shared browser;+ C3D_BROWSER_REUSE=off owns every launch."""+ script = tmp_path / "g.cjs"script.write_text(f"""-const {{ launchBrowser }} = require({json.dumps(str(runtime_js_dir() / 'gpu_launch.cjs'))});+const {{ launchBrowser, rendererInfo }} = require({json.dumps(str(runtime_js_dir() / 'gpu_launch.cjs'))});(async () => {{- const a = await launchBrowser({{ gpu: 'off' }});+ const gpu = process.env.T_GPU || 'auto';+ const a = await launchBrowser({{ gpu }});+ const probe = await rendererInfo(a.browser);const p = await a.browser.newPage();await p.close();- await a.release();+ await a.release(); // never browser.close(): the browser may be sharedconst t0 = Date.now();- const b = await launchBrowser({{ gpu: 'off' }});+ const b = await launchBrowser({{ gpu }});const reconnect_ms = Date.now() - t0;const alive = b.browser.connected !== false;await b.release();- console.log(JSON.stringify({{ a_shared: a.shared, b_shared: b.shared, reconnect_ms, alive }}));+ console.log(JSON.stringify({{ gpu: a.gpu, renderer: a.renderer, probe, a_shared: a.shared, b_shared: b.shared,+ reconnect_ms, alive }}));}})().catch((e) => {{ console.error(e); process.exit(1); }});""")env = {"C3D_CACHE_DIR": str(tmp_path / "cache")}- out = run_node(script, [], timeout_s=120, env_extra=env).last_json- assert out["a_shared"] is True and out["b_shared"] is True and out["alive"]- assert out["reconnect_ms"] < 1000 # connect, not a fresh ~550ms+ launch+ auto = run_node(script, [], timeout_s=120, env_extra=env).last_json+ assert auto["renderer"] and auto["probe"]+ if auto["gpu"]:+ assert "swiftshader" not in auto["renderer"].lower()+ off = run_node(script, [], timeout_s=120, env_extra={**env, "T_GPU": "off"}).last_json+ assert off["gpu"] is False and "swiftshader" in off["probe"].lower()+ assert off["a_shared"] is True and off["b_shared"] is True and off["alive"]+ assert off["reconnect_ms"] < 1000 # connect, not a fresh ~550ms+ launch# the endpoint is keyed by the runtime_js that spawned the daemon, so a worktree# and the main checkout sharing one cache dir cannot advertise over each otherendpoints = list((tmp_path / "cache").glob("browser_cpu_*.json"))assert len(endpoints) == 1 and not endpoints[0].name.endswith(".failed.json")- off = run_node(script, [], timeout_s=120, env_extra={**env, "C3D_BROWSER_REUSE": "off"}).last_json- assert off["a_shared"] is False and off["b_shared"] is False+ own = run_node(script, [], timeout_s=120, env_extra={**env, "T_GPU": "off", "C3D_BROWSER_REUSE": "off"}).last_json+ assert own["a_shared"] is False and own["b_shared"] is False+ with pytest.raises(NodeError):+ run_node(script, [], timeout_s=60, env_extra={**env, "T_GPU": "bogus"})_reap_daemons(tmp_path / "cache")-def test_serve_refuses_symlinks_that_escape_the_root(tmp_path: Path):- """Workspace content is model-authored: a symlink out of the root 404s."""- root = tmp_path / "root"- root.mkdir()- (root / "ok.txt").write_text("fine")- (tmp_path / "secret.txt").write_text("s3cr3t")- (root / "inside.txt").symlink_to(root / "ok.txt")- (root / "leak.txt").symlink_to(tmp_path / "secret.txt")- (root / "dirlink").symlink_to(tmp_path)- script = tmp_path / "s.cjs"- script.write_text(f"""-const {{ serveDirs }} = require({json.dumps(str(runtime_js_dir() / 'serve.cjs'))});-(async () => {{- const srv = await serveDirs({{ root: {json.dumps(str(root))} }});- const get = async (p) => (await fetch(srv.url(p))).status;- const out = {{ ok: await get('/ok.txt'), inside: await get('/inside.txt'),- leak: await get('/leak.txt'), dirleak: await get('/dirlink/secret.txt') }};- await srv.close();- console.log(JSON.stringify(out));-}})().catch((e) => {{ console.error(e); process.exit(1); }});-""")- out = run_node(script, [], timeout_s=60).last_json- assert out == {"ok": 200, "inside": 200, "leak": 404, "dirleak": 404}--def test_scene_server_only_mounts_src_public_assets(tmp_path: Path):"""Scene code must not read the run's spec, state, git or judge output."""ws = Workspace(tmp_path / "run").create()diff --git a/harness/tests/threejs_render/test_sheet.py b/harness/tests/threejs_render/test_sheet.pyindex f7371420..94e7ecf7 100644--- a/harness/tests/threejs_render/test_sheet.py+++ b/harness/tests/threejs_render/test_sheet.py@@ -15,7 +15,7 @@ def _png(path: Path, color, size=(120, 80)):return path-def test_sheet_layout_and_labels(tmp_path: Path):+def test_sheet_layout_labels_missing_tile_and_empty(tmp_path: Path):imgs = [(f"v{i}", _png(tmp_path / f"{i}.png", (i * 40, 100, 200))) for i in range(5)]out = contact_sheet(imgs, tmp_path / "sheet.png", cols=3, tile=100)with Image.open(out) as im:@@ -24,14 +24,9 @@ def test_sheet_layout_and_labels(tmp_path: Path):assert im.getpixel((PAD + 2, PAD + 100 + 2))[0] < 60# the first tile centre carries the first image colour (letterboxed)assert im.getpixel((PAD + 50, PAD + 50)) == (0, 100, 200)---def test_sheet_missing_image_is_grey_tile(tmp_path: Path):+ # a missing image is a grey tile, not a crashout = contact_sheet([("ok", _png(tmp_path / "a.png", (10, 200, 10))), ("gone", tmp_path / "missing.png")], tmp_path / "s.png", cols=2, tile=64)with Image.open(out) as im:assert im.getpixel((PAD + 64 + PAD + 40, PAD + 40)) == (200, 200, 200)---def test_sheet_empty_raises(tmp_path: Path):with pytest.raises(ValueError):contact_sheet([], tmp_path / "s.png")diff --git a/harness/tests/threejs_render/test_skeleton.py b/harness/tests/threejs_render/test_skeleton.pyindex 2e635a9b..2bcce41e 100644--- a/harness/tests/threejs_render/test_skeleton.py+++ b/harness/tests/threejs_render/test_skeleton.py@@ -41,8 +41,5 @@ def test_skeleton_files_and_contents(tmp_path: Path):again = write_skeleton(ws, _plan())assert again == []assert (ws.src / "parts" / "seat_cushion.js").read_text() == "// mine\n"---def test_skeleton_rejects_non_static_plan(tmp_path: Path):with pytest.raises(TypeError):write_skeleton(Workspace(tmp_path), object()) # type: ignore[arg-type]diff --git a/harness/tests/threejs_render/test_stale_outputs.py b/harness/tests/threejs_render/test_stale_outputs.pyindex 934df48f..2d82730a 100644--- a/harness/tests/threejs_render/test_stale_outputs.py+++ b/harness/tests/threejs_render/test_stale_outputs.py@@ -22,8 +22,8 @@ def _ws_with_stale(tmp_path) -> Workspace:return ws-def test_node_missing_raise_leaves_no_stale_outputs(tmp_path, monkeypatch):- ws = _ws_with_stale(tmp_path)+def test_no_stale_outputs_survive_a_node_failure(tmp_path, monkeypatch):+ ws = _ws_with_stale(tmp_path / "missing")def no_node(*a, **k):raise NodeError("node binary not found", None) # harness problem → re-raised@@ -34,9 +34,8 @@ def test_node_missing_raise_leaves_no_stale_outputs(tmp_path, monkeypatch):for name in ("build.json", "object.glb", "census.json", "export_error.json"):assert not (ws.artifacts / name).exists(), name--def test_node_failure_with_result_writes_failed_build_json(tmp_path, monkeypatch):- ws = _ws_with_stale(tmp_path)+ # a node failure WITH a result writes a failed build.json+ ws = _ws_with_stale(tmp_path / "timeout")def timeout(*a, **k):raise NodeError("timed out", NodeResult(rc=-9, stdout="", stderr="killed",diff --git a/harness/tests/urdf_joints/test_axis_repair.py b/harness/tests/urdf_joints/test_axis_repair.pyindex d6ddbd61..847fdd05 100644--- a/harness/tests/urdf_joints/test_axis_repair.py+++ b/harness/tests/urdf_joints/test_axis_repair.py@@ -51,24 +51,22 @@ def _axis_of(ws: Workspace, joint: str):return None if el is None else tuple(float(v) for v in el.get("xyz").split())-def test_anti_parallel_negates_the_authored_axis(tmp_path):- ws = _ws(tmp_path) # the plan's casing maps to the URDF joint- assert repair_motion_axes(ws, _report(_finding("hinge", cos=-0.98))) == ["hinge"]- assert _axis_of(ws, "Hinge") == (0.0, 0.0, 1.0)- assert "authored comment must survive" in (ws.src / "robot.urdf").read_text()---def test_orthogonal_writes_suggested_axis_and_inserts_missing_element(tmp_path):- ws = _ws(tmp_path)- assert repair_motion_axes(ws, _report(_finding("Slide", cos=0.0, suggested=(0, 0, 1)))) == ["Slide"]- assert _axis_of(ws, "Slide") == (0.0, 0.0, 1.0)---def test_warn_unknown_and_unmeasured_findings_are_skipped(tmp_path):+def test_repair_skips_what_it_cannot_trust_then_fixes_both_kinds(tmp_path):ws = _ws(tmp_path)+ (ws.artifacts / "robot.urdf").write_text(URDF)+ # WARN, an unknown joint and an unmeasured finding are all skippedrep = _report(_finding("Hinge", cos=-1.0, sev=Severity.WARN), _finding("Ghost", cos=-1.0), _finding("Hinge"))assert repair_motion_axes(ws, rep) == []assert _axis_of(ws, "Hinge") == (0.0, 0.0, -1.0)+ # anti-parallel negates the authored axis (the plan's casing maps to the URDF joint);+ # orthogonal writes the suggested axis, inserting the missing <axis> element+ rep = _report(_finding("hinge", cos=-0.98), _finding("Slide", cos=0.0, suggested=(0, 0, 1)))+ assert repair_motion_axes(ws, rep) == ["hinge", "Slide"]+ assert _axis_of(ws, "Hinge") == (0.0, 0.0, 1.0)+ assert _axis_of(ws, "Slide") == (0.0, 0.0, 1.0)+ assert "authored comment must survive" in (ws.src / "robot.urdf").read_text()+ # the artifacts copy is kept in step+ assert (ws.artifacts / "robot.urdf").read_text() == (ws.src / "robot.urdf").read_text()@pytest.mark.parametrize("raw", ["0", "off", "false"])@@ -80,13 +78,6 @@ def test_kill_switch_disables(tmp_path, switch, raw):assert _axis_of(ws, "Hinge") == (0.0, 0.0, -1.0)-def test_artifacts_copy_is_kept_in_step(tmp_path):- ws = _ws(tmp_path)- (ws.artifacts / "robot.urdf").write_text(URDF)- assert repair_motion_axes(ws, _report(_finding("Hinge", cos=-1.0))) == ["Hinge"]- assert (ws.artifacts / "robot.urdf").read_text() == (ws.src / "robot.urdf").read_text()--def test_a_paired_axis_tag_keeps_the_joints_limit():"""The splice of a paired <axis></axis> used to eat the joint's <limit/>."""from codeverse3d.tracks.articulated_object import _set_axis_in_urdf_textdiff --git a/harness/tests/urdf_joints/test_consistency.py b/harness/tests/urdf_joints/test_consistency.pyindex 4a6fad01..24e12573 100644--- a/harness/tests/urdf_joints/test_consistency.py+++ b/harness/tests/urdf_joints/test_consistency.py@@ -11,16 +11,13 @@ CENSUS = {"body": {"bbox_min": [-0.3, -0.2, 0.0], "bbox_max": [0.3, 0.2, 0.8]},"door": {"bbox_min": [-0.29, -0.22, 0.01], "bbox_max": [0.29, -0.2, 0.79]}}-def test_sign_error_reports_exact_fix(tmp_path):- urdf, meshes = write_mesh_robot(tmp_path, door_visual_xyz="-0.29 -0.2 0")+def test_sign_error_reports_exact_fix_and_a_missing_row_is_named(tmp_path):+ urdf, meshes = write_mesh_robot(tmp_path / "sign", door_visual_xyz="-0.29 -0.2 0")f = check_fk_consistency(load_urdf(urdf, meshes), CENSUS)assert len(f) == 1 and f[0].severity == Severity.ERROR and f[0].target == "door"assert 'xyz="0.29 0.2 0"' in f[0].fix_hintassert f[0].data["corrected_visual_origin"]["xyz"] == [0.29, 0.2, 0.0]assert f[0].data["error_m"] > 0.5---def test_missing_census_row(tmp_path):- urdf, meshes = write_mesh_robot(tmp_path)+ urdf, meshes = write_mesh_robot(tmp_path / "row")f = check_fk_consistency(load_urdf(urdf, meshes), {"body": CENSUS["body"]})assert [x.target for x in f] == ["door"] and "no authored mesh" in f[0].messagediff --git a/harness/tests/urdf_joints/test_export.py b/harness/tests/urdf_joints/test_export.pyindex d1443d05..6373b939 100644--- a/harness/tests/urdf_joints/test_export.py+++ b/harness/tests/urdf_joints/test_export.py@@ -45,6 +45,19 @@ def test_urdf_to_glb_hierarchy_and_extras(tmp_path):s2 = trimesh.load(glb2)assert s2.bounds[1][2] > 0.7 # door swung out to +z (front)assert _gltf_json(glb2)["scenes"][0]["extras"]["pose"] == {"hinge": 1.57}+ # a multi-material link keeps its materials: one node per submesh under the link+ a = trimesh.creation.box((0.1, 0.1, 0.1))+ a.visual = trimesh.visual.TextureVisuals(material=trimesh.visual.material.PBRMaterial(name="wood", baseColorFactor=[200, 150, 100, 255]))+ b = trimesh.creation.box((0.05, 0.05, 0.3))+ b.apply_translation((0, 0, 0.3))+ b.visual = trimesh.visual.TextureVisuals(material=trimesh.visual.material.PBRMaterial(name="metal", baseColorFactor=[200, 200, 210, 255]))+ (meshes / "body.glb").write_bytes(trimesh.Scene([a, b]).export(file_type="glb"))+ r = load_urdf(urdf, meshes)+ assert len(r.links["body"].submeshes) == 2 and len(r.links["body"].mesh.split(only_watertight=False)) == 2+ s = trimesh.load(urdf_to_glb(r, tmp_path / "mm.glb"))+ names = {k: getattr(getattr(g.visual, "material", None), "name", None) for k, g in s.geometry.items()}+ assert {names["body__0"], names["body__1"]} == {"wood", "metal"}+ assert sorted(n for n in [e[1] for e in s.graph.to_edgelist()] if n.startswith("body")) == ["body", "body__0", "body__1"]def test_render_poses_with_fake_renderer_builds_sheet(tmp_path, monkeypatch):@@ -72,27 +85,6 @@ def test_render_poses_with_fake_renderer_builds_sheet(tmp_path, monkeypatch):assert sheet.is_file() and Image.open(sheet).size[0] > 32-def test_multi_material_link_keeps_materials(tmp_path):- from tests.urdf_joints.conftest import write_mesh_robot-- urdf, meshes = write_mesh_robot(tmp_path)- a = trimesh.creation.box((0.1, 0.1, 0.1))- a.visual = trimesh.visual.TextureVisuals(material=trimesh.visual.material.PBRMaterial(name="wood", baseColorFactor=[200, 150, 100, 255]))- b = trimesh.creation.box((0.05, 0.05, 0.3))- b.apply_translation((0, 0, 0.3))- b.visual = trimesh.visual.TextureVisuals(material=trimesh.visual.material.PBRMaterial(name="metal", baseColorFactor=[200, 200, 210, 255]))- (meshes / "body.glb").write_bytes(trimesh.Scene([a, b]).export(file_type="glb"))- from codeverse3d.spatial.joints_model import load_urdf as _load-- r = _load(urdf, meshes)- assert len(r.links["body"].submeshes) == 2 and len(r.links["body"].mesh.split(only_watertight=False)) == 2- glb = urdf_to_glb(r, tmp_path / "mm.glb")- s = trimesh.load(glb)- names = {k: getattr(getattr(g.visual, "material", None), "name", None) for k, g in s.geometry.items()}- assert {names["body__0"], names["body__1"]} == {"wood", "metal"}- assert sorted(n for n in [e[1] for e in s.graph.to_edgelist()] if n.startswith("body")) == ["body", "body__0", "body__1"]--def test_joint_sweep_penetration_is_a_verdict_not_an_mcp_error(tmp_path, monkeypatch):"""A sweep that finds a penetration RAN: ``failed`` stays False (63% of 1404 recordedjoint_sweep calls answered FAIL, and each one reported as an MCP error bought a retry@@ -136,11 +128,8 @@ def test_robot_named_like_a_link_keeps_frame_and_placement(tmp_path):assert rows["body"].bbox_max[1] == pytest.approx(0.8, abs=1e-6) # Y-up: height along yassert rows["door"].bbox_min[0] == pytest.approx(-0.29, abs=1e-6) and rows["door"].bbox_max[0] == pytest.approx(0.29, abs=1e-6)assert rows["door"].bbox_min[2] > 0.19 # door in front (+z) of the body, hinge placement applied---def test_link_named_world_is_rejected(tmp_path):- urdf, meshes = write_mesh_robot(tmp_path)+ # a link named 'world' cannot become a GLB node at all: refused at load(meshes / "world.glb").write_bytes((meshes / "body.glb").read_bytes())- urdf.write_text(urdf.read_text().replace('name="body"', 'name="world"').replace('link="body"', 'link="world"').replace("meshes/body.glb", "meshes/world.glb"))+ urdf.write_text(urdf.read_text().replace('<robot name="body">', '<robot name="cab">').replace('name="body"', 'name="world"').replace('link="body"', 'link="world"').replace("meshes/body.glb", "meshes/world.glb"))with pytest.raises(UrdfError, match="reserved"):load_urdf(urdf, meshes)diff --git a/harness/tests/urdf_joints/test_joints_model.py b/harness/tests/urdf_joints/test_joints_model.pyindex 2788d961..c20dd9aa 100644--- a/harness/tests/urdf_joints/test_joints_model.py+++ b/harness/tests/urdf_joints/test_joints_model.py@@ -16,7 +16,7 @@ from codeverse3d.spatial.joints_poses import limit_poses, pose_label, pose_samplfrom tests.urdf_joints.conftest import write_prims_robot-def test_load_prims_and_fk(tmp_path):+def test_load_prims_fk_and_pose_samples(tmp_path):r = load_urdf(write_prims_robot(tmp_path / "cab.urdf"))assert r.root == "body" and r.link_order() == ["body", "door"]assert r.joints["hinge"].type == "revolute" and r.joints["hinge"].upper == 1.57@@ -26,26 +26,7 @@ def test_load_prims_and_fk(tmp_path):assert np.allclose(T[:3, :3] @ [1, 0, 0], [0, -1, 0], atol=1e-9)with pytest.raises(UrdfError):fk(r, {"nope": 1.0})---def test_load_errors(tmp_path):- p = tmp_path / "bad.urdf"- p.write_text("<robot name='x'><link name='a'/><link name='b'/></robot>")- with pytest.raises(UrdfError, match="exactly one root"):- load_urdf(p)- p.write_text("<robot name='x'><link name='a'/><link name='b'/><joint name='j' type='revolute'><parent link='a'/><child link='b'/></joint></robot>")- with pytest.raises(UrdfError, match="limit"):- load_urdf(p)- p.write_text("<robot name='x'><link name='a'/><link name='b'/><joint name='j' type='fixed'><parent link='a'/><child link='zz'/></joint></robot>")- with pytest.raises(UrdfError, match="unknown"):- load_urdf(p)- p.write_text("<robot name='x'><link name='a'><visual><geometry><mesh filename='meshes/nope.glb'/></geometry></visual></link></robot>")- with pytest.raises(UrdfError, match="not found"):- load_urdf(p)---def test_pose_samples_and_labels(tmp_path):- r = load_urdf(write_prims_robot(tmp_path / "cab.urdf"))+ # pose samples and their labelsposes = pose_samples(r, n_random=4, seed=1)labels = [pose_label(r, q) for q in poses]assert labels[:3] == ["rest", "hinge@mid", "hinge@upper"] # single joint → no random combos@@ -62,3 +43,19 @@ def test_pose_samples_and_labels(tmp_path):for q in poses2:if "s" in q:assert -0.1 - 1e-9 <= q["s"] <= 0.2 + 1e-9+++def test_load_errors(tmp_path):+ p = tmp_path / "bad.urdf"+ p.write_text("<robot name='x'><link name='a'/><link name='b'/></robot>")+ with pytest.raises(UrdfError, match="exactly one root"):+ load_urdf(p)+ p.write_text("<robot name='x'><link name='a'/><link name='b'/><joint name='j' type='revolute'><parent link='a'/><child link='b'/></joint></robot>")+ with pytest.raises(UrdfError, match="limit"):+ load_urdf(p)+ p.write_text("<robot name='x'><link name='a'/><link name='b'/><joint name='j' type='fixed'><parent link='a'/><child link='zz'/></joint></robot>")+ with pytest.raises(UrdfError, match="unknown"):+ load_urdf(p)+ p.write_text("<robot name='x'><link name='a'><visual><geometry><mesh filename='meshes/nope.glb'/></geometry></visual></link></robot>")+ with pytest.raises(UrdfError, match="not found"):+ load_urdf(p)diff --git a/harness/tests/urdf_joints/test_live_blender.py b/harness/tests/urdf_joints/test_live_blender.pyindex dc69e8db..16efd67c 100644--- a/harness/tests/urdf_joints/test_live_blender.py+++ b/harness/tests/urdf_joints/test_live_blender.py@@ -12,11 +12,15 @@ from codeverse3d.spatial.joints_sweep import motion_direction_check, sweep_gatefrom codeverse3d.workspace import Workspacepytestmark = pytest.mark.blender+try:+ import yourdfpy+except ImportError: # the [urdf] extra; the rest of the end-to-end test still runs+ yourdfpy = Noneneeds_blender = pytest.mark.skipif(not get_settings().resolve_blender(), reason="no Blender binary")@needs_blender-def test_cabinet_door_end_to_end(tmp_path, cabinet_plan):+def test_cabinet_door_end_to_end_then_broken(tmp_path, cabinet_plan):ws = Workspace(tmp_path / "cab").create()rt = UrdfBlenderRuntime()rt.skeleton(ws, cabinet_plan)@@ -33,10 +37,19 @@ def test_cabinet_door_end_to_end(tmp_path, cabinet_plan):gate, _ = sweep_gate(ws) # the round's joint_sweep gate on this buildassert gate.passed and not gate.findings, [f.message for f in gate.findings]# loads in yourdfpy with the same FK- yourdfpy = pytest.importorskip("yourdfpy")- u = yourdfpy.URDF.load(str(ws.artifacts / "robot.urdf"), load_meshes=True)- u.update_cfg({"hinge": 1.0})- assert np.allclose(u.get_transform("door", "body"), fk(r, {"hinge": 1.0})["door"], atol=1e-6)+ if yourdfpy is not None:+ u = yourdfpy.URDF.load(str(ws.artifacts / "robot.urdf"), load_meshes=True)+ u.update_cfg({"hinge": 1.0})+ assert np.allclose(u.get_transform("door", "body"), fk(r, {"hinge": 1.0})["door"], atol=1e-6)++ # the same workspace, broken: typed wrapper failures+ m = ws.src / "model.py"+ m.write_text(m.read_text() + "\nraise RuntimeError('boom')\n")+ res = rt.build(ws)+ assert not res.ok and res.error_type == "RuntimeError" and res.error_line == len(m.read_text().splitlines())+ m.write_text(m.read_text().replace("raise RuntimeError('boom')\n", "").replace("'handle'", "'Handle'"))+ res = rt.build(ws)+ assert not res.ok and res.error_type == "MissingLinkObjects" and "Handle" in res.error_message@needs_blender@@ -60,20 +73,6 @@ def test_rest_shifted_skeleton_builds_clean(tmp_path, drawer_plan):assert not [f for f in sweep_gate(ws)[0].findings if f.data.get("kind") == "penetration"]-@needs_blender-def test_script_error_and_missing_object(tmp_path, cabinet_plan):- ws = Workspace(tmp_path / "err").create()- rt = UrdfBlenderRuntime()- rt.skeleton(ws, cabinet_plan)- m = ws.src / "model.py"- m.write_text(m.read_text() + "\nraise RuntimeError('boom')\n")- res = rt.build(ws)- assert not res.ok and res.error_type == "RuntimeError" and res.error_line == len(m.read_text().splitlines())- m.write_text(m.read_text().replace("raise RuntimeError('boom')\n", "").replace("'handle'", "'Handle'"))- res = rt.build(ws)- assert not res.ok and res.error_type == "MissingLinkObjects" and "Handle" in res.error_message--@needs_blenderdef test_links_script_that_calls_sys_exit_0_still_builds(tmp_path):"""``sys.exit(0)`` ends the script, not the build: the objects it made are the linksdiff --git a/harness/tests/urdf_joints/test_mimic.py b/harness/tests/urdf_joints/test_mimic.pyindex 7b233914..729cbad8 100644--- a/harness/tests/urdf_joints/test_mimic.py+++ b/harness/tests/urdf_joints/test_mimic.py@@ -40,6 +40,15 @@ RIB = """<?xml version="1.0"?>"""+EXTRA_RUNNER = """ <link name="runner2"><visual><geometry><mesh filename="meshes/rib_b.glb"/></geometry></visual></link>+ <joint name="runner_slide_2" type="prismatic">+ <parent link="shaft"/><child link="runner2"/>+ <origin xyz="0 0 0.6" rpy="0 0 0"/><axis xyz="0 0 1"/>+ <limit lower="0" upper="0.3" effort="10" velocity="1"/>+ </joint>+</robot>"""++def _robot(tmp_path: Path, urdf_text: str = RIB):meshes = tmp_path / "meshes"box_glb(meshes / "shaft.glb", (0, 0, 0.6), (0.04, 0.04, 1.2))@@ -51,7 +60,12 @@ def _robot(tmp_path: Path, urdf_text: str = RIB):return load_urdf(urdf, meshes)-def test_a_driven_joint_follows_its_driver_through_the_chain(tmp_path):+def test_a_driven_joint_follows_its_driver_everywhere(tmp_path):+ import numpy as np+ import trimesh++ from codeverse3d.spatial.joints_export import ZUP_TO_YUP, urdf_to_glb+r = _robot(tmp_path)assert [j.name for j in r.independent_joints()] == ["runner_slide"]assert r.joints["rib_a_hinge"].driven and r.joints["rib_b_hinge"].driven@@ -64,25 +78,42 @@ def test_a_driven_joint_follows_its_driver_through_the_chain(tmp_path):assert fk(r, {"runner_slide": 0.1})["rib_a"][:3, :3].tolist() != fk(r, {})["rib_a"][:3, :3].tolist()assert fk(r, {"runner_slide": 0.1})["runner"][2, 3] == pytest.approx(fk(r, {})["runner"][2, 3] + 0.1)--def test_the_sweep_poses_the_mechanism_the_way_it_moves(tmp_path):- r = _robot(tmp_path)+ # the sweep poses the mechanism the way it moves: one input, not threerep = sweep_collisions(r, pose_samples(r))assert {p.label for p in rep.per_pose} == {"rest", "runner_slide@upper", "runner_slide@mid"}- assert rep.summary.n_poses == 3 # one input, not three+ assert rep.summary.n_poses == 3--def test_a_driven_joint_is_probed_through_its_driver(tmp_path):- r = _robot(tmp_path)+ # a driven joint is probed through its driverchk = motion_direction_check(r, "rib_a_hinge", "up")assert "driven by runner_slide" in chk.messageassert chk.observed_dir != (0.0, 0.0, 0.0)+ # urdf_to_glb poses followers through fk, like the sweep (it used to leave them at rest)+ q = {"runner_slide": 0.3}++ def rib_a_world(glb):+ scene = trimesh.load(glb, force="scene")+ node = next(n for n in scene.graph.nodes_geometry if scene.graph[n][1] == "rib_a")+ T, _ = scene.graph[node]+ return trimesh.transform_points([scene.geometry["rib_a"].centroid], T)[0]++ rest = rib_a_world(urdf_to_glb(r, tmp_path / "rest.glb", {}))+ posed = rib_a_world(urdf_to_glb(r, tmp_path / "posed.glb", q))+ assert not np.allclose(rest, posed), "rib_a did not follow runner_slide in the exported scene"+ # and it lands exactly where fk puts that point: undo the export's Y-up, move the rest+ # centroid by fk's rib_a motion for the same q, re-apply Y-up+ T0, T1 = fk(r, {})["rib_a"], fk(r, q)["rib_a"]+ rest_zup = trimesh.transform_points([rest], np.linalg.inv(ZUP_TO_YUP))[0]+ moved_zup = trimesh.transform_points([rest_zup], T1 @ np.linalg.inv(T0))[0]+ expected = trimesh.transform_points([moved_zup], ZUP_TO_YUP)[0]+ assert np.allclose(posed, expected, atol=1e-6), (posed, expected)+@pytest.mark.parametrize("bad,msg", [('<mimic joint="nope"/>', "names no joint"),('<mimic joint="rib_a_hinge" multiplier="0"/>', "cannot move"),('<mimic joint="rib_b_hinge"/>', "cycle"),+ ('<mimic joint="rib_a_hinge" multiplier="1" offset="0"/>', "names itself"),])def test_a_broken_coupling_is_refused_at_load(tmp_path, bad, msg):text = RIB.replace('<mimic joint="runner_slide" multiplier="4" offset="0"/>', bad)@@ -90,17 +121,41 @@ def test_a_broken_coupling_is_refused_at_load(tmp_path, bad, msg):_robot(tmp_path, text)-def test_the_lint_accepts_a_real_coupling_and_names_a_broken_one(tmp_path, monkeypatch):+def test_the_lint_on_couplings(tmp_path):from codeverse3d.workspace import Workspacews = Workspace(tmp_path / "ws").create()- (ws.src / "robot.urdf").write_text(RIB)(ws.src / "model.py").write_text("import bpy\n")- findings = [f for f in lint_workspace(ws).findings if "mimic" in f.message]- assert findings == []- (ws.src / "robot.urdf").write_text(RIB.replace('joint="runner_slide" multiplier="4"', 'joint="ghost" multiplier="4"'))- errs = [f for f in lint_workspace(ws).findings if "mimic" in f.message and f.severity.value == "error"]+ urdf = ws.src / "robot.urdf"++ def lint(text):+ urdf.write_text(text)+ return lint_workspace(ws).findings++ # a real coupling is accepted; at multiplier 4 it reaches exactly the 1.2 limit (silent)+ findings = lint(RIB)+ assert [f for f in findings if "mimic" in f.message] == []+ assert not [f for f in findings if "drives it over" in f.message]+ # a broken one is named, once (rib_b follows rib_a, which follows the ghost)+ errs = [f for f in lint(RIB.replace('joint="runner_slide" multiplier="4"', 'joint="ghost" multiplier="4"'))+ if "mimic" in f.message and f.severity.value == "error"]assert len(errs) == 1 and "names no joint" in errs[0].message+ # at 5 the coupling drives past the follower's own limits+ warns = [f for f in lint(RIB.replace('joint="runner_slide" multiplier="4"', 'joint="runner_slide" multiplier="5"'))+ if "drives it over" in f.message]+ assert len(warns) == 1 and warns[0].severity.value == "warn" and warns[0].target == "rib_a_hinge"+ assert "1.5" in warns[0].message+ # no single <mimic> is wrong, only the graph: the lint must see the cycle before the build+ cycles = [f for f in lint(RIB.replace('<mimic joint="runner_slide" multiplier="4" offset="0"/>',+ '<mimic joint="rib_b_hinge" multiplier="1" offset="0"/>'))+ if "cycle" in f.message]+ assert cycles and {f.target for f in cycles} == {"rib_a_hinge", "rib_b_hinge"}+ # hinge_1 / hinge_2 written by an agent are two joints, not one instanced driver+ findings = lint(RIB.replace('joint name="runner_slide"', 'joint name="runner_slide_1"')+ .replace('<mimic joint="runner_slide" ', '<mimic joint="runner_slide_1" ')+ .replace("</robot>", EXTRA_RUNNER))+ assert not [f for f in findings if "independent inputs" in f.message]+ assert not [f for f in findings if "mimic" in f.message and f.severity.value == "error"]# ------------------------------------------------------------------ the plan's own rules@@ -121,16 +176,11 @@ def _plan(**joint_overrides):return d[email protected]("mimic,msg", [- ({"joint": "NoSuchJoint"}, "is not a joint in this plan"),- ({"joint": "LidHinge"}, "mimics itself"),-])-def test_a_broken_coupling_is_refused_by_the_plan(mimic, msg):- with pytest.raises(Exception, match=msg):- ArticulatedPlan.model_validate(_plan(mimic=mimic))---def test_a_coupling_that_names_a_fixed_joint_is_refused():+def test_a_broken_coupling_is_refused_by_the_plan():+ for mimic, msg in (({"joint": "NoSuchJoint"}, "is not a joint in this plan"), ({"joint": "LidHinge"}, "mimics itself")):+ with pytest.raises(Exception, match=msg):+ ArticulatedPlan.model_validate(_plan(mimic=mimic))+ # a coupling that names a fixed jointd = _plan(mimic={"joint": "CabinetWeld"})d["parts"].append({"name": "Plinth", "role": "base", "description": "a plinth", "attach_to": "Cabinet","bbox": {"center": [0, 0, -0.05], "extents": [0.4, 0.5, 0.1]}, "material": "oak"})@@ -138,9 +188,7 @@ def test_a_coupling_that_names_a_fixed_joint_is_refused():"axis": [0, 0, 1], "pivot": [0, 0, 0], "lower": 0.0, "upper": 0.0, "motion": "rigid"})with pytest.raises(Exception, match="which is fixed and never moves"):ArticulatedPlan.model_validate(d)---def test_a_mimic_cycle_is_refused():+ # a cycled = _plan(mimic={"joint": "DrawerSlide"})d["joints"][0]["mimic"] = {"joint": "LidHinge"}with pytest.raises(Exception, match="loops back through"):@@ -168,53 +216,6 @@ def test_the_three_layers_reject_the_same_near_zero_multiplier(tmp_path):assert [f for f in lint_workspace(ws).findings if "cannot move" in f.message]-def test_the_lint_sees_a_cycle_the_per_joint_pass_could_not(tmp_path):- """No single <mimic> is wrong, only the graph: the lint must see it before the build."""- from codeverse3d.workspace import Workspace-- ws = Workspace(tmp_path / "ws").create()- (ws.src / "robot.urdf").write_text(RIB.replace('<mimic joint="runner_slide" multiplier="4" offset="0"/>',- '<mimic joint="rib_b_hinge" multiplier="1" offset="0"/>'))- (ws.src / "model.py").write_text("import bpy\n")- cycles = [f for f in lint_workspace(ws).findings if "cycle" in f.message]- assert cycles and {f.target for f in cycles} == {"rib_a_hinge", "rib_b_hinge"}---def test_an_unknown_target_is_reported_once_not_once_per_follower():- from codeverse3d.contracts.common import MimicSpec, mimic_issues-- issues = mimic_issues([- MimicSpec(key="a", name="a", movable=True, target="ghost"),- MimicSpec(key="b", name="b", movable=True, target="a"),- ])- assert [(i.joint, i.kind) for i in issues] == [("a", "unknown_target")]---def test_the_lint_warns_when_a_coupling_drives_past_the_follower_s_own_limits(tmp_path):- """At multiplier 4 the coupling reaches exactly the 1.2 limit (silent); at 5 it overshoots."""- from codeverse3d.workspace import Workspace-- ws = Workspace(tmp_path / "ws").create()- (ws.src / "model.py").write_text("import bpy\n")- (ws.src / "robot.urdf").write_text(RIB)- assert not [f for f in lint_workspace(ws).findings if "drives it over" in f.message]-- (ws.src / "robot.urdf").write_text(RIB.replace('joint="runner_slide" multiplier="4"',- 'joint="runner_slide" multiplier="5"'))- warns = [f for f in lint_workspace(ws).findings if "drives it over" in f.message]- assert len(warns) == 1 and warns[0].severity.value == "warn" and warns[0].target == "rib_a_hinge"- assert "1.5" in warns[0].message---EXTRA_RUNNER = """ <link name="runner2"><visual><geometry><mesh filename="meshes/rib_b.glb"/></geometry></visual></link>- <joint name="runner_slide_2" type="prismatic">- <parent link="shaft"/><child link="runner2"/>- <origin xyz="0 0 0.6" rpy="0 0 0"/><axis xyz="0 0 1"/>- <limit lower="0" upper="0.3" effort="10" velocity="1"/>- </joint>-</robot>"""--def test_the_skeleton_says_when_only_the_first_instance_of_a_driver_is_followed():"""An instanced driver exists only as <name>_1.._n: the skeleton follows _1 and says so."""from codeverse3d.languages.urdf import compute_urdf_frames@@ -231,57 +232,6 @@ def test_the_skeleton_says_when_only_the_first_instance_of_a_driver_is_followed(assert "follows drawer_slide_1 only; drawer_slide_2 stay independent inputs" in line-def test_the_lint_does_not_mistake_hand_named_joints_for_instances(tmp_path):- """hinge_1 / hinge_2 written by an agent are two joints, not one instanced driver."""- from codeverse3d.workspace import Workspace-- urdf = (RIB.replace('joint name="runner_slide"', 'joint name="runner_slide_1"')- .replace('<mimic joint="runner_slide" ', '<mimic joint="runner_slide_1" ')- .replace("</robot>", EXTRA_RUNNER))- ws = Workspace(tmp_path / "ws").create()- (ws.src / "model.py").write_text("import bpy\n")- (ws.src / "robot.urdf").write_text(urdf)-- findings = lint_workspace(ws).findings- assert not [f for f in findings if "independent inputs" in f.message]- assert not [f for f in findings if "mimic" in f.message and f.severity.value == "error"]---def test_the_exported_pose_glb_moves_the_followers_like_fk_does(tmp_path):- """urdf_to_glb poses followers through fk, like the sweep (it used to leave them at rest)."""- import numpy as np- import trimesh-- from codeverse3d.spatial.joints_export import ZUP_TO_YUP, urdf_to_glb-- robot = _robot(tmp_path)- q = {"runner_slide": 0.3}-- def rib_a_world(glb):- scene = trimesh.load(glb, force="scene")- node = next(n for n in scene.graph.nodes_geometry if scene.graph[n][1] == "rib_a")- T, _ = scene.graph[node]- return trimesh.transform_points([scene.geometry["rib_a"].centroid], T)[0]-- rest = rib_a_world(urdf_to_glb(robot, tmp_path / "rest.glb", {}))- posed = rib_a_world(urdf_to_glb(robot, tmp_path / "posed.glb", q))- assert not np.allclose(rest, posed), "rib_a did not follow runner_slide in the exported scene"- # and it lands exactly where fk puts that point: undo the export's Y-up, move the rest- # centroid by fk's rib_a motion for the same q, re-apply Y-up- T0, T1 = fk(robot, {})["rib_a"], fk(robot, q)["rib_a"]- rest_zup = trimesh.transform_points([rest], np.linalg.inv(ZUP_TO_YUP))[0]- moved_zup = trimesh.transform_points([rest_zup], T1 @ np.linalg.inv(T0))[0]- expected = trimesh.transform_points([moved_zup], ZUP_TO_YUP)[0]- assert np.allclose(posed, expected, atol=1e-6), (posed, expected)---def test_a_self_mimic_says_it_names_itself(tmp_path):- text = RIB.replace('<mimic joint="runner_slide" multiplier="4" offset="0"/>',- '<mimic joint="rib_a_hinge" multiplier="1" offset="0"/>')- with pytest.raises(UrdfError, match="names itself"):- _robot(tmp_path, text)--def test_a_self_joint_says_which_links_collided():"""parent == child names both sides (pydantic truncated the value; models re-asked blind)."""from codeverse3d.contracts.plan import JointPlandiff --git a/harness/tests/urdf_joints/test_runtime_offline.py b/harness/tests/urdf_joints/test_runtime_offline.pyindex 9fa73fc8..15cc2d8b 100644--- a/harness/tests/urdf_joints/test_runtime_offline.py+++ b/harness/tests/urdf_joints/test_runtime_offline.py@@ -57,13 +57,17 @@ def _two_link(plan):return plan.model_copy(update={"parts": plan.parts[:2], "joints": plan.joints[:1]})-def test_build_script_error_maps_line(tmp_path, cabinet_plan, fake_blender):+def test_build_script_error_maps_line_and_a_timeout_is_typed(tmp_path, cabinet_plan, fake_blender, monkeypatch):fake_blender["error"] = {"error_type": "NameError", "error_message": "name 'bpyy' is not defined", "error_file": "src/model.py","error_line": 7, "stderr_tail": "Traceback..."}ws = _ws(tmp_path, cabinet_plan)res = UrdfBlenderRuntime().build(ws)assert not res.ok and res.error_type == "NameError" and res.error_line == 7 and res.error_file == "src/model.py"assert "hint: did you mean" in res.error_message+ monkeypatch.setattr(rt_mod, "_run_blender",+ lambda *a, **k: ProcResult(returncode=-9, stdout="", stderr="", timed_out=True, duration_ms=0))+ res = UrdfBlenderRuntime().build(ws, timeout_s=1)+ assert not res.ok and res.error_type == "BuildTimeout"def test_build_rest_penetration_fails_and_publishes_nothing(tmp_path, cabinet_plan, fake_blender):@@ -106,14 +110,6 @@ def test_lint_fail_invalidates_stale_artifacts(tmp_path, cabinet_plan, fake_blenassert json.loads((ws.artifacts / "build.json").read_text())["error_type"] == "LintError"-def test_build_timeout(tmp_path, cabinet_plan, fake_blender, monkeypatch):- monkeypatch.setattr(rt_mod, "_run_blender",- lambda *a, **k: ProcResult(returncode=-9, stdout="", stderr="", timed_out=True, duration_ms=0))- ws = _ws(tmp_path, cabinet_plan)- res = UrdfBlenderRuntime().build(ws, timeout_s=1)- assert not res.ok and res.error_type == "BuildTimeout"--def test_wrapper_rejects_unsafe_link_names_offline():"""run_bpy_links refuses link names that are not plain identifiers — ``../evil``must be a build error, never a ``meshes/<link>.glb`` write outside meshes/. Thediff --git a/harness/tests/urdf_joints/test_skeleton.py b/harness/tests/urdf_joints/test_skeleton.pyindex 8ffdb0b0..da83c905 100644--- a/harness/tests/urdf_joints/test_skeleton.py+++ b/harness/tests/urdf_joints/test_skeleton.py@@ -19,7 +19,7 @@ from codeverse3d.spatial.joints_model import fk, load_urdffrom codeverse3d.workspace import Workspace-def test_frames_chain(cabinet_plan):+def test_frames_chain_and_rendered_files_lint_clean_and_load(tmp_path, cabinet_plan):fr = compute_urdf_frames(cabinet_plan)assert fr.root == "body" and list(fr.links) == ["body", "door", "handle"]assert fr.links["door"].frame_xyz == (-0.29, -0.2, 0.0)@@ -29,6 +29,20 @@ def test_frames_chain(cabinet_plan):# handle joint origin is relative to the DOOR frame (accumulated)assert np.allclose(by["handle_mount"].origin_xyz, (0.49, -0.04, 0.4))assert by["handle_mount"].type == "fixed" and by["handle_mount"].lower is None+ # the rendered files lint clean and load+ urdf_text = render_urdf(fr)+ findings, links = lint_urdf_text(urdf_text)+ assert findings == [] and links == ["body", "door", "handle"]+ model_text = render_model_py(cabinet_plan, fr)+ ast.parse(model_text)+ assert lint_model_text(model_text, links) == []+ p = tmp_path / "robot.urdf"+ p.write_text(urdf_text)+ r = load_urdf(p, load_meshes=False)+ T = fk(r, {})+ # visual origin is the inverse of the link frame → meshes land where authored+ for name in fr.links:+ assert np.allclose(T[name] @ r.links[name].visual_origin, np.eye(4), atol=1e-9), namedef test_rest_shift():@@ -51,23 +65,6 @@ def test_rest_shift():assert lint_urdf_text(urdf_text)[0] == []-def test_rendered_files_lint_clean_and_load(tmp_path, cabinet_plan):- fr = compute_urdf_frames(cabinet_plan)- urdf_text = render_urdf(fr)- findings, links = lint_urdf_text(urdf_text)- assert findings == [] and links == ["body", "door", "handle"]- model_text = render_model_py(cabinet_plan, fr)- ast.parse(model_text)- assert lint_model_text(model_text, links) == []- p = tmp_path / "robot.urdf"- p.write_text(urdf_text)- r = load_urdf(p, load_meshes=False)- T = fk(r, {})- # visual origin is the inverse of the link frame → meshes land where authored- for name in fr.links:- assert np.allclose(T[name] @ r.links[name].visual_origin, np.eye(4), atol=1e-9), name--def test_skeleton_rejects_static_plan(tmp_path):from codeverse3d.contracts.plan import StaticPlanfrom codeverse3d.languages.urdf import UrdfBlenderRuntimediff --git a/harness/tests/urdf_joints/test_sweep.py b/harness/tests/urdf_joints/test_sweep.pyindex 4d7b3e5a..7b394ad2 100644--- a/harness/tests/urdf_joints/test_sweep.py+++ b/harness/tests/urdf_joints/test_sweep.py@@ -123,7 +123,7 @@ def _pen(a, b, depth, pose, sev=Severity.ERROR):fix_hint="shrink", data={"kind": "penetration", "pose": pose, "depth_m": depth})-def test_aggregate_merges_poses_per_pair_and_ranks_by_depth():+def test_aggregate_merges_ranks_caps_and_summarises():fs = [_pen("door", "wall", 0.004, {"hinge": 0.5}), _pen("door", "wall", 0.031, {"hinge": 1.5}),_pen("door", "wall", 0.002, {}), _pen("lid", "box", 0.010, {"lid_j": 1.0}),GateFinding(gate="articulation", severity=Severity.ERROR, target="leg", message="floating",@@ -135,9 +135,7 @@ def test_aggregate_merges_poses_per_pair_and_ranks_by_depth():assert "3 of the sampled poses" in dw.message and "31.0 mm" in dw.message and "hinge=1.50" in dw.messageassert "1 at rest" in dw.messageassert all(f.severity == Severity.ERROR for f in out)---def test_aggregate_caps_errors_and_summarises_the_rest():+ # errors are capped; the rest is one summary WARNfs = [_pen(f"p{i}", "base", 0.001 * (i + 1), {"j": 1.0}) for i in range(MAX_PAIR_FINDINGS + 3)]out = aggregate_findings(fs)errors = [f for f in out if f.severity == Severity.ERROR]