56 lines
1.8 KiB
Python
Executable File
56 lines
1.8 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
import ast
|
|
import json
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
CORE = ROOT / "active-runtime" / "app" / "authorized_task_writer_provisioning.py"
|
|
ADAPTER = ROOT / "active-runtime" / "app" / "aios_authorized_task_writer_api.py"
|
|
OPENAPI = ROOT / "docs" / "gitops" / "openapi-authorized-task-writer-fragment.yaml"
|
|
|
|
|
|
def main() -> int:
|
|
failures = []
|
|
for path in (CORE, ADAPTER):
|
|
try:
|
|
ast.parse(path.read_text(encoding="utf-8"))
|
|
except Exception as exc:
|
|
failures.append(f"{path}: {exc}")
|
|
core = CORE.read_text(encoding="utf-8")
|
|
required = [
|
|
"OWNER_AUTHORIZATION_REQUIRED",
|
|
"AUTHORIZED_BASE_OID_DRIFT",
|
|
"EXISTING_BRANCH_OID_CONFLICT",
|
|
"GOVERNED_GRANT_VALIDATION_FAILED",
|
|
"NEGATIVE_POLICY_TESTS_FAILED",
|
|
"ONE_TIME_GRANT_NOT_CONSUMED",
|
|
]
|
|
for marker in required:
|
|
if marker not in core:
|
|
failures.append(f"missing fail-closed marker: {marker}")
|
|
forbidden_direct_git = ["update-ref", "push --force"]
|
|
for marker in forbidden_direct_git:
|
|
if marker in core:
|
|
failures.append(f"direct mutation marker found: {marker}")
|
|
schema = OPENAPI.read_text(encoding="utf-8")
|
|
for marker in [
|
|
"provisionAuthorizedTaskWriter",
|
|
"x-openai-isConsequential: true",
|
|
"production_change_authorized",
|
|
"const: false",
|
|
]:
|
|
if marker not in schema:
|
|
failures.append(f"OpenAPI marker missing: {marker}")
|
|
if failures:
|
|
print(json.dumps({"status": "FAILED", "failures": failures}, indent=2))
|
|
return 1
|
|
print(json.dumps({"status": "PASS", "files": 3}, indent=2))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|