tools(verify): fast/medium/full verification tiers with a compiled-in source stamp (L39); research R6

BuildLinux.sh hashes a sorted manifest of compiled inputs into VOXELFORGE_SOURCE_STAMP, printed first by
every executable; Standalone/Tools/verify/verify.py checks it before and after each tier and records
binary/input hashes and the resolved recipe, style map and layout. Fast (163 s) runs on the canonical owner
world only and asserts FI Style 2 / SW Style 1; medium (8 min) and full (26 min) add the style matrix,
GCC, determinism and cost. Controls: stale source, mislabelled style-0 owner, all-black capture, L30/L31,
L35/L36 and the L38 step are all rejected. No geometry change; owner hashes identical to L37.
Research R6: leak table, generator contract and a 10-step metre-native migration plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
This commit is contained in:
Fr0zkaandClaude Opus 5.5 committed 2026-10-23 15:27:52 +02:00
1 parent 88c54eab44
commit 753cc9c259
22 files changed
+1831 -163

No files matched your search

@@ -7,26 +7,29 @@ import math
import os
import re
import subprocess
import sys
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = Path(os.environ.get("VOXELFORGE_L37_OUT", ROOT / "Saved/Linux/l37"))
OUT = Path(os.environ.get("VOXELFORGE_L37_OUT",
os.environ.get("VOXELFORGE_VERIFY_OUT", ROOT / "Saved/Linux/l37")))
BIN = OUT / "bin"
CAPTURES = Path(os.environ.get("VOXELFORGE_L37_CAPTURE_DIR",
Path(__file__).resolve().parent / "captures"))
OUT / "captures"))
HEADLESS = Path(os.environ.get("VOXELFORGE_L37_HEADLESS",
BIN / "VoxelForgeCoreHeadless-l37-final-clang"))
RENDERER = Path(os.environ.get("VOXELFORGE_L37_RENDERER",
BIN / "VoxelForgeOffscreenCapture-l37-final-clang"))
PNG_DIR = OUT / "capture-png"
RECIPE_INPUTS = (
("owner-fi", ROOT / "Saved/Linux/linux25-owner-floating-islands-style0.json",
("owner-fi", ROOT / "Standalone/data/owner_world.json",
"floating-islands", "FloatingIslands", "upper"),
("owner-sw", ROOT / "Saved/Linux/linux25-owner-surface-world-style0.json",
("owner-sw", ROOT / "Standalone/data/owner_world.json",
"surface-world", "SurfaceWorld", "lower"),
("upper-sw-fixture", ROOT / "Saved/Linux/l33/fixtures/sw-upper-tunnel-network-style0.json",
("style-override-upper-sw-fixture-style0",
OUT / "fixtures/style-override-upper-sw-fixture-style0.json",
"floating-islands", "SurfaceWorld", "upper"),
)
SUBVOXELS_PER_VOXEL = 256.0
@@ -34,6 +37,8 @@ RING_AUDIT = ROOT / "Standalone/Research/WorldAssemblerM3/Linux32/AuditRingTerra
spec = importlib.util.spec_from_file_location("ring_profile_l32", RING_AUDIT)
ring_profile = importlib.util.module_from_spec(spec)
spec.loader.exec_module(ring_profile)
sys.path.insert(0, str(ROOT / "Standalone/Tools/verify"))
from runner import current_stamp, first_stamp, bounded_run
for directory in (OUT, BIN, PNG_DIR, CAPTURES):
directory.mkdir(parents=True, exist_ok=True)
@@ -51,12 +56,23 @@ def run(name, command):
wrapped = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
"timeout", "1800s", *map(str, command)]
started = time.monotonic()
binary = Path(command[0]) if command else None
is_stamped_executable = binary in (HEADLESS, RENDERER)
expected = current_stamp() if is_stamped_executable else None
if is_stamped_executable:
probe = bounded_run([str(binary), "--print-source-stamp"], timeout=15)
if probe is None or probe.returncode != 0 or first_stamp(probe.stdout or "") != expected:
raise SystemExit(f"{name} refused an unstamped or stale executable: {binary}")
with log.open("w", encoding="utf-8") as stream:
result = subprocess.run(wrapped, cwd=ROOT, env=ENV, stdout=stream,
stderr=subprocess.STDOUT, timeout=1800, check=False)
elapsed = time.monotonic() - started
print(f"[L37CaptureRun] step={name} elapsed={elapsed:.1f}s exit={result.returncode} log={log}",
flush=True)
if is_stamped_executable:
output = log.read_text(encoding="utf-8", errors="replace")
if first_stamp(output) != expected or current_stamp() != expected:
raise SystemExit(f"{name} source stamp mismatch; see {log}")
if result.returncode != 0:
raise SystemExit(f"{name} failed; see {log}")
return log
@@ -163,7 +179,32 @@ def load_layout(name, source, recipe):
"--stream-benchmark", "--stream-pipeline", "--force-generate", "--clip-radius=2",
"--max-clip-level=0", "--max-level=0", f"--recipe={recipe}",
f"--resolved-layout-output={path}", "--resolved-layout-only"])
return json.loads(path.read_text(encoding="utf-8"))
layout = json.loads(path.read_text(encoding="utf-8"))
passage_styles = sorted({int(passage["style"]) for passage in layout.get("passages", [])})
resolved_styles = {str(index): int(style) for index, style in
layout.get("resolved_strate_passage_styles", {}).items()}
if name.startswith("owner-"):
expected_styles = {"0": 2, "1": 1}
if resolved_styles != expected_styles or passage_styles != [2]:
raise SystemExit(f"{name} resolved styles={resolved_styles} passage_styles={passage_styles}; "
f"expected strata={expected_styles} passage_styles=[2]")
expected_style = 2 if name == "owner-fi" else 1
print(f"[L37CaptureResolvedOwner] scene={name} recipe={recipe} "
f"generator_style={expected_style} strata_styles={resolved_styles} "
f"passage_style={passage_styles} layout_id={layout.get('stable_identity')} input={source}",
flush=True)
return layout
expected_style = 0
matching_styles = sorted({resolved_styles[str(stratum["strate_index"])]
for stratum in layout.get("strates", [])
if stratum.get("generator_kind") == "SurfaceWorld"
and str(stratum["strate_index"]) in resolved_styles})
if expected_style not in passage_styles or matching_styles != [expected_style]:
raise SystemExit(f"{name} resolved style={matching_styles} passage styles={passage_styles}; "
f"expected [{expected_style}]")
print(f"[L37CaptureResolvedOwner] scene={name} recipe={recipe} style={matching_styles} "
f"layout_id={layout.get('stable_identity')} input={source}", flush=True)
return layout
def select_passage(layout, mouth_generator, preferred_side):
@@ -327,7 +368,8 @@ for scene_name, source, recipe, mouth_generator, preferred_side in RECIPE_INPUTS
jpg = CAPTURES / f"{stem}.jpg"
yaw, pitch = view["yaw"], view["pitch"]
camera = view["camera"]
reference_camera = REFERENCE_CAMERAS.get(stem)
reference_camera = (REFERENCE_CAMERAS.get(stem)
if scene_name.startswith("style-override-") else None)
if reference_camera is not None:
camera, target, reference_clip = reference_camera
view["camera"], view["target"], view["clip"] = camera, target, reference_clip
@@ -397,6 +439,8 @@ for scene_name, source, recipe, mouth_generator, preferred_side in RECIPE_INPUTS
run(f"{stem}-render", render)
run(f"{stem}-jpeg", ["ffmpeg", "-nostdin", "-hide_banner", "-loglevel", "error",
"-y", "-i", png, "-frames:v", "1", "-q:v", "4", jpg])
run(f"{stem}-quality", [sys.executable,
ROOT / "Standalone/Tools/verify/capture_quality.py", jpg])
size = jpg.stat().st_size if jpg.exists() else 0
print(f"[L37CaptureJPEG] file={jpg.relative_to(ROOT)} bytes={size} "
f"status={'PASS' if 0 < size <= 300_000 else 'FAIL'}", flush=True)