fix: enforce complete building and offline viewer gates

This commit is contained in:
2026-07-10 14:04:10 +08:00
parent cab4d320c0
commit a761175c09
13 changed files with 401 additions and 25 deletions

View File

@@ -12,6 +12,7 @@ ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "scripts"))
import build_blender_showcase # noqa: E402
import audit_showcase_extraction # noqa: E402
import cad_showcase # noqa: E402
import showcase_schema # noqa: E402
import spec_to_glb # noqa: E402
@@ -54,6 +55,23 @@ def test_config_rejects_unknown_keys() -> None:
showcase_schema.validate_config({"config_version": 1, "unexpected_typo": True})
def test_vertical_storey_continuity_rejects_representative_floor_islands() -> None:
spec = minimal_spec()
spec["floors"]["F2"] = {**spec["floors"]["F1"], "name": "二层", "z": 5.0}
spec["floors"]["F16"] = {**spec["floors"]["F1"], "name": "十六层", "z": 59.6}
gate = audit_showcase_extraction.vertical_storey_continuity_gate(spec)
assert gate["status"] == "FAIL"
assert "F2->F16" in gate["detail"]
def test_vertical_storey_continuity_accepts_instantiated_typical_floors() -> None:
spec = minimal_spec()
base = spec["floors"]["F1"]
spec["floors"] = {f"F{number}": {**base, "name": f"{number}层", "z": (number - 1) * 3.9} for number in range(1, 17)}
gate = audit_showcase_extraction.vertical_storey_continuity_gate(spec)
assert gate["status"] == "PASS"
def test_config_requires_at_least_one_drawing() -> None:
with pytest.raises(showcase_schema.ValidationFailure, match="contains no drawings"):
showcase_schema.validate_config({"config_version": 1})
@@ -279,6 +297,24 @@ def test_orchestrator_runs_resumable_trimesh_pipeline(tmp_path: Path) -> None:
config_path = tmp_path / "config.json"
config_path.write_text(json.dumps(config), encoding="utf-8")
out = tmp_path / "out"
scope_manifest = tmp_path / "scope_manifest.json"
scope_manifest.write_text(
json.dumps(
{
"scope_version": 1,
"mode": "single",
"requested": ["orchestrator-test"],
"buildings": [
{
"id": "orchestrator-test",
"status": "PASS",
"artifacts": [str(out / "building_spec.json")],
}
],
}
),
encoding="utf-8",
)
command = [
sys.executable,
str(ROOT / "scripts" / "cad_showcase.py"),
@@ -289,6 +325,8 @@ def test_orchestrator_runs_resumable_trimesh_pipeline(tmp_path: Path) -> None:
str(config_path),
"--source-report",
str(source_report),
"--scope-manifest",
str(scope_manifest),
"--out-dir",
str(out),
"--name",