Files
VoxelForge/Standalone/Research/WorldAssemblerM3/Linux93/RunL93CarveReach.py
T
Fr0zkaandClaude Opus 5.5 1e111cc042 diag: bounded passage carve reach rejected (L93); R43 Unreal SW startup notes
Explicit carve reach R (diagnostic, default unbounded): R=2.5 m -> 1.56 cm max displacement,
106 deg max normal change; R=4 m -> 0.63 cm but 53 deg normals. Fails the bar; readiness gain
small and inconsistent (TN -5%, VS +6-7%). No world change (v214). Fast tier PASS.
R43: Unreal SW bReady 2.16 s = serial sign-edge repair (1.94 s, 10.9M corrections;
parallelSignEdgeRepair exists but off); ~0.45 s of SerializeResolvedWorld = adapter SW route search.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 07:33:53 +01:00

136 lines
6.3 KiB
Python

#!/usr/bin/env python3
"""Compare bounded passage-carve reaches over each owner's complete near view."""
from __future__ import annotations
import json
import argparse
import re
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l93/effects"
DATA = ROOT / "Standalone/data/owner_world.json"
BINARY = ROOT / "Saved/Linux/l93/bin/VoxelForgeCoreHeadless-clang19"
STRATA = {
"S0": {"camera": (8.0, 16.0, -372.2626953125), "near": 1408},
"FI": {"camera": (25.8369140625, 3.19921875, -737.0), "near": 1216},
"TN": {"camera": (19.166015625, -14.2001953125, -753.3740234375), "near": 1344},
"S3": {"camera": (-20.0625, -5.068359375, -900.353515625), "near": 1344},
}
REACHES = (1.5, 2.0, 2.5, 4.0)
STAMP = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=(\S+)$", re.M)
COVERAGE = re.compile(r"^\[L93PassageReachCoverage\] (.*)$", re.M)
SUMMARY = re.compile(r"^\[L93PassageReachSummary\] (.*)$", re.M)
AUDIT = re.compile(r"^\[L93PassageReachAudit\] (.*)$", re.M)
FIELDS = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
def parse_fields(line: str) -> dict[str, str]:
return dict(FIELDS.findall(line))
def run(stratum: str) -> dict:
OUT.mkdir(parents=True, exist_ok=True)
spec = STRATA[stratum]
camera = ",".join(f"{value:.12f}" for value in spec["camera"]) + ",0,0"
log = OUT / f"{stratum.lower()}-reach-effects.log"
command = [
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--", "env",
"VOXELFORGE_L81_PASSAGE_BOUND_PADDING_VOXELS=0", "timeout", "1740s",
str(BINARY), str(DATA), "--world-assembler-prototype", "--stream-benchmark",
"--stream-pipeline", "--workers=8", "--clip-radius=3", "--max-clip-level=8",
"--max-level=2", f"--camera={camera}", "--audit-passage-carve-reach",
]
started = time.monotonic()
try:
with log.open("w", encoding="utf-8") as stream:
proc = subprocess.run(command, cwd=ROOT, stdout=stream,
stderr=subprocess.STDOUT, check=False, timeout=1750)
except subprocess.TimeoutExpired as exc:
raise RuntimeError(f"reach effect audit exceeded 1,750 seconds: {log}") from exc
output = log.read_text(encoding="utf-8", errors="replace")
coverage = COVERAGE.search(output)
summaries = [parse_fields(match.group(1)) for match in SUMMARY.finditer(output)]
audit = AUDIT.search(output)
stamp = STAMP.search(output)
expected = spec["near"]
coverage_fields = parse_fields(coverage.group(1)) if coverage else {}
coverage_ok = (int(coverage_fields.get("tiles", "0")) == expected
and int(coverage_fields.get("lod0", "0"))
+ int(coverage_fields.get("lod1", "0"))
+ int(coverage_fields.get("lod2", "0")) == expected)
rows = []
for summary in summaries:
reach = float(summary["reach_m"])
tile_counts = summary["tiles"].split("/")
passed = (len(tile_counts) == 2 and int(tile_counts[0]) == expected
and int(tile_counts[1]) == expected
and summary["status"] == "PASS")
rows.append({
"reach_m": reach,
"tiles": summary["tiles"],
"samples": int(summary["samples"]),
"changed_samples": int(summary["changed_samples"]),
"sign_flips": int(summary["sign_flips"]),
"edge_crossing_mismatches": int(summary["edge_crossing_mismatches"]),
"moved_crossings": int(summary["moved_crossings"]),
"max_displacement_cm": float(summary["max_displacement_cm"]),
"max_normal_degrees": float(summary["max_normal_degrees"]),
"normal_pairing_failures": int(summary["normal_pairing_failures"]),
"status": "PASS" if passed else "FAIL",
})
row = {
"stratum": stratum,
"exit_code": proc.returncode,
"wall_s": round(time.monotonic() - started, 3),
"expected_near_tiles": expected,
"coverage": coverage_fields or None,
"coverage_ok": coverage_ok,
"reaches": rows,
"audit": parse_fields(audit.group(1)) if audit else None,
"source_stamp": stamp.group(1) if stamp else None,
"log": str(log.relative_to(ROOT)),
}
(OUT / f"{stratum.lower()}-reach-effects.json").write_text(
json.dumps(row, indent=2) + "\n", encoding="utf-8")
print("[L93CarveReachRun] " + json.dumps(row, sort_keys=True), flush=True)
return row
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--stratum", choices=tuple(STRATA), required=True)
args = parser.parse_args()
if not BINARY.is_file() or not DATA.is_file():
raise SystemExit(f"missing input: {BINARY} or {DATA}")
rows = [run(args.stratum)]
summaries: dict[str, dict] = {}
for reach in REACHES:
samples = [row for run_row in rows for row in run_row["reaches"]
if row["reach_m"] == reach]
summaries[f"{reach:g}"] = {
"strata": len(samples),
"sign_flips": sum(row["sign_flips"] for row in samples),
"edge_crossing_mismatches": sum(row["edge_crossing_mismatches"] for row in samples),
"max_displacement_cm": max((row["max_displacement_cm"] for row in samples), default=0.0),
"max_normal_degrees": max((row["max_normal_degrees"] for row in samples), default=0.0),
"normal_pairing_failures": sum(row["normal_pairing_failures"] for row in samples),
"changed_samples": sum(row["changed_samples"] for row in samples),
"status": "PASS" if len(samples) == len(rows)
and all(row["status"] == "PASS" for row in samples) else "FAIL",
}
result = {"runs": rows, "reach_summary": summaries}
(OUT / f"summary-{args.stratum.lower()}.json").write_text(
json.dumps(result, indent=2) + "\n", encoding="utf-8")
print("[L93CarveReachSummary] " + json.dumps(result, sort_keys=True), flush=True)
return 0 if all(row["coverage_ok"] and row["source_stamp"]
and row["audit"] and row["audit"].get("status") == "PASS"
for row in rows) and all(item["status"] == "PASS"
for item in summaries.values()) else 14
if __name__ == "__main__":
raise SystemExit(main())