"""Policy regression for the JSON-LD validation hook. FAQPage must NOT block because it remains a valid Schema.org type, even though Google retired its rich results in May 2026 and no AI or ranking benefit is confirmed. Genuinely deprecated types must still block the edit (exit 2). """ from __future__ import annotations import subprocess import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[1] HOOK = ROOT / "hooks" / "validate-schema.py" def _run(tmp_path: Path, schema_type: str, extra: str = "") -> int: html = tmp_path / "page.html" html.write_text( '", encoding="utf-8", ) return subprocess.run([sys.executable, str(HOOK), str(html)]).returncode def test_faqpage_not_blocked(tmp_path): assert _run(tmp_path, "FAQPage") == 0 def test_deprecated_type_still_blocks(tmp_path): assert _run(tmp_path, "ClaimReview") == 2