30 lines
2.0 KiB
Python
30 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
import hashlib
|
|
import json
|
|
from collections import Counter
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
manifest_path = ROOT / "docs/p6/python-api-manifest.json"
|
|
manifest = json.loads(manifest_path.read_text())
|
|
pure = [row for row in manifest["records"] if row["tier"] == "tier-2-pure" and row["disposition"] == "exposed"]
|
|
# Runtime evidence is append-only: new native family probes may safely expose
|
|
# more pure APIs. The contract is evidence-backed membership, not a frozen
|
|
# historical count.
|
|
valid = bool(pure) and all(row.get("dispositionEvidence") for row in pure)
|
|
report = {
|
|
"schema": "freecad-web-p6-python-api-pure-gate/v1",
|
|
"taskId": "FW-P6-FPA-F2",
|
|
"result": "pass_with_pending" if valid else "fail",
|
|
"coverage": {"pureTierRecords": sum(row["tier"] == "tier-2-pure" for row in manifest["records"]), "exposedPureRecords": len(pure), "plannedRecords": sum(row["disposition"] == "planned" for row in manifest["records"]), "restrictedRecords": sum(row["disposition"] == "restricted" for row in manifest["records"]), "totalRecords": len(manifest["records"])},
|
|
"byModule": dict(sorted(Counter(row["module"] for row in pure).items())),
|
|
"records": [{"id": row["id"], "module": row["module"], "name": row["name"], "artifacts": row["dispositionEvidence"]} for row in pure],
|
|
"manifestSha256": hashlib.sha256(manifest_path.read_bytes()).hexdigest(),
|
|
"boundaries": ["Only passing native Python API artifacts are used; external OpenSCAD process calls remain subject to capability policy.", "Pure-tier records without native evidence remain planned and are not implied by this partial gate."],
|
|
}
|
|
out = ROOT / "docs/p6/python-api-pure-gate.json"
|
|
out.write_text(json.dumps(report, ensure_ascii=False, indent=2) + "\n")
|
|
(ROOT / "docs/freecad-p6-python-api-pure-gate.log").write_text(json.dumps({"result": report["result"], "coverage": report["coverage"]}) + "\n")
|
|
print(json.dumps({"result": report["result"], "coverage": report["coverage"]}, ensure_ascii=False))
|
|
raise SystemExit(0 if valid else 1)
|