Official Codebase of 3DCodeVerse
Python
scene assets: the plan's largest procedural module keeps its verdict
gaoypenge8b1515b4030
diff --git a/harness/codeverse/tracks/scene_assets.py b/harness/codeverse/tracks/scene_assets.pyindex 068e0f9a..5cd9bae2 100644--- a/harness/codeverse/tracks/scene_assets.py+++ b/harness/codeverse/tracks/scene_assets.py@@ -538,13 +538,24 @@ def _judge_wanted(ctx: RunContext, asset: AssetPlan, chk: AssetCheck | None, *,if asset.kind == "blender_glb":return Truefrac = _volume_fraction(ctx, asset)- if chk is not None and chk.ok and chk.ran and frac < JUDGE_VOLUME_FRACTION:+ # the plan's LARGEST module keeps its verdict whatever its share: no prop reaches 5 % of+ # a scene's volume (measured 2026-09-07 over two scenes: 1e-5 .. 2e-3), so the share+ # rule alone judged nothing, and the biggest prop is the one that dominates frames+ if chk is not None and chk.ok and chk.ran and frac < JUDGE_VOLUME_FRACTION and asset.name != _largest_module(ctx):ctx.events.emit("asset.judge_skipped", asset=asset.name, reason="gates_ok_and_small",volume_fraction=round(frac, 5), tris=chk.tris, meshes=chk.meshes)return Falsereturn True+def _largest_module(ctx: RunContext) -> str:+ """The name of the plan's biggest ``threejs`` asset by planned volume ('' when none)."""+ mods = [a for a in (getattr(ctx.plan, "assets", None) or []) if a.kind == "threejs"]+ if not mods:+ return ""+ return max(mods, key=lambda a: a.approx_size_m[0] * a.approx_size_m[1] * a.approx_size_m[2]).name++def _volume_fraction(ctx: RunContext, asset: AssetPlan) -> float:"""Asset bbox volume / scene bounds volume (1.0 when the scene bounds are unknown)."""bounds = getattr(ctx.plan, "bounds", None)diff --git a/harness/tests/orchestrator_tracks/test_scene_hero_ladder.py b/harness/tests/orchestrator_tracks/test_scene_hero_ladder.pyindex 7c9e0482..4eb24f9d 100644--- a/harness/tests/orchestrator_tracks/test_scene_hero_ladder.py+++ b/harness/tests/orchestrator_tracks/test_scene_hero_ladder.py@@ -220,3 +220,18 @@ def test_a_fix_that_judges_worse_is_undone(tmp_ws, settings):events = [json.loads(line) for line in tmp_ws.events_path.read_text().splitlines()]assert any(e["event"] == "asset.fix_reverted" and e["before"] == 0.6 and e["after"] == 0.4 for e in events)assert (tmp_ws.public / "assets" / f"{snake}.glb").is_file()+++def test_the_largest_module_is_judged_and_the_small_ones_are_not(tmp_ws, settings):+ """`render_asset` makes a threejs verdict possible; the share rule alone judged nothing+ (no prop reaches 5 % of a scene's volume), so the plan's largest module keeps its+ verdict and the rest skip with the same event as before."""+ ctx, _hero = _scene(tmp_ws, settings, services=CardedServices(), agent=FakeAgent(_writer(GOOD_MODEL)))+ mods = [a for a in ctx.plan.assets if a.kind == "threejs"]+ big = max(mods, key=lambda a: a.approx_size_m[0] * a.approx_size_m[1] * a.approx_size_m[2])+ small = min(mods, key=lambda a: a.approx_size_m[0] * a.approx_size_m[1] * a.approx_size_m[2])+ ok = SA.AssetCheck(ok=True, ran=True, tris=500, meshes=3, materials=2)+ assert SA._judge_wanted(ctx, big, ok, judge=True) is True+ assert SA._judge_wanted(ctx, small, ok, judge=True) is False+ events = [json.loads(line) for line in tmp_ws.events_path.read_text().splitlines()]+ assert [e["asset"] for e in events if e["event"] == "asset.judge_skipped"] == [small.name]