#!/usr/bin/env python3 """Refine the current local provider contract without reading production source.""" import copy import json from wbv2_autopilot import ROOT, read_json, write_json def main(): destination = ROOT / "tests/golden/WBV2/autopilot/local-plans/SERVER-OPERATOR-HTTP-PROVIDER.json" contract = read_json(destination) result = contract["result"] original = next((check for check in result["checks"] if check["id"] == "chromium-provider"), None) if original is None: print(json.dumps({"state": "already_refined", "checks": len(result["checks"])})) return names = {"chromium-main": "server-operator-native.spec.ts", "chromium-polling": "server-operator-polling.spec.ts", "chromium-cross-abi": "server-blend-cross-abi.spec.ts"} timeouts = {"wasm-source-build": 1200, "web-build": 300, "client-lint": 60, "provider-transport": 60, "deployment-static": 30, "chromium-main": 180, "chromium-polling": 90, "chromium-cross-abi": 180} checks = [check for check in result["checks"] if check is not original] for identifier, name in names.items(): check = copy.deepcopy(original) check["id"] = identifier check["argv"] = [arg for arg in check["argv"] if not arg.endswith(".spec.ts") or arg.endswith(name)] check["dependsOn"] = ["wasm-source-build", "web-build"] check["cacheInputs"] = [path for path in result["dependencies"] if "/tests/e2e/" not in path or path.endswith(name)] if identifier != "chromium-main": check["kinds"] = ["chromium", "negative"] checks.append(check) for check in checks: check["timeoutSeconds"] = timeouts[check["id"]] check["continueOnFailure"] = True if check["id"] == "web-build": check["dependsOn"] = ["wasm-source-build"] for case in result["cases"]: if case["checkId"] == "chromium-provider": case["checkId"] = "chromium-main" result["checks"] = checks contract["executionPolicy"] = "per-business-group checkpoints; independent groups continue after failure" write_json(destination, contract) print(json.dumps({"checks": len(checks), "chromiumGroups": list(names), "modelRequests": 0})) if __name__ == "__main__": main()