Official Codebase of 3DCodeVerse
Python
scene gates: a wrapper is scale-checked by its instances; "inside" is the mesh's volume; the dark hint speaks the rig's vocabulary
gaoypeng7a29ff352a31
diff --git a/harness/codeverse/spatial/frame_metrics.py b/harness/codeverse/spatial/frame_metrics.pyindex b34ef542..eb4dc085 100644--- a/harness/codeverse/spatial/frame_metrics.py+++ b/harness/codeverse/spatial/frame_metrics.py@@ -49,7 +49,9 @@ EYE_MAX_ABOVE_GROUND_M = 80.0#: for a frame that is dark AND flat -- nothing is lit, so adding light is right_DARK_HINT = (- "raise the key + fill: DirectionalLight intensity 2–4, HemisphereLight 0.5–1.0 (sky colour / ground colour), "+ "raise the light through the rig env.js already builds — `sunRig({ mood: 'day'|'golden'|'night'|'overcast', "+ "intensity, fill, … })`: pick the brief's mood (a set sun, elevation < 0, is the night rig), raise `intensity` (key, "+ "the rig clamps requests below its floor UP) and `fill` (hemisphere, 1.0–2.0) — do not add a second sun on top; ""add emissive lights where the brief has them (lantern glow: MeshStandardMaterial emissive + emissiveIntensity 2–6, ""a PointLight 0.5–2 per lantern); scene.fog colour must match the sky colour; dusk/night is orange/purple/deep blue, ""NOT black — keep mean luminance ≥ 0.15 (check with scene_views: camera_checks.mean_lum)"diff --git a/harness/codeverse/spatial/scene_placement.py b/harness/codeverse/spatial/scene_placement.pyindex eca4944a..bb997add 100644--- a/harness/codeverse/spatial/scene_placement.py+++ b/harness/codeverse/spatial/scene_placement.py@@ -87,6 +87,21 @@ class AssetRow(BaseModel):"often wraps its content in one group, and the plan-contents check has to ""see through it",)+ families: dict[str, dict[str, float]] = Field(+ default_factory=dict,+ description="per named family below this row with >= 2 members: {n, size_m} — the median "+ "largest extent of ONE member, so a wrapper holding twelve fence panels is "+ "scale-checked as a fence panel, not as the 15 m run",+ )++ def instance_size(self, key: str) -> tuple[int, float]:+ """``(members, median largest extent)`` of the family the plan's ``key`` names inside+ this row, ``(0, 0.0)`` when the row is not a wrapper of such instances."""+ best = (0, 0.0)+ for fam, v in self.families.items():+ if key in to_snake(fam) and int(v.get("n", 0)) >= 2 and float(v.get("size_m", 0.0)) > 0 and int(v["n"]) > best[0]:+ best = (int(v["n"]), float(v["size_m"]))+ return best@propertydef qualified(self) -> str:@@ -454,7 +469,12 @@ def contract_findings(census: dict[str, Any] | None, plan: Any,key = next((k for k in sizes if k in rk), "")if not key:continue- measured = max(float(v) for v in r.bbox["size"])+ # a wrapper of instances is measured as ONE instance: the plan sized the fence panel, the+ # row is the whole run (host_placement `families`)+ n, measured = r.instance_size(key)+ what = f"each of the {n} {key} instances in {r.qualified}" if n else r.qualified+ if not n:+ measured = max(float(v) for v in r.bbox["size"])f = measured / sizes[key]if f > SCALE_ERROR or f < 1 / SCALE_ERROR:sev = Severity.ERROR@@ -462,9 +482,9 @@ def contract_findings(census: dict[str, Any] | None, plan: Any,sev = Severity.WARNelse:continue- out.append(_f(sev, f"{r.qualified} measures {measured:.2f} m but the plan sized {key} at ~{sizes[key]:.2f} m ({f:.1f}x)",- target=r.qualified, kind="scale", factor=round(f, 2), zone=r.zone,- hint=f"scale {r.name} so its largest dimension is ~{sizes[key]:.2f} m as planned"))+ out.append(_f(sev, f"{what} measures {measured:.2f} m but the plan sized {key} at ~{sizes[key]:.2f} m ({f:.1f}x)",+ target=r.qualified, kind="scale", factor=round(f, 2), zone=r.zone, instances=n,+ hint=f"scale {'each ' + key if n else r.name} so its largest dimension is ~{sizes[key]:.2f} m as planned"))# -- content inside the world boundsbounds = _plan_bounds(plan)if bounds:diff --git a/harness/docs/DECISIONS.md b/harness/docs/DECISIONS.mdindex a8a94ffb..fadea3f5 100644--- a/harness/docs/DECISIONS.md+++ b/harness/docs/DECISIONS.md@@ -980,7 +980,7 @@ written) that were accepted because the code works that way and the tests pin itis exactly why validating on it was not enough. The measurement stands and is worthredoing with a discriminator that asks the right question (how far the eye is from theCONTAINING mesh's own surface, not from anything at all); the rule does not ship on this- evidence.+ evidence. (Done 2026-09-07 with that discriminator — D67.)* **D63 A scene hero climbs the same ladder as a module, and its GLB is checked like one(2026-09-07).** Measured over the 18 `blender_glb` heroes in the recorded batteries@@ -1038,6 +1038,30 @@ written) that were accepted because the code works that way and the tests pin itthe plan's largest module of at least 1 m³ is judged whatever its share — one extraverdict per scene at most; a bollard is not a hero, a boat is.+* **D67 Two placement-side false positives that cost whole rounds, measured on loop 9 and+ fixed at the source (2026-09-07).** (1) *Scale of a wrapper.* A zone wraps a scatter in+ one group and the census row is the wrapper: the lighthouse's `PathAndFence/PicketFences`+ (twelve 2.2 m panels along a path) measured 14.73 m against the plan's 2.4 m panel, a+ "6.1x" ERROR the judge repeated ("towering over the camera" — the frame shows a knee-high+ fence) and the repair obeyed by shrinking the whole run to dots; `GorseBushClusters` (8.6x)+ and `CoastalRockOutcrops` (9.1x) the same. Rows now carry `families` — per named family+ below the row with >= 2 members, the median largest extent of ONE member — and the scale+ check measures the family the plan's key names (`AssetRow.instance_size`), falling back to+ the row's box when the row is not such a wrapper. Re-probed on the recorded round-0+ workspace: four scale ERRORs → none; the instances the plan sized are 0.6 m gorse (plan+ 1.5), 2.16 m fence panels (2.4), 4.9 m rocks (3.8). (2) *"Inside" is the mesh's volume.*+ The windmill's `MillDetail` camera was `camera_in_geometry` for three rounds with+ `nearest_hit_m` 4.9: the 22 m lattice sails own a 22 x 22 m world box that is nearly all+ air, and the box term alone said inside. This is the discriminator D62 asked for and+ declined to guess at: `eyeInsideMesh` decides by ray parity over the mesh's own triangles+ (six skewed rays, majority; both faces, so the FrontSide `BarCounter` of+ `test_a_lens_inside_geometry_retreats_until_clear` still counts and the buried-camera+ repair keeps working), the box stays the pre-filter. Re-rendered on the recorded round-1+ workspace: `MillDetail` inside [] / nearest 12.0 m. Also: the dark-frame hint now speaks+ the rig's vocabulary (`sunRig({ mood, intensity, fill })`) instead of telling the agent to+ add a second DirectionalLight on top of the rig the starter builds (D65) — the loop-9+ lighthouse did exactly that.+## Rejected / deferred* A versioned `Spec`/`RunRecord`/`RunState` load-normaliser (rejected 2026-08-30: of the sevendiff --git a/harness/runtime_js/lib/host_metrics.mjs b/harness/runtime_js/lib/host_metrics.mjsindex bfcc5d5c..5f7ced2d 100644--- a/harness/runtime_js/lib/host_metrics.mjs+++ b/harness/runtime_js/lib/host_metrics.mjs@@ -54,10 +54,41 @@ export function frameStats(canvas) {};}+// six skewed directions, not the axes: a ray straight up from a round camera position hits the+// centre line of an axis-aligned ceiling, i.e. the diagonal both triangles share, twice+const PARITY_DIRS = [[1, 0.37, 0.23], [-1, 0.29, -0.41], [0.31, 1, 0.19], [-0.27, -1, 0.35], [0.23, 0.41, 1], [-0.39, 0.17, -1]];++/**+ * Is `eye` inside the mesh's own volume? Ray parity in six directions over the+ * geometry's triangles (both faces — a back-face culled room interior still counts,+ * which is what the Raycaster could not do), majority of the six. A room with an+ * open door or no ceiling still reads inside; a lattice, a star, a thin ring or a+ * hollow arch the lens merely stands near does not.+ */+export function eyeInsideMesh(o, eye, THREE) {+ const g = o.geometry, pos = g.attributes.position, idx = g.index;+ if (!pos) return false;+ const local = eye.clone().applyMatrix4(new THREE.Matrix4().copy(o.matrixWorld).invert());+ const a = new THREE.Vector3(), b = new THREE.Vector3(), c = new THREE.Vector3(), hit = new THREE.Vector3();+ const n = idx ? idx.count : pos.count;+ const vertex = (i) => (idx ? idx.getX(i) : i);+ let odd = 0;+ for (const d of PARITY_DIRS) {+ const ray = new THREE.Ray(local, new THREE.Vector3(...d).normalize());+ let hits = 0;+ for (let i = 0; i + 2 < n; i += 3) {+ a.fromBufferAttribute(pos, vertex(i)); b.fromBufferAttribute(pos, vertex(i + 1)); c.fromBufferAttribute(pos, vertex(i + 2));+ if (ray.intersectTriangle(a, b, c, false, hit)) hits += 1;+ }+ if (hits % 2 === 1) odd += 1;+ }+ return odd >= 4;+}+/*** Near-geometry test: centre + 3x3 grid rays from the camera; nearest hit- * distance, plus meshes whose world bbox contains the eye (closed rooms,- * back-face culled interiors).+ * distance, plus meshes whose own volume contains the eye (closed rooms,+ * back-face culled interiors — `eyeInsideMesh`).*/export function nearGeometry(scene, camera, THREE, limitM = 0.3) {const rc = new THREE.Raycaster();@@ -93,7 +124,11 @@ export function nearGeometry(scene, camera, THREE, limitM = 0.3) {box.copy(o.geometry.boundingBox).applyMatrix4(o.matrixWorld);const s = box.getSize(new THREE.Vector3());if (Math.max(s.x, s.y, s.z) > 60 || Math.min(s.x, s.y, s.z) < 0.05) continue; // ground/sky/flat decals- if (box.containsPoint(eye)) inside.push(o.name || o.parent?.name || o.type);+ // The bbox is the cheap pre-filter; the verdict is the mesh's own volume. A windmill's+ // 22 m lattice sails own a 22 x 22 m bbox that is nearly all air: measured 2026-09-07+ // (loop 9), a detail camera 4.9 m from the nearest surface was "inside ['Sails_1']" for+ // three rounds, the repair moved it twice for nothing and the judge marked it critical.+ if (box.containsPoint(eye) && eyeInsideMesh(o, eye, THREE)) inside.push(o.name || o.parent?.name || o.type);}const center = new THREE.Vector3();camera.getWorldDirection(center);diff --git a/harness/runtime_js/lib/host_placement.mjs b/harness/runtime_js/lib/host_placement.mjsindex 9afad7d9..b78a4dcd 100644--- a/harness/runtime_js/lib/host_placement.mjs+++ b/harness/runtime_js/lib/host_placement.mjs@@ -240,6 +240,13 @@ function collectAssets(scene, indices, volumetrics, contentBox) {// and SkyPine were built and named correctly, added to `IslandAssembly`, and three// zones were reported as "missing planned contents".const inner = [];+ // Per named FAMILY below this row, the world AABB of each member (a member = one named+ // descendant, its meshes pooled). A zone wraps a scatter in one group ('PicketFences' =+ // twelve 'PicketFence' builder outputs along a path, 'GorseBushClusters' = eight bushes+ // over 12 m), and the plan sized the INSTANCE: measured 2026-09-07 (loop 9 lighthouse),+ // the scale check read the wrapper's 14.7 m against the plan's 2.4 m fence, the judge+ // repeated "6.1x too large", and the repair shrank the whole run to microscopic dots.+ const members = new Map(); // family -> Map(member object -> [min, max])child.traverse((o) => {if (!o.visible) return;// one slot per FAMILY (Planter_3 / Planter.003 → Planter): the by-name check matches on@@ -247,13 +254,30 @@ function collectAssets(scene, indices, volumetrics, contentBox) {const family = o.name ? o.name.replace(/[_.]\d+$/, '') : '';if (o !== child && family && inner.length < MAX_INNER_NAMES && !inner.includes(family)) inner.push(family);if (o.isInstancedMesh) instanced += 1;- else if (indices.has(o)) meshes.push(indices.get(o));+ else if (indices.has(o)) {+ const ci = indices.get(o);+ meshes.push(ci);+ for (let m = o; m && m !== child; m = m.parent) {+ if (!m.name) continue;+ const fam = m.name.replace(/[_.]\d+$/, '');+ if (!members.has(fam)) members.set(fam, new Map());+ const box = members.get(fam).get(m) || [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]];+ for (let k = 0; k < 3; k++) { box[0][k] = Math.min(box[0][k], ci.min[k]); box[1][k] = Math.max(box[1][k], ci.max[k]); }+ members.get(fam).set(m, box);+ }+ }else if (volumetrics.has(o)) volumetric += 1;});if (!meshes.length && !instanced && !volumetric) continue;total += 1;if (assets.length >= MAX_ASSETS) continue;- const a = { obj: child, name: child.name || `${child.type}_${total}`, zone: zone === child ? '' : (zone.name || zone.type), meshes, instanced, inner, exempt: '' };+ const families = {};+ for (const [fam, byMember] of members) {+ if (byMember.size < 2) continue;+ const sizes = [...byMember.values()].map(([lo, hi]) => Math.max(hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2])).sort((x, y) => x - y);+ families[fam] = { n: sizes.length, size_m: r3(sizes[Math.floor(sizes.length / 2)]) };+ }+ const a = { obj: child, name: child.name || `${child.type}_${total}`, zone: zone === child ? '' : (zone.name || zone.type), meshes, instanced, inner, families, exempt: '' };if (isFree(zone) || isFree(child)) a.exempt = 'free';// instanced first: an asset that is scatter PLUS a haze shell is exempt because its// instances cannot be sampled at this budget, which is the more informative reason@@ -409,8 +433,8 @@ export function placementTable(scene, THREE, opts = {}) {let timeCut = false;const rows = [];for (const a of assets) {- const row = { name: a.name, zone: a.zone, meshes: a.meshes.length, instanced: a.instanced, inner: a.inner || [], exempt: a.exempt,- bbox: a.min ? boxJson(a.min, a.max) : null };+ const row = { name: a.name, zone: a.zone, meshes: a.meshes.length, instanced: a.instanced, inner: a.inner || [], families: a.families || {},+ exempt: a.exempt, bbox: a.min ? boxJson(a.min, a.max) : null };if (a.exempt) { rows.push(row); continue; }if (Date.now() - t0 > TIME_BUDGET_MS) { row.exempt = 'time_budget'; timeCut = true; rows.push(row); continue; }const cols = footColumns(a);diff --git a/harness/tests/scene_gates/test_frame_metrics.py b/harness/tests/scene_gates/test_frame_metrics.pyindex bca9218e..44bc467a 100644--- a/harness/tests/scene_gates/test_frame_metrics.py+++ b/harness/tests/scene_gates/test_frame_metrics.py@@ -43,7 +43,7 @@ def test_dark_frame_is_error_on_authored_with_concrete_hint():f = rep.findings[0]assert f.data["kind"] == "dark_frame" and f.severity == Severity.ERROR and f.target == "Establishing"assert "0.07" in f.message and "41%" in f.message- assert "DirectionalLight" in f.fix_hint and "HemisphereLight" in f.fix_hint and "NOT black" in f.fix_hint+ assert "sunRig(" in f.fix_hint and "fill" in f.fix_hint and "NOT black" in f.fix_hint # the rig env.js builds, not a second sunassert f.data["view"] == "Establishing" and f.data["mean_lum"] == 0.07diff --git a/harness/tests/scene_gates/test_live_frames.py b/harness/tests/scene_gates/test_live_frames.pyindex 7a3db91c..906cfec2 100644--- a/harness/tests/scene_gates/test_live_frames.py+++ b/harness/tests/scene_gates/test_live_frames.py@@ -101,7 +101,7 @@ def test_dark_variant_raises_dark_frame_errors(starter_ws: Workspace):assert not gate.passeddark = [f for f in gate.findings if f.data.get("kind") == "dark_frame"]assert dark and all(f.severity == "error" for f in dark)- assert dark[0].target == "overview" and "HemisphereLight" in dark[0].fix_hint and "NOT black" in dark[0].fix_hint+ assert dark[0].target == "overview" and "sunRig(" in dark[0].fix_hint and "NOT black" in dark[0].fix_hintassert dark[0].data["mean_lum"] < 0.12 or dark[0].data["dark_frac"] > 0.35diff --git a/harness/tests/scene_gates/test_placement.py b/harness/tests/scene_gates/test_placement.pyindex 44c3b2d9..edc3453e 100644--- a/harness/tests/scene_gates/test_placement.py+++ b/harness/tests/scene_gates/test_placement.py@@ -208,6 +208,33 @@ def test_contract_checks_fire_on_atmosphere_contents_scale_and_bounds():assert scale.severity == Severity.ERROR and "5.0x" in scale.message+def test_a_wrapper_of_instances_is_scale_checked_as_one_instance():+ """Loop 9 lighthouse (2026-09-07): 'PathAndFence/PicketFences' measured 14.73 m against the+ plan's 2.4 m fence panel — a 6.1x ERROR the judge repeated and the repair obeyed by+ shrinking the whole run to dots. The row's `families` carry the instance."""+ bb = BBox(center=(0, 0, 0), extents=(40, 8, 40))+ plan = ScenePlan(+ title="t", summary="s", setting="headland", mood="blue hour", bounds=bb, environment="dusk",+ zones=[ZonePlan(name="Yard", description="d", bbox=BBox(center=(0, 0, 0), extents=(20, 8, 20)), contents=["PicketFence"])],+ assets=[AssetPlan(name="PicketFence", kind="threejs", description="d", approx_size_m=(2.4, 1.2, 0.1))],+ cameras=[CameraPlan(name="overview", position=(1, 1, 1), look_at=(0, 0, 0), fov=50, purpose="p")])+ run = _row("PicketFences", h=2.24)+ run["bbox"] = {"min": [0, 0, 0], "max": [7.3, 2.24, 14.73], "size": [7.3, 2.24, 14.73]}+ census = {"fog": {"type": "Fog", "near": 10, "far": 60}, "background": "#aabbcc", "placement": _table(run)}+ scale = [f for f in placement_gate_safe(census, plan=plan).findings if f.data.get("kind") == "scale"]+ assert len(scale) == 1 and scale[0].severity == Severity.ERROR and "6.1x" in scale[0].message++ run["families"] = {"PicketFence": {"n": 12, "size_m": 2.24}, "Picket": {"n": 72, "size_m": 1.2}}+ rep = placement_gate_safe(census, plan=plan)+ assert not [f for f in rep.findings if f.data.get("kind") == "scale"], [f.message for f in rep.findings]++ run["families"] = {"PicketFence": {"n": 12, "size_m": 9.6}} # the instances really are 4x+ scale = [f for f in placement_gate_safe(census, plan=plan).findings if f.data.get("kind") == "scale"]+ assert len(scale) == 1 and scale[0].data["instances"] == 12+ assert scale[0].message.startswith("each of the 12 picket_fence instances in Yard/PicketFences measures 9.60 m")+ assert scale[0].data["fix_hint"].startswith("scale each picket_fence") if "fix_hint" in scale[0].data else True++def test_contract_checks_stay_quiet_on_a_dressed_in_bounds_scene():census = {"fog": {"type": "Fog", "near": 10, "far": 60}, "background": "#aabbcc","placement": _table(_row("Lantern_3", h=0.6), _row("Bench", h=0.9),diff --git a/harness/tests/scene_runtime/test_camera_inside_volume.py b/harness/tests/scene_runtime/test_camera_inside_volume.pynew file mode 100644index 00000000..bd3b9bd5--- /dev/null+++ b/harness/tests/scene_runtime/test_camera_inside_volume.py@@ -0,0 +1,76 @@+"""A lens is "inside" a mesh's VOLUME, not its bounding box (2026-09-07).++Measured on loop 9's windmill (`l9_windmill_hero`, three rounds): the `MillDetail` camera+stood 4.9 m from the nearest surface (`nearest_hit_m` 4.941, `BrickBase_7`) and was still+`camera_in_geometry` because the 22 m lattice sails' world bbox contained the eye — a 22 x+22 m box that is nearly all air. The repair moved the camera twice for nothing and the judge+marked "camera inside Sails_1" critical both rounds. `eyeInsideMesh` decides by ray parity+over the mesh's own triangles; the bbox is only the pre-filter.+"""+from __future__ import annotations++import pytest++from codeverse.config import get_settings+from tests.scene_runtime.conftest import needs_node, run_node_json++pytestmark = [pytest.mark.node, needs_node]++RUNTIME_JS = get_settings().runtime_js_dir()++JS = """+import * as THREE from 'three';+import { nearGeometry } from './lib/host_metrics.mjs';+const solid = new THREE.MeshStandardMaterial(); // FrontSide: a room seen from inside is all back faces+const scene = new THREE.Scene();+const ground = new THREE.Mesh(new THREE.PlaneGeometry(80, 80, 2, 2), solid);+ground.name = 'Ground'; ground.rotation.x = -Math.PI / 2; scene.add(ground);+BODY+scene.updateMatrixWorld(true);+const cam = new THREE.PerspectiveCamera(50, 16 / 9, 0.1, 500);+cam.position.set(EYE);+cam.lookAt(0, 8, 0);+cam.updateMatrixWorld(true);+console.log(JSON.stringify(nearGeometry(scene, cam, THREE)));+"""++# four 11 m lattice arms on a hub 12 m up, the sail plane turned 45 deg so the world bbox is a+# 16 x 16 m square around the hub; the eye sits 6 m off the hub inside that square, in the air+SAILS = """+const sails = new THREE.Group(); sails.name = 'Sails_1';+const arm = new THREE.BoxGeometry(22, 0.4, 0.4);+sails.add(new THREE.Mesh(arm, solid));+const armV = new THREE.Mesh(new THREE.BoxGeometry(0.4, 22, 0.4), solid); sails.add(armV);+const merged = new THREE.Group(); merged.name = 'SailsWrap';+for (const m of sails.children) { m.name = 'Sails_1'; }+sails.position.set(0, 12, 0); sails.rotation.y = Math.PI / 4; scene.add(sails);+"""++ROOM = """+const room = new THREE.Mesh(new THREE.BoxGeometry(6, 3, 6), solid);+room.name = 'CottageShell'; room.position.set(0, 1.5, 0); scene.add(room);+"""+++def _run(body: str, eye: str) -> dict:+ return run_node_json(JS.replace("BODY", body).replace("EYE", eye).replace("'./lib/", f"'{RUNTIME_JS}/lib/"))+++def test_a_lens_near_lattice_sails_is_not_inside_them():+ got = _run(SAILS, "4.5, 12, 4.5") # inside the 45-degree sails' world bbox, 6.4 m from the hub, in the air+ assert got["inside_mesh_bbox"] == [], got+ assert got["camera_in_geometry"] is False, got+++def test_a_lens_in_a_back_face_culled_room_is_still_inside():+ """The case the bbox rule was written for keeps its verdict: a FrontSide box around the+ eye is all back faces to a Raycaster, and parity still counts it."""+ got = _run(ROOM, "0.5, 1.6, 0.5")+ assert got["inside_mesh_bbox"] == ["CottageShell"], got+ assert got["camera_in_geometry"] is True, got+++def test_a_lens_inside_a_solid_arm_is_inside():+ got = _run(SAILS, "0, 12, 0") # the hub itself, inside both arms+ assert "Sails_1" in got["inside_mesh_bbox"], got+ assert got["camera_in_geometry"] is True, gotdiff --git a/harness/tests/scene_runtime/test_placement_inner_families.py b/harness/tests/scene_runtime/test_placement_inner_families.pyindex b1d84536..833738e5 100644--- a/harness/tests/scene_runtime/test_placement_inner_families.py+++ b/harness/tests/scene_runtime/test_placement_inner_families.py@@ -43,3 +43,35 @@ console.log(JSON.stringify({{ cap: MAX_INNER_NAMES, inner: row.inner, hasHero: rassert got["hasHero"], gotassert "Planter" in got["inner"] and "Planter_0" not in got["inner"], gotassert len(got["inner"]) <= got["cap"]+++def test_a_wrapper_of_scattered_instances_reports_the_instance_size():+ """`families`: twelve 2.2 m fence panels along a 15 m path are one row ('PicketFences');+ the row's bbox is the run, `families.PicketFence` is the panel (loop 9 lighthouse,+ 2026-09-07: the scale check read 14.7 m against the plan's 2.4 m panel)."""+ body = f"""+import * as THREE from 'three';+import {{ sceneCensus }} from '{RUNTIME_JS}/lib/host_census.mjs';+const solid = new THREE.MeshStandardMaterial();+const panel = (i) => {{+ const g = new THREE.Group(); g.name = 'PicketFence';+ for (let p = 0; p < 6; p++) {{ const m = new THREE.Mesh(new THREE.BoxGeometry(0.08, 1.2, 0.03), solid); m.name = 'Picket_' + p; m.position.set(-1.0 + p * 0.4, 0.6, 0); g.add(m); }}+ const rail = new THREE.Mesh(new THREE.BoxGeometry(2.2, 0.06, 0.03), solid); rail.name = 'Rail'; rail.position.set(0, 0.9, 0); g.add(rail);+ g.position.set(0, 0, i * 1.25); return g;+}};+const scene = new THREE.Scene();+const env = new THREE.Group(); env.name = 'Environment'; scene.add(env);+const ground = new THREE.Mesh(new THREE.PlaneGeometry(60, 60, 8, 8), solid); ground.name = 'Ground'; ground.rotation.x = -Math.PI / 2; env.add(ground);+const zone = new THREE.Group(); zone.name = 'PathAndFence'; scene.add(zone);+const run = new THREE.Group(); run.name = 'PicketFences';+for (let i = 0; i < 12; i++) run.add(panel(i));+zone.add(run);+scene.updateMatrixWorld(true);+const row = sceneCensus(scene, THREE, {{ placement: true }}).placement.assets.find((a) => a.name === 'PicketFences');+console.log(JSON.stringify({{ size: row.bbox.size, families: row.families }}));+"""+ got = run_node_json(body)+ assert got["size"][2] > 13, got # the run+ fam = got["families"]["PicketFence"]+ assert fam["n"] == 12 and 2.1 < fam["size_m"] < 2.3, got # the panel+ assert got["families"]["Picket"]["n"] == 72 and got["families"]["Picket"]["size_m"] < 1.3, got