Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m38s
CD Pipeline / build-and-deploy (push) Failing after 24m19s
CD Pipeline / post-deploy-checks (push) Has been skipped
65 lines
2.0 KiB
Python
65 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Execute the bounded five-lane SRE comparison and paid-provider canary."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import asyncio
|
|
import json
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
_REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
_API_ROOT = _REPO_ROOT / "apps" / "api"
|
|
if str(_API_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(_API_ROOT))
|
|
|
|
|
|
async def _run_validation(**kwargs):
|
|
from src.services.paid_provider_canary_validation import (
|
|
run_paid_provider_canary_validation,
|
|
)
|
|
|
|
return await run_paid_provider_canary_validation(**kwargs)
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--run-ref", required=True)
|
|
parser.add_argument("--operator-id", default="codex-controlled-canary")
|
|
parser.add_argument("--authorization-ref", required=True)
|
|
args = parser.parse_args()
|
|
try:
|
|
receipt = asyncio.run(
|
|
_run_validation(
|
|
run_ref=args.run_ref,
|
|
operator_id=args.operator_id,
|
|
authorization_ref=args.authorization_ref,
|
|
)
|
|
)
|
|
except BaseException as exc:
|
|
error_code = str(exc)
|
|
if not re.fullmatch(r"[a-z][a-z0-9_]{0,119}", error_code):
|
|
error_code = f"canary_failed_{type(exc).__name__}"
|
|
print(
|
|
json.dumps(
|
|
{
|
|
"schema_version": "paid_provider_sre_canary_error_v1",
|
|
"status": "blocked_with_safe_next_action",
|
|
"error_code": error_code[:120],
|
|
"raw_prompt_persisted": False,
|
|
"raw_response_persisted": False,
|
|
"secret_value_returned": False,
|
|
},
|
|
sort_keys=True,
|
|
)
|
|
)
|
|
return 2
|
|
print(json.dumps(receipt, ensure_ascii=False, sort_keys=True))
|
|
return 0 if receipt["independent_verifier"]["passed"] else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|