Skip to content

Official Codebase of 3DCodeVerse

Python

tests: the 14-view rig through every fixture and expectation

gaoypeng7e4a60cda84c
diff --git a/harness/tests/core/test_contracts.py b/harness/tests/core/test_contracts.py
index a6dc3883..d17f2c9e 100644
--- a/harness/tests/core/test_contracts.py
+++ b/harness/tests/core/test_contracts.py
@@ -22,7 +22,14 @@ from codeverse.contracts import (
Usage,
)
from codeverse.contracts.plan import AssetPlan, CameraPlan, ZonePlan
-from codeverse.conventions import OBJECT_VIEWS, slugify, to_pascal, to_snake
+from codeverse.conventions import (
+ OBJECT_CLAY_VIEWS,
+ OBJECT_VIEWS,
+ OBJECT_VIEWS_QUICK,
+ slugify,
+ to_pascal,
+ to_snake,
+)
def _box(cx=0.0, cy=0.0, cz=0.5, ex=1.0, ey=1.0, ez=1.0) -> BBox:
@@ -40,7 +47,17 @@ def test_names_normalise_consistently():
def test_view_presets_unique():
names = [v.name for v in OBJECT_VIEWS]
- assert len(names) == len(set(names)) == 8
+ assert len(names) == len(set(names)) == 14
+ # the 14-view rig (D47): quick subset by name, poles present, underside reachable
+ assert {v.name for v in OBJECT_VIEWS_QUICK} <= set(names) and len(OBJECT_VIEWS_QUICK) == 4
+ assert "bottom" in names and "top" in names
+ assert min(v.elevation_deg for v in OBJECT_VIEWS) == -90.0
+ assert max(v.elevation_deg for v in OBJECT_VIEWS) == 90.0
+ # the clay rig is its own 4-view tuple; its 'top' (el 88) deliberately shares the
+ # rig's name at a different camera — nothing may union the two tuples by name
+ assert len(OBJECT_CLAY_VIEWS) == 4
+ clay_top = next(v for v in OBJECT_CLAY_VIEWS if v.name == "top")
+ assert clay_top.elevation_deg == 88.0
def test_spec_rejects_language_outside_track():
diff --git a/harness/tests/cost/test_profiles.py b/harness/tests/cost/test_profiles.py
index 70d38f21..8fdaa8f3 100644
--- a/harness/tests/cost/test_profiles.py
+++ b/harness/tests/cost/test_profiles.py
@@ -66,7 +66,7 @@ def test_one_stated_judge_field_does_not_disable_the_whole_judge_block(monkeypat
s.apply_profile("quality")
assert s.judge.max_px == 800, "the field the user stated wins"
assert s.judge.samples == 3, "every field the user did NOT state still follows the profile"
- assert s.judge.montages == 3 and s.judge.detail_crops == 2
+ assert s.judge.montages == 5 and s.judge.detail_crops == 2
# and the same dial, whichever way the profile was named (cost/profiles.py's invariant)
monkeypatch.setenv("CV3D_PROFILE", "quality")
get_settings.cache_clear()
@@ -184,17 +184,17 @@ def _dial_from_env(name: str, monkeypatch):
("economy", {"generator": "single-shot:gemini:gemini-3.7-flash",
"judge": "gemini:gemini-3.7-flash", "judge_samples": 2,
"rounds": 2, "candidates": 1, "texture": False,
- "judge_max_px": 1024, "judge_montages": 3, "judge_detail_crops": 2,
+ "judge_max_px": 1024, "judge_montages": 5, "judge_detail_crops": 2,
"agent_max_turns": 0, "max_minutes": 30.0}),
("balanced", {"generator": "gemini-cli:gemini-3.7-flash",
"judge": "gemini:gemini-3.1-pro-preview", "judge_samples": 1,
"rounds": 4, "candidates": 1, "texture": False,
- "judge_max_px": 1024, "judge_montages": 3, "judge_detail_crops": 2,
+ "judge_max_px": 1024, "judge_montages": 5, "judge_detail_crops": 2,
"agent_max_turns": 0, "max_minutes": 60.0}),
("quality", {"generator": "gemini-cli:gemini-3.7-flash",
"judge": "gemini:gemini-3.1-pro-preview", "judge_samples": 3,
"rounds": 4, "candidates": 2, "texture": True,
- "judge_max_px": 1024, "judge_montages": 3, "judge_detail_crops": 2,
+ "judge_max_px": 1024, "judge_montages": 5, "judge_detail_crops": 2,
"agent_max_turns": 0, "max_minutes": 90.0}),
],
)
diff --git a/harness/tests/gallery/test_triage.py b/harness/tests/gallery/test_triage.py
index d6ef8830..56a4b595 100644
--- a/harness/tests/gallery/test_triage.py
+++ b/harness/tests/gallery/test_triage.py
@@ -106,6 +106,9 @@ def test_hero_falls_back_to_the_sheet_when_a_round_has_no_views(tmp_path: Path):
# --------------------------------------------------------------------------- labels
@pytest.mark.parametrize(("raw", "human"), [
+ ("front_right_high", "Front Right High"),
+ ("back_left_low", "Back Left Low"),
+ ("bottom", "Bottom"),
("front_right_34", "Front Right ¾"),
("view_front_right_34.png", "Front Right ¾"),
("back_left_34", "Back Left ¾"),
diff --git a/harness/tests/judges/conftest.py b/harness/tests/judges/conftest.py
index a14d218c..662c9f57 100644
--- a/harness/tests/judges/conftest.py
+++ b/harness/tests/judges/conftest.py
@@ -18,7 +18,7 @@ from codeverse.judges.base import JudgeInput
from codeverse.judges.rubrics import Rubric
from codeverse.models.base import ModelError
-VIEW_NAMES = ("front_right_34", "back_left_34", "front", "top")
+VIEW_NAMES = ("front_right_high", "back_left_high", "front", "top")
def draw_chair(path: Path, *, az_hint: int = 0, size: int = 512, legs: int = 4, color=(150, 90, 40)) -> Path:
diff --git a/harness/tests/judges/test_defects.py b/harness/tests/judges/test_defects.py
index 9c5fabd6..1ffb85c0 100644
--- a/harness/tests/judges/test_defects.py
+++ b/harness/tests/judges/test_defects.py
@@ -142,7 +142,7 @@ def test_acceptance_vote_ties_follow_the_representative_sample(judge_input, cach
def test_missing_views_cap_for_articulated():
- rest = [RenderView(name=n, path="x") for n in ("front_right_34", "top")]
+ rest = [RenderView(name=n, path="x") for n in ("front_right_high", "top")]
res = apply_caps(A, 0.9, [], {}, [], views=rest)
assert res.overall == 0.5 and res.caps_applied[0].rule == "missing_pose_sheet"
res2 = apply_caps(A, 0.9, [], {}, [], views=rest + [RenderView(name="articulation_sheet", path="s")])
diff --git a/harness/tests/judges/test_montage.py b/harness/tests/judges/test_montage.py
index f654a635..f9c2cd5c 100644
--- a/harness/tests/judges/test_montage.py
+++ b/harness/tests/judges/test_montage.py
@@ -17,7 +17,13 @@ from codeverse.judges.prompt_builder import (
from codeverse.spatial.sheet import crop_region, montage_2x2
from tests.judges.conftest import draw_chair
-OBJ = ("front_right_34", "back_left_34", "front", "right", "back", "left", "top", "low_front_left")
+#: the 14-view rig in OBJECT_VIEWS order (D47)
+OBJ = ("front_right_high", "back_right_high", "back_left_high", "front_left_high",
+ "front", "right", "back", "left",
+ "front_right_low", "back_right_low", "back_left_low", "front_left_low",
+ "top", "bottom")
+#: the clay rig's own cameras (OBJECT_CLAY_VIEWS)
+CLAY = ("front_right_34", "back_left_34", "top", "low_front_left")
def _views(tmp: Path, names, *, mode="shaded", prefix="v"):
@@ -29,8 +35,8 @@ def _views(tmp: Path, names, *, mode="shaded", prefix="v"):
def test_rank_views_objects_and_scenes():
- vs = [RenderView(name=n, path="x") for n in ("left", "top", "zzz", "front_right_34")]
- assert [v.name for v in rank_views(vs, scene=False)] == ["front_right_34", "top", "left", "zzz"]
+ vs = [RenderView(name=n, path="x") for n in ("left", "top", "zzz", "front_right_high")]
+ assert [v.name for v in rank_views(vs, scene=False)] == ["front_right_high", "top", "left", "zzz"]
# scene rig: the scene's OWN cameras (any name that is not a harness rig name) come
# first — they are the pictures being graded; the overview rig follows in rank order
# and the eye-level rig last
@@ -42,13 +48,32 @@ def test_plan_montages_object_rig(tmp_path):
rs = RenderSet(views=_views(tmp_path, OBJ))
ms = plan_montages(rs)
kinds = [m.kind for m in ms]
- assert kinds == ["shaded", "shaded", "detail", "detail"]
- assert [v.name for v in ms[0].tiles] == ["front_right_34", "back_left_34", "top", "low_front_left"]
+ assert kinds == ["shaded", "shaded", "shaded", "shaded", "detail", "detail"]
+ assert [v.name for v in ms[0].tiles] == ["front_right_high", "back_left_high", "top", "bottom"]
assert [v.name for v in ms[1].tiles] == ["front", "right", "back", "left"]
- assert ms[2].crop == (0.25, 0.25, 0.75, 0.75) and ms[3].tiles[0].name == "low_front_left"
+ assert [v.name for v in ms[2].tiles] == ["front_right_low", "back_left_low", "front_left_high", "back_right_high"]
+ assert [v.name for v in ms[3].tiles] == ["front_left_low", "back_right_low"]
+ assert ms[4].crop == (0.25, 0.25, 0.75, 0.75) and ms[5].tiles[0].name == "bottom"
assert "- image 2: SHADED views (remaining)" in describe_montages(ms)
+def test_plan_montages_full_rig_plus_clay_is_the_measured_cprod_plan(tmp_path):
+ """14 shaded + 4 clay -> exactly 5 montages + 2 crops; montage 1 keeps the underside
+ even under a montage-cap truncation, and one crop is anchored on ``bottom`` (D47)."""
+ rs = RenderSet(views=_views(tmp_path, OBJ))
+ clay = RenderSet(views=_views(tmp_path, CLAY, mode="clay", prefix="c"))
+ ms = plan_montages(rs, geometry_views=clay) # defaults: max_montages=5, detail_crops=2
+ grids = [m for m in ms if not m.is_detail]
+ crops = [m for m in ms if m.is_detail]
+ assert len(ms) == 7 and len(grids) == 5 and len(crops) == 2
+ assert [m.kind for m in grids] == ["shaded", "geometry", "shaded", "shaded", "shaded"]
+ assert {v.name for v in grids[0].tiles} == {"front_right_high", "back_left_high", "top", "bottom"}
+ assert {v.name for v in grids[1].tiles} == set(CLAY) and all(v.mode == "clay" for v in grids[1].tiles)
+ assert [v.name for v in grids[2].tiles] == ["front", "right", "back", "left"]
+ assert crops[0].tiles[0].name == "front_right_high"
+ assert crops[1].tiles[0].name == "bottom"
+
+
def test_plan_montages_articulated_and_geometry(tmp_path):
poses = _views(tmp_path, ["pose_rest", "pose_J@upper", "pose_K@upper"], prefix="p")
sheet = _views(tmp_path, ["articulation_sheet"], prefix="s")
@@ -57,12 +82,12 @@ def test_plan_montages_articulated_and_geometry(tmp_path):
ms = plan_montages(rs, geometry_views=clay, max_montages=3, detail_crops=0)
assert [m.kind for m in ms] == ["shaded", "pose_sheet", "geometry"]
assert ms[1].passthrough and ms[1].tiles[0].name == "articulation_sheet"
- # geometry tiles are matched to the primary montage's views first
- assert [v.name for v in ms[2].tiles] == ["front_right_34", "top", "back"]
+ # geometry tiles are matched to the primary montage's views first ("top" is in montage 1)
+ assert [v.name for v in ms[2].tiles] == ["top", "front_right_34", "back"]
assert "GEOMETRY-ONLY views (clay" in ms[2].title
# more room: secondary shaded then the pose 2×2 (duplicate of the sheet, lowest priority)
- ms5 = plan_montages(rs, geometry_views=clay, max_montages=5, detail_crops=0)
- assert [m.kind for m in ms5] == ["shaded", "pose_sheet", "geometry", "shaded", "poses"]
+ ms5 = plan_montages(rs, geometry_views=clay, max_montages=7, detail_crops=0)
+ assert [m.kind for m in ms5] == ["shaded", "pose_sheet", "geometry", "shaded", "shaded", "shaded", "poses"]
# without a sheet the pose_* views form the pose montage
rs2 = RenderSet(views=_views(tmp_path, OBJ[:4]) + poses)
ms2 = plan_montages(rs2, detail_crops=0)
@@ -75,17 +100,17 @@ def test_shuffle_keeps_sets_and_details_last(tmp_path):
sh = shuffle_montages(ms, 7)
assert shuffle_montages(ms, 7) == sh and shuffle_montages(ms, None) == ms
assert [m.kind for m in sh[-2:]] == ["detail", "detail"]
- assert {frozenset(v.name for v in m.tiles) for m in sh[:2]} == {frozenset(v.name for v in m.tiles) for m in ms[:2]}
+ assert {frozenset(v.name for v in m.tiles) for m in sh[:-2]} == {frozenset(v.name for v in m.tiles) for m in ms[:-2]}
seeds = {tuple((m.kind, tuple(v.name for v in m.tiles)) for m in shuffle_montages(ms, s)) for s in range(6)}
assert len(seeds) >= 3
def test_labels_and_render(tmp_path):
- rs = RenderSet(views=_views(tmp_path, OBJ[:3]))
+ rs = RenderSet(views=_views(tmp_path, ("front_right_high", "back_left_high", "front")))
m = plan_montages(rs, detail_crops=1)[0]
lbl = montage_label(m, 1, 1)
- assert lbl.startswith("MONTAGE 1/1 — SHADED views: top-left = front_right_34 · az 35° el 22°, top-right = back_left_34")
- assert "bottom-left = front · az 0° el 8°" in lbl
+ assert lbl.startswith("MONTAGE 1/1 — SHADED views: top-left = front_right_high · az 45° el 30°, top-right = back_left_high")
+ assert "bottom-left = front · az 0° el 0°" in lbl
assert montage_strip(m, 1, 1) == "MONTAGE 1/1 — SHADED views"
png = render_montage(m, cache_dir=tmp_path / "cache", tile_px=256)
assert png.is_file() and render_montage(m, cache_dir=tmp_path / "cache", tile_px=256) == png # cached
diff --git a/harness/tests/judges/test_pairwise.py b/harness/tests/judges/test_pairwise.py
index 45f3f9c2..54da92ab 100644
--- a/harness/tests/judges/test_pairwise.py
+++ b/harness/tests/judges/test_pairwise.py
@@ -19,7 +19,7 @@ def test_agreement_across_swap(tmp_path, cache_dir):
reqs = {r.label: r for r in model.requests} # orderings run in parallel: look up by label
labels = [p.label for p in image_parts(reqs["pairwise:fwd"])]
assert len(labels) == 2 # one 2×2 montage per side
- assert labels[0].startswith("CANDIDATE A — MONTAGE 1/1 — SHADED views: top-left = front_right_34") and labels[1].startswith("CANDIDATE B — MONTAGE")
+ assert labels[0].startswith("CANDIDATE A — MONTAGE 1/1 — SHADED views: top-left = front_right_high") and labels[1].startswith("CANDIDATE B — MONTAGE")
# swapped ordering puts rb first as "A"
labels2 = [p.label for p in image_parts(reqs["pairwise:swap"])]
assert labels2[0].startswith("CANDIDATE A — MONTAGE")
diff --git a/harness/tests/judges/test_prompt_builder.py b/harness/tests/judges/test_prompt_builder.py
index 363999d8..ec24ea8e 100644
--- a/harness/tests/judges/test_prompt_builder.py
+++ b/harness/tests/judges/test_prompt_builder.py
@@ -58,10 +58,10 @@ def test_user_message_layout(judge_input, cache_dir):
imgs = _images(msgs)
# 4 shaded views → ONE 2×2 montage + centre crop + ground-contact crop
assert len(imgs) == 3
- assert imgs[0].label.startswith("MONTAGE 1/1 — SHADED views: top-left = front_right_34 · az 35° el 22°")
- assert "bottom-left = top · az 0° el 88°, bottom-right = front · az 0° el 8°" in imgs[0].label
- assert imgs[1].label.startswith("DETAIL CROP — centre of front_right_34")
- assert imgs[2].label.startswith("DETAIL CROP — ground-contact band of front") # lowest elevation (8°)
+ assert imgs[0].label.startswith("MONTAGE 1/1 — SHADED views: top-left = front_right_high · az 45° el 30°")
+ assert "bottom-left = top · az 0° el 90°, bottom-right = front · az 0° el 0°" in imgs[0].label
+ assert imgs[1].label.startswith("DETAIL CROP — centre of front_right_high")
+ assert imgs[2].label.startswith("DETAIL CROP — ground-contact band of front") # lowest elevation (0°)
# labelled text precedes each image; the rig paragraph lists images in send order
idx = parts.index(imgs[0])
assert isinstance(parts[idx - 1], TextPart) and parts[idx - 1].text == imgs[0].label
@@ -93,14 +93,20 @@ def test_shuffle_is_deterministic_and_changes_order(tmp_path, judge_input, cache
def test_geometry_views_add_a_montage(tmp_path, judge_input, cache_dir):
+ """The clay montage rides the pipeline's OWN cameras (OBJECT_CLAY_VIEWS) and labels
+ them — the clay 'top' is el 88 while the rig's shaded 'top' is el 90 (D47)."""
+ from codeverse.conventions import OBJECT_CLAY_VIEWS
+
clay = []
- for v in judge_input.renders.views:
+ for v in OBJECT_CLAY_VIEWS:
p = draw_chair(tmp_path / f"clay_{v.name}.png", color=(180, 180, 180))
clay.append(RenderView(name=v.name, path=str(p), mode="clay"))
_, msgs = build_judge_messages(judge_input, R, cache_dir=cache_dir, geometry_views=RenderSet(views=clay))
labels = [p.label for p in _images(msgs)]
assert labels[0].startswith("MONTAGE 1/2 — SHADED views") and labels[1].startswith("MONTAGE 2/2 — GEOMETRY-ONLY views (clay")
assert "front_right_34 · az 35° el 22° · clay" in labels[1]
+ assert "top · az 0° el 88° · clay" in labels[1]
+ assert "top · az 0° el 90°" in labels[0]
text = _parts(msgs)[0].text
assert "GEOMETRY-ONLY montage shows the same object without materials" in text
# embedded clay views (by RenderView.mode) are routed the same way
@@ -153,7 +159,10 @@ def test_view_az_el_geometry():
v = RenderView(name="custom", path="x.png", camera_position=(0.0, 1.0, 1.0), look_at=(0, 0, 0))
az, el = view_az_el(v)
assert az == 0.0 and el == 45.0
- assert view_az_el(RenderView(name="top", path="x")) == (0.0, 88.0)
+ assert view_az_el(RenderView(name="top", path="x")) == (0.0, 90.0)
+ # a geometry-mode tile answers from the clay rig's own cameras (el 88, not 90)
+ assert view_az_el(RenderView(name="top", path="x", mode="clay")) == (0.0, 88.0)
+ assert view_az_el(RenderView(name="front_right_34", path="x", mode="normals")) == (35.0, 22.0)
assert view_az_el(RenderView(name="zzz", path="x")) is None
diff --git a/harness/tests/judges/test_vlm_judge.py b/harness/tests/judges/test_vlm_judge.py
index 26627f0c..eab634e8 100644
--- a/harness/tests/judges/test_vlm_judge.py
+++ b/harness/tests/judges/test_vlm_judge.py
@@ -189,8 +189,9 @@ def test_judge_payload_size_comes_from_the_settings_dial(monkeypatch):
monkeypatch.setattr("codeverse.judges.vlm_judge.get_settings", lambda: s)
j = VlmJudge(rubric="static_object_v1", model_id="fake:fake-1")
# no profile shrinks the payload: 768 px bills the same as 1024 on Gemini and is
- # noisier, and the 2→1 crop cut did not survive a second draw (docs/COST.md §14)
- assert j.max_px == 1024 and j.detail_crops == 2 and j.max_montages == 3
+ # noisier, the 2→1 crop cut did not survive a second draw (docs/COST.md §14), and
+ # fewer than 5 montages would silently drop the rig's low ring + poles (D47)
+ assert j.max_px == 1024 and j.detail_crops == 2 and j.max_montages == 5
# a caller that states a size still gets it — the dial is the default, not a cap
explicit = VlmJudge(rubric="static_object_v1", model_id="fake:fake-1", max_px=768, detail_crops=1)
assert explicit.max_px == 768 and explicit.detail_crops == 1
diff --git a/harness/tests/reference/test_silhouette_best_view.py b/harness/tests/reference/test_silhouette_best_view.py
index 989c42eb..e103e70f 100644
--- a/harness/tests/reference/test_silhouette_best_view.py
+++ b/harness/tests/reference/test_silhouette_best_view.py
@@ -20,7 +20,7 @@ def _shape(path: Path, box, bg=(240, 240, 240), fg=(30, 30, 30)) -> Path:
def _views(tmp: Path) -> list[RenderView]:
tmp.mkdir(parents=True, exist_ok=True)
boxes = {"front": (40, 40, 90, 220), # tall and narrow — wrong
- "front_right_34": (60, 60, 200, 200), # square
+ "front_right_high": (60, 60, 200, 200), # square
"right": (30, 90, 230, 170)} # wide and flat — matches the reference
return [RenderView(name=n, path=str(_shape(tmp / f"{n}.png", b)), width=256, height=256)
for n, b in boxes.items()]
@@ -31,13 +31,16 @@ def test_picks_the_matching_view_not_the_first(tmp_path: Path) -> None:
res = best_view_match(_views(tmp_path / "r"), ref)
assert res["view"] == "right"
assert res["iou"] == max(res["per_view"].values())
- assert set(res["per_view"]) == {"front", "front_right_34", "right"}
+ assert set(res["per_view"]) == {"front", "front_right_high", "right"}
# the fixed-front comparison would have scored much worse
assert res["iou"] > res["per_view"]["front"] + 0.2
def test_candidate_filter_excludes_top_and_low_cameras(tmp_path: Path) -> None:
- assert "top" not in CANDIDATE_VIEWS and "low_front_left" not in CANDIDATE_VIEWS
+ assert "top" not in CANDIDATE_VIEWS and "bottom" not in CANDIDATE_VIEWS
+ assert "low_front_left" not in CANDIDATE_VIEWS and "front_right_low" not in CANDIDATE_VIEWS
+ # pre-D47 stored runs must still match their own cameras
+ assert "front_right_34" in CANDIDATE_VIEWS and "back_left_34" in CANDIDATE_VIEWS
views = _views(tmp_path / "r")
views.append(RenderView(name="top", path=views[0].path, width=256, height=256))
res = best_view_match(views, _shape(tmp_path / "ref.png", (20, 95, 236, 165)))
diff --git a/harness/tests/spatial_tools/test_live_render.py b/harness/tests/spatial_tools/test_live_render.py
index 434c9a3e..5f927ad6 100644
--- a/harness/tests/spatial_tools/test_live_render.py
+++ b/harness/tests/spatial_tools/test_live_render.py
@@ -20,8 +20,10 @@ def test_render_views_and_silhouette_live(stool_ctx: ToolContext) -> None:
assert Path(obs.images[0]).is_file() and obs.numbers["views"] == ["front", "top"]
sheet = Image.open(obs.images[0])
assert sheet.size[0] > sheet.size[1]
- # the silhouette of the front view is its own perfect reference
- sil = get_tool("render_views").call(stool_ctx, {"views": ["front"], "mode": "silhouette", "size": 256})
+ # the silhouette of the front view is its own perfect reference (rendered at the
+ # tool's own 512 px — the D47 eye-level front (el 0) shows the legs edge-on, and a
+ # 256→512 resample alone costs ~0.05 IoU on those thin features)
+ sil = get_tool("render_views").call(stool_ctx, {"views": ["front"], "mode": "silhouette", "size": 512})
assert sil.ok, sil.text
ref = stool_ctx.workspace.root / "ref.png"
Image.open(sil.images[-1]).convert("RGB").save(ref)
diff --git a/harness/tests/spatial_tools/test_tools.py b/harness/tests/spatial_tools/test_tools.py
index 81ea2119..4b5106da 100644
--- a/harness/tests/spatial_tools/test_tools.py
+++ b/harness/tests/spatial_tools/test_tools.py
@@ -220,7 +220,7 @@ def fake_renderer(monkeypatch: pytest.MonkeyPatch):
def test_render_views_cached(stool_ctx: ToolContext, fake_renderer) -> None:
obs = get_tool("render_views").call(stool_ctx, {})
assert obs.ok and obs.images[0].endswith("sheet.png") and len(obs.images) == 5 # sheet + 4 views
- assert obs.numbers["views"] == ["front_right_34", "back_left_34", "front", "top"]
+ assert obs.numbers["views"] == ["front_right_high", "back_left_high", "front", "top"]
assert "artifacts/tool_renders/r00_" in obs.text and str(stool_ctx.workspace.root) not in obs.text
again = get_tool("render_views").call(stool_ctx, {})
# same args → the same deterministic out_dir, which is what lets render_glb's OWN cache
@@ -231,7 +231,7 @@ def test_render_views_cached(stool_ctx: ToolContext, fake_renderer) -> None:
obs = get_tool("render_views").call(stool_ctx, {"views": ["front", "back", "left", "right", "top"]})
assert obs.ok and len(obs.images) == 1 # > 4 views → sheet only
obs = get_tool("render_views").call(stool_ctx, {"views": ["frontal"]})
- assert not obs.ok and "front_right_34" in obs.text
+ assert not obs.ok and "front_right_high" in obs.text
obs = get_tool("render_views").call(stool_ctx, {"mode": "xray"})
assert not obs.ok and "shaded" in obs.text
# 'depth' was advertised from the first commit and never drawn by any renderer:
@@ -257,7 +257,7 @@ def test_render_modes_match_the_js_rig() -> None:
def test_render_sheet_and_isolate(stool_ctx: ToolContext, fake_renderer) -> None:
obs = get_tool("render_sheet").call(stool_ctx, {"mode": "wire"})
- assert obs.ok and len(obs.images) == 1 and obs.numbers["n_views"] == 8
+ assert obs.ok and len(obs.images) == 1 and obs.numbers["n_views"] == 14
obs = get_tool("isolate").call(stool_ctx, {"part": "Leg_3"})
assert obs.ok and obs.numbers["part"] == "Leg_3" and "| Leg_3 |" in obs.text
obs = get_tool("isolate").call(stool_ctx, {"part": "Nope"})
diff --git a/harness/tests/threejs_render/test_camera_fit.py b/harness/tests/threejs_render/test_camera_fit.py
index c9d079e7..405b89ee 100644
--- a/harness/tests/threejs_render/test_camera_fit.py
+++ b/harness/tests/threejs_render/test_camera_fit.py
@@ -74,7 +74,7 @@ def test_fit_scales_with_the_box_not_the_view(tmp_path):
rows = _fit_report(tmp_path)["rows"]
by = {(r["box"], r["name"], round(r["aspect"], 2)): r["distance"] for r in rows}
# the wide bench needs more distance than the small stool from the same view
- for name in ("front", "front_right_34"):
+ for name in ("front", "front_right_high", "bottom"):
assert by[(1, name, 1.0)] > by[(0, name, 1.0)]
# a wider frame never needs to back off further than a square one (vertical fov fixed)
for (b, name, aspect), d in by.items():
diff --git a/harness/tests/threejs_render/test_studio_rig.py b/harness/tests/threejs_render/test_studio_rig.py
index 2eef5603..5e862692 100644
--- a/harness/tests/threejs_render/test_studio_rig.py
+++ b/harness/tests/threejs_render/test_studio_rig.py
@@ -104,19 +104,31 @@ def test_studio_render_is_reproducible_and_stamps_the_rig_version(stool_glb: Pat
def test_orbit_views_share_one_camera_distance(stool_glb: Path, tmp_path: Path):
- """Consistent framing: views in the orbit band (|elevation| <= 60) share one camera
- distance so the object keeps its apparent size across the montage — but no view is
- pulled back by more than 10 %, or a deep object shrinks every frame to what its
- widest side needs and the judge loses detail resolution."""
+ """Consistent framing: views in the orbit band (|elevation| <= 60) are pulled towards
+ one shared camera distance so the object keeps its apparent size across the montage —
+ but no view is pulled back by more than 10 % beyond its own exact fit, or a deep
+ object shrinks every frame to what its widest side needs and the judge loses detail
+ resolution. Under the 14-view rig (D47) the band spans three elevation rings whose
+ exact fits genuinely differ, so the 10 % cap leaves a bounded spread between rings;
+ within a ring the distance must still be one number."""
from codeverse.conventions import OBJECT_VIEWS
render_glb(stool_glb, tmp_path / "o", views=OBJECT_VIEWS, width=192, height=192,
sheet=False, use_cache=False)
meta = json.loads((tmp_path / "o" / "views.json").read_text())
band, steep = [], []
+ rings: dict[float, list[float]] = {}
for v in meta["views"]:
d = float(np.linalg.norm(np.array(v["camera_position"]) - np.array(v["look_at"])))
- (steep if abs(v["elevation"]) > 60 else band).append(d)
- assert len(band) >= 4
- assert max(band) / min(band) <= 1.10 + 1e-6, f"orbit distances spread too far: {sorted(band)}"
+ if abs(v["elevation"]) > 60:
+ steep.append(d)
+ else:
+ band.append(d)
+ rings.setdefault(abs(float(v["elevation"])), []).append(d)
+ assert len(band) >= 4 and len(rings) >= 2
+ for el, ds in rings.items():
+ assert max(ds) / min(ds) <= 1.0 + 1e-6, f"ring |el|={el} not uniform: {sorted(ds)}"
+ # the pullback cap bounds how far rings can drift apart; 1.25 is slack over the
+ # stool's measured 1.14 (eye ring vs the ±30° rings), a real regression is far larger
+ assert max(band) / min(band) <= 1.25 + 1e-6, f"orbit distances spread too far: {sorted(band)}"
assert steep, "OBJECT_VIEWS should still contain a plan view that fits itself"