Official Codebase of 3DCodeVerse
Python
scene: an untouched env skeleton is a lint ERROR
gaoypeng8325e6cb3a21
diff --git a/harness/codeverse/languages/scene_threejs/__init__.py b/harness/codeverse/languages/scene_threejs/__init__.pyindex 019ef452..ec91ecab 100644--- a/harness/codeverse/languages/scene_threejs/__init__.py+++ b/harness/codeverse/languages/scene_threejs/__init__.py@@ -78,6 +78,16 @@ def _check_imports(rel: str, text: str, ws: Workspace, path: Path) -> list[GateFreturn check_imports(text, path, ws.src, make_finding=make_finding)[0]+#: the env skeleton's own TODO line and its placeholder daylight palette. An env.js that+#: still carries them is a skeleton the env stage never rewrote — measured 2026-08-30 on the+#: SOTA battery: izakaya_night (both arms) and nyc_dusk shipped the untouched skeleton, so a+#: "cozy izakaya at NIGHT" rendered under 0xcfdcec sky over 0x4a5a2a ground and the run lost+#: on brief fidelity while every other gate passed. The plan was right and sat in the file's+#: own ENV PLAN header; nobody acted on it.+_ENV_SKELETON_TODO = "Rewrite the ground/sky/fog/sun below to match the plan"+_ENV_SKELETON_DEFAULTS = ("0xbcd7ff", "0xcfdcec")++def lint(ws: Workspace) -> GateReport:"""Run all static checks; passed iff no ERROR findings."""t0 = time.time()@@ -110,6 +120,16 @@ def lint(ws: Workspace) -> GateReport:if path.parent == ws.src / "zones" and not _BUILD_RE.search(text):findings.append(_f(Severity.ERROR, "zone module does not export build(ctx)", target=rel,hint="export function build(ctx) { const g = new THREE.Group(); g.name = 'ZoneName'; ...; return g; }"))+ if path == ws.src / "env.js":+ stale = [d for d in _ENV_SKELETON_DEFAULTS if d in text]+ if _ENV_SKELETON_TODO in text and stale:+ findings.append(_f(Severity.ERROR,+ f"src/env.js is still the untouched skeleton (its TODO line and the "+ f"placeholder daylight palette {', '.join(stale)} are both present)",+ target=rel,+ hint="the ENV PLAN header at the top of env.js states the sky, sun, fog and "+ "ground this scene needs — write those colours and angles into buildEnv, "+ "then delete the TODO line"))if path.parent == ws.src / "assets" and not _BUILD_ANY_RE.search(text):findings.append(_f(Severity.WARN, "asset module exports no build<Pascal>(THREE) factory", target=rel,hint="export function buildLamp(THREE) { ... return group; }"))diff --git a/harness/tests/scene_runtime/test_lint.py b/harness/tests/scene_runtime/test_lint.pyindex 2f40b852..dde89cda 100644--- a/harness/tests/scene_runtime/test_lint.py+++ b/harness/tests/scene_runtime/test_lint.py@@ -81,3 +81,34 @@ def test_large_file_warning(ws):(ws.src / "scene.js").write_text("export function createScene() { return {}; }\n" + "// pad\n" * 900)rep = lint(ws)assert any("large file" in m for _, m in _msgs(rep, Severity.WARN))+++def test_an_untouched_env_skeleton_is_an_error(ws):+ """The env stage shipping the skeleton back is invisible to every other gate: the file+ parses, exports what it must, and renders — as a sunny day, whatever the brief asked for."""+ (ws.src / "scene.js").write_text(+ "import * as THREE from 'three';\n"+ "export function createScene({ THREE, renderer, loaders }) { return { scene: new THREE.Scene(), cameras: [], update() {} }; }\n")+ skeleton = (+ "// ENV PLAN: night, moonlit, sky zenith 0x070b18\n"+ "// Rewrite the ground/sky/fog/sun below to match the plan; keep buildEnv/heightAt exports.\n"+ "import * as THREE from 'three';\n"+ "export const SUN_AZIMUTH_DEG = 60;\n"+ "export function heightAt(x, z) { return 0; }\n"+ "export function buildEnv(ctx) {\n"+ " ctx.scene.background = new THREE.Color(0xcfdcec);\n"+ " ctx.scene.add(new THREE.HemisphereLight(0xbcd7ff, 0x4a5a2a, 0.9));\n"+ " return { update(t, dt) {} };\n"+ "}\n")+ (ws.src / "env.js").write_text(skeleton)+ rep = lint(ws)+ assert not rep.passed+ assert any("untouched skeleton" in m for _, m in _msgs(rep, Severity.ERROR))++ # the same file with the plan's own colours written in is clean again+ (ws.src / "env.js").write_text(+ skeleton.replace("// Rewrite the ground/sky/fog/sun below to match the plan; keep buildEnv/heightAt exports.\n", "")+ .replace("0xcfdcec", "0x141a2e").replace("0xbcd7ff", "0x1c2b4a"))+ rep = lint(ws)+ assert not any("untouched skeleton" in m for _, m in _msgs(rep, Severity.ERROR)), _msgs(rep)+diff --git a/harness/tests/scene_runtime/test_skeleton.py b/harness/tests/scene_runtime/test_skeleton.pyindex 38f4b4ca..fb81e8e7 100644--- a/harness/tests/scene_runtime/test_skeleton.py+++ b/harness/tests/scene_runtime/test_skeleton.py@@ -61,4 +61,7 @@ def test_plan_skeleton_writes_zone_and_asset_stubs_and_lints(ws):assert "GROUND_SIZE = 200" in env # 80 m span * 2.5assert (ws.public / "assets").is_dir()rep = lint(ws)- assert rep.passed, [(f.target, f.message) for f in rep.errors]+ # a fresh skeleton IS an unwritten env.js, and lint says so on purpose (that check is+ # what catches an env stage that never ran); everything else must already be legal.+ other = [(f.target, f.message) for f in rep.errors if "untouched skeleton" not in f.message]+ assert not other, other