Spaces:
Sleeping
Sleeping
Sync from simready-oem-library-pm@f65d2a11
Browse files
tools/hf_space/runner.py
CHANGED
|
@@ -403,6 +403,7 @@ def _validate_zip_streaming(*, api: HfApi, dataset: str, token: str | None,
|
|
| 403 |
flat_target: Path | None = None,
|
| 404 |
prefetched_zip_entries: list | None = None,
|
| 405 |
prefetched_dataset_head: str | None = None,
|
|
|
|
| 406 |
) -> dict | None:
|
| 407 |
"""Validate a zip-bundled dataset by streaming one archive at a time.
|
| 408 |
|
|
@@ -545,6 +546,8 @@ def _validate_zip_streaming(*, api: HfApi, dataset: str, token: str | None,
|
|
| 545 |
"--use-plugin", "--no-use-kit", "--workers", daemon_workers,
|
| 546 |
"--profile", profile, "--version", version,
|
| 547 |
]
|
|
|
|
|
|
|
| 548 |
out(f" spawning {n_daemons} validator daemon(s) (spec load happens once each)…")
|
| 549 |
for di in range(n_daemons):
|
| 550 |
try:
|
|
@@ -1428,6 +1431,7 @@ def run(
|
|
| 1428 |
flat_target=None,
|
| 1429 |
prefetched_zip_entries=probe_zip_entries,
|
| 1430 |
prefetched_dataset_head=dataset_head,
|
|
|
|
| 1431 |
)
|
| 1432 |
out_dir = work / "out"
|
| 1433 |
out_dir.mkdir(parents=True, exist_ok=True)
|
|
@@ -1566,6 +1570,7 @@ def run(
|
|
| 1566 |
flat_target=flat_target,
|
| 1567 |
prefetched_zip_entries=probe_zip_entries,
|
| 1568 |
prefetched_dataset_head=dataset_head,
|
|
|
|
| 1569 |
)
|
| 1570 |
|
| 1571 |
out_dir = work / "out"
|
|
|
|
| 403 |
flat_target: Path | None = None,
|
| 404 |
prefetched_zip_entries: list | None = None,
|
| 405 |
prefetched_dataset_head: str | None = None,
|
| 406 |
+
continue_on_preliminary: bool = False,
|
| 407 |
) -> dict | None:
|
| 408 |
"""Validate a zip-bundled dataset by streaming one archive at a time.
|
| 409 |
|
|
|
|
| 546 |
"--use-plugin", "--no-use-kit", "--workers", daemon_workers,
|
| 547 |
"--profile", profile, "--version", version,
|
| 548 |
]
|
| 549 |
+
if continue_on_preliminary:
|
| 550 |
+
daemon_cmd.append("--continue-on-preliminary")
|
| 551 |
out(f" spawning {n_daemons} validator daemon(s) (spec load happens once each)…")
|
| 552 |
for di in range(n_daemons):
|
| 553 |
try:
|
|
|
|
| 1431 |
flat_target=None,
|
| 1432 |
prefetched_zip_entries=probe_zip_entries,
|
| 1433 |
prefetched_dataset_head=dataset_head,
|
| 1434 |
+
continue_on_preliminary=True,
|
| 1435 |
)
|
| 1436 |
out_dir = work / "out"
|
| 1437 |
out_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
| 1570 |
flat_target=flat_target,
|
| 1571 |
prefetched_zip_entries=probe_zip_entries,
|
| 1572 |
prefetched_dataset_head=dataset_head,
|
| 1573 |
+
continue_on_preliminary=preliminary,
|
| 1574 |
)
|
| 1575 |
|
| 1576 |
out_dir = work / "out"
|
tools/validation/plugins/simready-report/skills/simready-report/validate.py
CHANGED
|
@@ -1594,6 +1594,14 @@ def main() -> int:
|
|
| 1594 |
"real-time bar AND populate per-asset pass/fail in "
|
| 1595 |
"the Files expander as assets complete. Writes are "
|
| 1596 |
"atomic (tmp + rename).")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1597 |
ap.add_argument("--daemon", action="store_true",
|
| 1598 |
help="Long-running mode: load foundation specs ONCE at "
|
| 1599 |
"startup, then read JSON request lines from stdin "
|
|
@@ -1774,7 +1782,7 @@ def _run_validation_body(args, asset_profile_map: dict[str, str]) -> int:
|
|
| 1774 |
# the foundation source-of-truth is caught by the out-of-band
|
| 1775 |
# tools/spec_sync/ job.
|
| 1776 |
preliminary_issues = run_preliminary_checks(target)
|
| 1777 |
-
if preliminary_issues:
|
| 1778 |
out_dir.mkdir(parents=True, exist_ok=True)
|
| 1779 |
print(f"PRELIMINARY CHECK: {len(preliminary_issues)} issue(s) — "
|
| 1780 |
f"skipping USD validation until these are addressed", flush=True)
|
|
@@ -1809,6 +1817,10 @@ def _run_validation_body(args, asset_profile_map: dict[str, str]) -> int:
|
|
| 1809 |
json.dumps(results_json, indent=2), encoding="utf-8"
|
| 1810 |
)
|
| 1811 |
return 0
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1812 |
|
| 1813 |
assets, layout_findings = discover_assets(target, exclude=out_dir)
|
| 1814 |
print(f"Discovered {len(assets)} USD asset(s) under {target}", flush=True)
|
|
@@ -1988,6 +2000,35 @@ def _run_validation_body(args, asset_profile_map: dict[str, str]) -> int:
|
|
| 1988 |
if coverage["declared"] is not None and coverage["missing"]:
|
| 1989 |
print(f" profile coverage: {coverage['loaded']}/{coverage['declared']} features loaded "
|
| 1990 |
f"({len(coverage['missing'])} silently dropped — see PROBLEMS.md P1)", flush=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1991 |
(out_dir / "results.json").write_text(json.dumps({
|
| 1992 |
"generated": datetime.now(timezone.utc).isoformat(),
|
| 1993 |
"target": str(target),
|
|
@@ -1998,6 +2039,7 @@ def _run_validation_body(args, asset_profile_map: dict[str, str]) -> int:
|
|
| 1998 |
"profile_coverage": coverage,
|
| 1999 |
"thumbnail_provenance": thumbnail_provenance,
|
| 2000 |
"layout_findings": layout_findings,
|
|
|
|
| 2001 |
"results": results,
|
| 2002 |
}, indent=2), encoding="utf-8")
|
| 2003 |
|
|
|
|
| 1594 |
"real-time bar AND populate per-asset pass/fail in "
|
| 1595 |
"the Files expander as assets complete. Writes are "
|
| 1596 |
"atomic (tmp + rename).")
|
| 1597 |
+
ap.add_argument("--continue-on-preliminary", action="store_true",
|
| 1598 |
+
help="Don't short-circuit USD validation when "
|
| 1599 |
+
"preliminary structure checks (PKG.01/06, "
|
| 1600 |
+
"AA.002, etc.) find issues. Both phases run and "
|
| 1601 |
+
"their findings appear in results.json. Used by "
|
| 1602 |
+
"the dashboard's Preliminary scan tab — the "
|
| 1603 |
+
"sample asset gets a full ruleset sweep even "
|
| 1604 |
+
"when its packaging structure is non-conformant.")
|
| 1605 |
ap.add_argument("--daemon", action="store_true",
|
| 1606 |
help="Long-running mode: load foundation specs ONCE at "
|
| 1607 |
"startup, then read JSON request lines from stdin "
|
|
|
|
| 1782 |
# the foundation source-of-truth is caught by the out-of-band
|
| 1783 |
# tools/spec_sync/ job.
|
| 1784 |
preliminary_issues = run_preliminary_checks(target)
|
| 1785 |
+
if preliminary_issues and not args.continue_on_preliminary:
|
| 1786 |
out_dir.mkdir(parents=True, exist_ok=True)
|
| 1787 |
print(f"PRELIMINARY CHECK: {len(preliminary_issues)} issue(s) — "
|
| 1788 |
f"skipping USD validation until these are addressed", flush=True)
|
|
|
|
| 1817 |
json.dumps(results_json, indent=2), encoding="utf-8"
|
| 1818 |
)
|
| 1819 |
return 0
|
| 1820 |
+
if preliminary_issues and args.continue_on_preliminary:
|
| 1821 |
+
print(f"PRELIMINARY CHECK: {len(preliminary_issues)} issue(s) — "
|
| 1822 |
+
f"continuing with full USD validation per --continue-on-preliminary",
|
| 1823 |
+
flush=True)
|
| 1824 |
|
| 1825 |
assets, layout_findings = discover_assets(target, exclude=out_dir)
|
| 1826 |
print(f"Discovered {len(assets)} USD asset(s) under {target}", flush=True)
|
|
|
|
| 2000 |
if coverage["declared"] is not None and coverage["missing"]:
|
| 2001 |
print(f" profile coverage: {coverage['loaded']}/{coverage['declared']} features loaded "
|
| 2002 |
f"({len(coverage['missing'])} silently dropped — see PROBLEMS.md P1)", flush=True)
|
| 2003 |
+
# If preliminary checks fired alongside USD validation (the
|
| 2004 |
+
# --continue-on-preliminary path), graft their findings into the
|
| 2005 |
+
# final report so the dashboard's per-rule aggregator sees both
|
| 2006 |
+
# phases' issues. Each preliminary finding is attached to its
|
| 2007 |
+
# path's row (a synthetic row is created if no USD asset row
|
| 2008 |
+
# already exists for that path).
|
| 2009 |
+
if preliminary_issues:
|
| 2010 |
+
by_path: dict[str, list[dict]] = {}
|
| 2011 |
+
for f in preliminary_issues:
|
| 2012 |
+
by_path.setdefault(f["path"], []).append(f)
|
| 2013 |
+
row_by_path = {r.get("rel_path"): r for r in results if r.get("rel_path")}
|
| 2014 |
+
for rel, extra in by_path.items():
|
| 2015 |
+
row = row_by_path.get(rel)
|
| 2016 |
+
if row is None:
|
| 2017 |
+
row = {
|
| 2018 |
+
"asset_path": str(target / rel) if rel != "." else str(target),
|
| 2019 |
+
"rel_path": rel,
|
| 2020 |
+
"validation_status": "fail",
|
| 2021 |
+
"profile": args.profile,
|
| 2022 |
+
"profile_version": args.version,
|
| 2023 |
+
"issues": [],
|
| 2024 |
+
"passed": False,
|
| 2025 |
+
}
|
| 2026 |
+
results.append(row)
|
| 2027 |
+
row_by_path[rel] = row
|
| 2028 |
+
row.setdefault("issues", []).extend(extra)
|
| 2029 |
+
row["passed"] = False
|
| 2030 |
+
row["validation_status"] = "fail"
|
| 2031 |
+
|
| 2032 |
(out_dir / "results.json").write_text(json.dumps({
|
| 2033 |
"generated": datetime.now(timezone.utc).isoformat(),
|
| 2034 |
"target": str(target),
|
|
|
|
| 2039 |
"profile_coverage": coverage,
|
| 2040 |
"thumbnail_provenance": thumbnail_provenance,
|
| 2041 |
"layout_findings": layout_findings,
|
| 2042 |
+
"preliminary_findings": preliminary_issues,
|
| 2043 |
"results": results,
|
| 2044 |
}, indent=2), encoding="utf-8")
|
| 2045 |
|