Skip to content

Official Codebase of 3DCodeVerse

Python

scene host: auto-exposure lifts a dark frame to the gate's dark line (0.12), not 0.10

gaoypengf1d1524ec513
diff --git a/harness/runtime_js/lib/scene_host.mjs b/harness/runtime_js/lib/scene_host.mjs
index 1c12638c..e799803a 100644
--- a/harness/runtime_js/lib/scene_host.mjs
+++ b/harness/runtime_js/lib/scene_host.mjs
@@ -88,6 +88,11 @@ function makeHostRenderer(width, height, opts) {
return { renderer: makeRenderer(canvas, width, height, { logDepth: !!opts.logDepth }), canvas };
}
+/** Auto-exposure's target mean-luminance band. Its floor is the scene_frames gate's dark line
+ * (`frame_metrics.DARK_MEAN_LUM`, pinned by a test): at 0.10 a frame lifted to 0.10-0.119
+ * still drew "frame too dark". */
+const EXPOSURE_BAND = [0.12, 0.45];
+
/** The authored cameras, and each problem as {severity, text}: the severity is decided HERE,
* where the problem is known (the python gate used to re-derive it from the wording).
* The plan's own cameras pass the same fov / position / name rules (contracts/plan.CameraPlan). */
@@ -347,8 +352,9 @@ async function boot(opts) {
const before = lum();
let factor = 1;
let after = before;
- for (let i = 0; i < 4 && (after < 0.10 || after > 0.45); i++) {
- const step = after < 0.10 ? 1.6 : 0.7;
+ const [lo, hi] = EXPOSURE_BAND;
+ for (let i = 0; i < 4 && (after < lo || after > hi); i++) {
+ const step = after < lo ? 1.6 : 0.7;
const next = Math.min(3.0, Math.max(0.5, factor * step));
if (next === factor) break;
factor = next;
diff --git a/harness/tests/scene_gates/test_frame_metrics.py b/harness/tests/scene_gates/test_frame_metrics.py
index 981c12ff..a29086b0 100644
--- a/harness/tests/scene_gates/test_frame_metrics.py
+++ b/harness/tests/scene_gates/test_frame_metrics.py
@@ -173,3 +173,16 @@ def test_a_hero_in_the_scene_but_in_no_authored_frame_is_an_error():
fine = frame_findings({"census": census, "camera_checks": [_chk("AthanorDetail", glb_frac={url: 0.2})]})
old = frame_findings({"census": census, "camera_checks": [_chk("AthanorDetail")]})
assert fine.passed and old.passed and not [k for k, _, _ in _kinds(fine) + _kinds(old) if k.startswith("hero_")]
+
+
+def test_auto_exposure_lifts_a_frame_past_the_gates_dark_line():
+ """Regression (audit 2026-09-24 N13): the host's auto-exposure stopped at mean 0.10 while the
+ gate calls < 0.12 "frame too dark", so a lifted frame still drew the ERROR. Pinned by value."""
+ import re
+
+ from codeverse3d.spatial.frame_metrics import DARK_MEAN_LUM
+ from codeverse3d.spatial.node import runtime_js_dir
+
+ host = (runtime_js_dir() / "lib" / "scene_host.mjs").read_text()
+ lo = float(re.search(r"const EXPOSURE_BAND = \[([\d.]+),", host).group(1))
+ assert lo == DARK_MEAN_LUM