#!/usr/bin/env python3 """Validate the bounded context and queue contracts used by Blender Web.""" from __future__ import annotations import argparse import subprocess from wbv2_runtime import ROOT, queue_pointer def main() -> int: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--quiet", action="store_true") args = parser.parse_args() commands = [ ["node", "tools/web/print-task-context.mjs"], ["node", "tools/web/check-task-context.mjs"], ["node", "tools/web/check-context-governance.mjs"], ["node", "tools/web/check-execution-control-plane.mjs"], ] failures = [] for command in commands: result = subprocess.run(command, cwd=ROOT, text=True, capture_output=True, check=False) if not args.quiet: output = (result.stdout or result.stderr).strip() if output: print(output) if result.returncode != 0: failures.append(f"{' '.join(command)} exit={result.returncode}") if failures: print("WBV2 CONTEXT VALIDATION FAILED: " + "; ".join(failures)) return 1 print(f"WBV2 CONTEXT VALIDATION PASSED: task={queue_pointer().get('task') or 'NONE'}") return 0 if __name__ == "__main__": raise SystemExit(main())