content-explorer/scripts/validate_fixtures.py
tegwick 072a7fa550 Freeze the v0.1 contract and the local ingest connector.
The snapshot and manifest schemas, both example dataspaces, and the shared text renderer now pass the fixture validator and the negative contract tests. JSON, NDJSON, and Markdown frontmatter publish a snapshot only when rights, identity, and references allow it. CONTENT-WP-0001 and CONTENT-WP-0003 are marked finished against those artifacts. CONTENT-WP-0000-T04 stays open. SCOPE.md and the 19:05 scope-against-intent note record the stop.

Assistant: grok
Assistant-Session: 01a130f1-abfb-7d71-9cd6-a8b75ec7f95a
2026-10-12 19:07:32 +02:00

33 lines
980 B
Python

#!/usr/bin/env python3
"""Validate every example dataspace against the v0.1 contract."""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT))
from content_explorer.contract import validate_dataspace # noqa: E402
def main() -> int:
errors: list[str] = []
directories = sorted((ROOT / "examples" / "dataspaces").glob("*/snapshot.json"))
if not directories:
print("no dataspace fixtures found", file=sys.stderr)
return 1
for snapshot_path in directories:
directory = snapshot_path.parent
found = validate_dataspace(directory, require_size=True)
errors.extend(found)
if not found:
print(f"{directory.name}: contract ok")
if errors:
print("\n".join(errors), file=sys.stderr)
return 1
print("Fixture validation OK")
return 0
if __name__ == "__main__":
raise SystemExit(main())