22 lines
1.7 KiB
Python
22 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Generate explicit Tier-4 restricted/nonportable API boundaries."""
|
|
from __future__ import annotations
|
|
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
source_path = ROOT / "docs/p6/python-api-manifest.json"
|
|
rows = json.loads(source_path.read_text(encoding="utf-8"))["records"]
|
|
selected = [row for row in rows if row["tier"] == "tier-4-restricted" or row["disposition"] in {"restricted", "nonportable"}]
|
|
records = []
|
|
for row in selected:
|
|
name = row["name"]
|
|
reason = "GUI/desktop dependency" if any(token in name.lower() for token in ("qt", "pyside", "pivy", "gui", "taskpanel", "browser")) else "nonportable or external runtime dependency"
|
|
records.append({"apiId": row["id"], "module": row["module"], "name": name, "family": row["family"], "tier": row["tier"], "disposition": row["disposition"], "reason": reason, "alternative": "Use React/Three.js/Worker route when an explicit Web equivalent exists"})
|
|
output = {"schema": "freecad-web-tier4-restricted-manifest/v1", "taskId": "FW-P6-FPA-IMPL-TIER4-RESTRICTED", "source": {"manifest": "docs/p6/python-api-manifest.json", "manifestSha256": hashlib.sha256(source_path.read_bytes()).hexdigest()}, "count": len(records), "records": records, "boundaries": ["restricted/nonportable API never executes through Web Python adapter", "alternatives are not semantic parity claims"]}
|
|
out = ROOT / "docs/p6/tier4-restricted-manifest.json"
|
|
out.write_text(json.dumps(output, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
|
print(json.dumps({"output": str(out.relative_to(ROOT)), "count": len(records), "sha256": hashlib.sha256(out.read_bytes()).hexdigest()}, ensure_ascii=False))
|