import os import json import yaml import requests import subprocess import time def check_structure(): print("--- 1. Structure Check ---") files = ["openenv.yaml", "inference.py", "env.py", "main.py", "Dockerfile", "requirements.txt"] for f in files: if os.path.exists(f): print(f"✅ Found {f}") else: print(f"❌ Missing {f} (MANDATORY)") def check_yaml(): print("\n--- 2. Spec Validation ---") try: with open("openenv.yaml", "r") as f: data = yaml.safe_load(f) if data.get("openenv_v") and data.get("tasks"): print("✅ openenv.yaml is valid") print(f"✅ Found {len(data['tasks'])} tasks (Minimum 3 required)") else: print("❌ openenv.yaml is missing required fields") except Exception as e: print(f"❌ YAML Error: {e}") def check_logs(): print("\n--- 3. Inference Log Check ---") # We will simulate a quick run of inference.py and check the first/last lines # This requires the server to be running. For this check, we'll verify the code pattern. with open("inference.py", "r") as f: content = f.read() if "[START]" in content and "[STEP]" in content and "[END]" in content: print("✅ inference.py uses correct log tags") if "OpenAI(" in content: print("✅ Found OpenAI Client usage") else: print("❌ Missing OpenAI Client usage (REQIURED)") def check_reward_scaling(): print("\n--- 4. Reward Scaling Check ---") with open("env.py", "r") as f: env_content = f.read() if "reward += 0." in env_content or "reward -= 0." in env_content: print("✅ Logic appears to use 0.0-1.0 normalized rewards") else: print("⚠️ Warning: Could not confirm normalized rewards automatically. Double check env.py.") if __name__ == "__main__": check_structure() check_yaml() check_logs() check_reward_scaling() print("\n🏁 Validation Simulation Complete. If all above are green, you are ready!")