Files
svrnty-vision/tools/validate_svrnty_vision_child.py
T
2026-06-17 19:22:27 -04:00

107 lines
3.7 KiB
Python
Executable File

#!/usr/bin/env python3
"""Validate Svrnty Vision child workspace governance shell."""
from __future__ import annotations
import json
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
REQUIRED = [
"AGENTS.md",
"README.md",
"WORKBOARD.yaml",
"CONTEXT.md",
"docs/VISION-PACKAGE-CANDIDATE.md",
"docs/VISUAL-EVIDENCE-CONTRACT.md",
"docs/VISION-HOST-ADAPTER-CANDIDATES.md",
"candidate-manifests/vision-package-candidate.json",
"candidate-manifests/vision-tool-grants.json",
"candidate-manifests/visual-evidence-contract.json",
"outputs/2026-06-12-svrnty-vision-workboard-readiness-reconciliation.md",
"outputs/2026-06-12-svrnty-vision-workboard-readiness-reconciliation.json",
"Dockerfile",
".dockerignore",
"tools/validate_vision_package_docker_context.py",
]
VALIDATORS = [
"tools/validate_vision_package_candidate.py",
"tools/validate_vision_tool_grants.py",
"tools/validate_visual_evidence_contract.py",
"tools/validate_vision_host_adapter_candidates.py",
"tools/validate_vision_package_docker_context.py",
]
def main() -> int:
errors: list[str] = []
validator_outputs: dict[str, str] = {}
for rel in REQUIRED:
if not (ROOT / rel).exists():
errors.append(f"missing:{rel}")
checks = {
"AGENTS.md": [
"## Universal Cortex OS Agent Contract",
"## Repo-Custom Agent Contract",
"Svrnty Vision is a child-local sovereign vision HTTP gateway",
"Do not start Runtime, start Docker, build or run containers",
"child-local",
"not Cortex OS Core authority",
"python3 tools/validate_svrnty_vision_child.py",
],
"README.md": [
"## Cortex OS Boundary",
"child-local sovereign vision gateway source",
"not start Runtime, start Docker",
"call VLM",
"call Spark/ComfyUI/vLLM services",
"write durable Hindsight memory",
"operator/developer docs, not cleanup-route authorization",
],
"WORKBOARD.yaml": ["SVRNTY-VISION-WORK-001", "SVRNTY-VISION-WORK-003", "SVRNTY-VISION-WORK-005", "status: complete", 'owner: ""'],
"CONTEXT.md": ["Visual Perception Package Candidate", "Research Handoff"],
"docs/VISION-PACKAGE-CANDIDATE.md": ["Research reads sources; Vision sees media", "wildcard grant"],
"outputs/2026-06-12-svrnty-vision-workboard-readiness-reconciliation.md": [
"No Core promotion",
"Seed consumption",
"Runtime start",
],
}
for rel, snippets in checks.items():
path = ROOT / rel
if path.exists():
text = path.read_text(encoding="utf-8")
for snippet in snippets:
if snippet not in text:
errors.append(f"{rel}:missing:{snippet}")
for rel in VALIDATORS:
path = ROOT / rel
if not path.exists():
errors.append(f"missing:{rel}")
continue
completed = subprocess.run(
[sys.executable, str(path)],
cwd=ROOT,
text=True,
capture_output=True,
check=False,
)
validator_outputs[rel] = completed.stdout.strip()
if completed.returncode != 0:
errors.append(f"validator_failed:{rel}:{completed.stderr.strip()}")
result = {
"ok": not errors,
"validator": "svrnty-vision-child-v1",
"checked": REQUIRED + VALIDATORS,
"errors": errors,
"warnings": [],
"validator_outputs": validator_outputs,
}
print(json.dumps(result, indent=2, sort_keys=True))
return 0 if result["ok"] else 1
if __name__ == "__main__":
raise SystemExit(main())