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

@@ -254,6 +254,24 @@ def run_browser_smoke(pipeline: Pipeline, web_dir: Path, report: Path, screensho
server.wait(timeout=5)
def run_offline_browser_smoke(pipeline: Pipeline, viewer: Path, report: Path, screenshot: Path) -> None:
"""Open the single-file viewer through file:// and prove that its model renders."""
pipeline.run(
"offline_browser_smoke",
[
"node",
str(SCRIPTS / "offline_viewer_smoke.mjs"),
"--viewer",
str(viewer),
"--out",
str(report),
"--screenshot",
str(screenshot),
],
[report, screenshot],
)
def doctor() -> int:
modules = ["ezdxf", "jsonschema", "numpy", "scipy", "shapely", "trimesh", "matplotlib", "PIL", "pygltflib"]
checks = []
@@ -457,7 +475,11 @@ def run_pipeline(args: argparse.Namespace) -> int:
standard = bundle / "variants" / "standard" / "standard.glb"
offline = out_dir / "viewer.html"
offline_browser_report = out_dir / "offline_browser_smoke_report.json"
if args.offline:
offline_source = standard.with_name("standard.raw.glb")
if not offline_source.exists():
offline_source = standard
pipeline.run(
"offline",
python_script(
@@ -465,7 +487,7 @@ def run_pipeline(args: argparse.Namespace) -> int:
"--spec",
str(spec),
"--glb",
str(standard),
str(offline_source),
"--out",
str(offline),
"--title",
@@ -473,6 +495,23 @@ def run_pipeline(args: argparse.Namespace) -> int:
),
[offline],
)
if not args.web:
pipeline.run(
"offline_node_dependencies",
["npm", "install", "--prefix", str(ROOT), "--ignore-scripts"],
[ROOT / "node_modules" / "playwright" / "package.json"],
)
pipeline.run(
"offline_browser_runtime",
[str(ROOT / "node_modules" / ".bin" / "playwright"), "install", "chromium"],
[],
)
run_offline_browser_smoke(
pipeline,
offline,
offline_browser_report,
out_dir / "offline_browser_smoke.png",
)
preview = out_dir / "verify_previews.png"
pipeline.run(
@@ -514,7 +553,14 @@ def run_pipeline(args: argparse.Namespace) -> int:
["--web-dir", str(web_dir), "--browser-report", str(browser_report), "--require-browser-report"]
)
if args.offline:
verify_cmd.extend(["--offline-viewer", str(offline)])
verify_cmd.extend(
[
"--offline-viewer",
str(offline),
"--offline-browser-report",
str(offline_browser_report),
]
)
if args.require_browser_report and not args.web:
verify_cmd.append("--require-browser-report")
if args.scope_manifest:
@@ -560,7 +606,11 @@ def parser() -> argparse.ArgumentParser:
run.add_argument("--offline", action="store_true")
run.add_argument("--browser-report")
run.add_argument("--require-browser-report", action="store_true")
run.add_argument("--scope-manifest", help="Single-building/campus scope ledger included in final verification")
run.add_argument(
"--scope-manifest",
required=True,
help="Required single-building/campus scope ledger included in final verification",
)
run.add_argument(
"--waiver",
action="append",