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

@@ -201,7 +201,7 @@ def inspect_offline(path: Path, checks: list[dict[str, Any]]) -> None:
add_check(checks, "offline:payload", "FAIL", f"Embedded payload decode failed: {exc}")
def inspect_browser_report(path: Path, checks: list[dict[str, Any]]) -> None:
def inspect_browser_report(path: Path, checks: list[dict[str, Any]], name: str = "browser:smoke") -> None:
try:
report = json.loads(path.read_text(encoding="utf-8"))
passed = (
@@ -211,9 +211,9 @@ def inspect_browser_report(path: Path, checks: list[dict[str, Any]]) -> None:
and not report.get("failed_requests")
)
detail = report.get("detail") or json.dumps(report, ensure_ascii=False)[:500]
add_check(checks, "browser:smoke", "PASS" if passed else "FAIL", detail)
add_check(checks, name, "PASS" if passed else "FAIL", detail)
except Exception as exc:
add_check(checks, "browser:smoke", "FAIL", f"Browser report invalid: {exc}")
add_check(checks, name, "FAIL", f"Browser report invalid: {exc}")
def inspect_audit(path: Path, checks: list[dict[str, Any]]) -> None:
@@ -350,6 +350,7 @@ def main() -> int:
parser.add_argument("--variants-manifest")
parser.add_argument("--web-dir")
parser.add_argument("--offline-viewer")
parser.add_argument("--offline-browser-report")
parser.add_argument("--render", nargs="*", default=[])
parser.add_argument("--audit")
parser.add_argument("--scope-manifest")
@@ -443,6 +444,15 @@ def main() -> int:
inspect_scope(Path(args.scope_manifest), checks)
if args.offline_viewer:
inspect_offline(Path(args.offline_viewer), checks)
if args.offline_browser_report:
inspect_browser_report(Path(args.offline_browser_report), checks, "offline:browser-smoke")
else:
add_check(
checks,
"offline:browser-smoke",
"SKIP",
"Offline viewer has no real file:// browser smoke report",
)
if args.browser_report:
inspect_browser_report(Path(args.browser_report), checks)
elif args.web_dir or args.require_browser_report:
@@ -460,6 +470,7 @@ def main() -> int:
"evidence_version": 1,
"generated_at": datetime.now(timezone.utc).isoformat(),
"status": status,
"waivers": [{"check": name, "reason": reason} for name, reason in sorted(waivers.items())],
"checks": checks,
"artifacts": artifacts,
}