Download scripts/browser_result_gate.py from psiloceyeben/oracle7-chameleon: direct link, hf CLI and curl.
- Browser
- Download file 1.87 kB
-
https://huggingface.co/psiloceyeben/oracle7-chameleon/resolve/main/scripts/browser_result_gate.py
- Command line
-
hf download hf://psiloceyeben/oracle7-chameleon/scripts/browser_result_gate.py
-
curl -L -o browser_result_gate.py https://huggingface.co/psiloceyeben/oracle7-chameleon/resolve/main/scripts/browser_result_gate.py
1.87 kB
| """Bind bounded-browser results to the exact requested package and contract.""" | |
| def failure_class(runtime, behavior): | |
| """Classify failures for diagnosis only; never authorize a passing receipt.""" | |
| if any(runtime.get(key) is True for key in ( | |
| 'timed_out', 'cpu_budget_exhausted', 'output_budget_exhausted', 'memory_budget_exhausted' | |
| )): | |
| return 'EXECUTION_BUDGET_EXHAUSTED' | |
| if (not isinstance(behavior, dict) | |
| or behavior.get('error') == 'BROWSER_DRIVER_DID_NOT_REPORT'): | |
| return 'BROWSER_DRIVER_FAILURE' | |
| if runtime.get('remaining_job_processes') != 0: | |
| return 'BROWSER_RUNTIME_FAILURE' | |
| # The driver deliberately exits 1 for a reported failed assertion. | |
| if (runtime.get('returncode') in (0, 1) | |
| and behavior.get('status') == 'FAIL' | |
| and isinstance(behavior.get('assertion_failure'), dict)): | |
| return 'BEHAVIOR_CHECK_FAILED' | |
| if runtime.get('returncode') != 0: | |
| return 'BROWSER_RUNTIME_FAILURE' | |
| if behavior.get('status') == 'FAIL': | |
| return 'BEHAVIOR_CHECK_FAILED' | |
| return 'EVIDENCE_BINDING_FAILURE' | |
| def accepted(runtime, behavior, package_digest, contract_digest, overlay_digest=None, dependency_digest=None): | |
| return ( | |
| runtime.get("returncode") == 0 | |
| and runtime.get("timed_out") is False | |
| and runtime.get("cpu_budget_exhausted") is False | |
| and runtime.get("output_budget_exhausted") is False | |
| and runtime.get("memory_budget_exhausted", False) is False | |
| and runtime.get("remaining_job_processes") == 0 | |
| and behavior.get("status") == "PASS" | |
| and behavior.get("package_digest") == package_digest | |
| and behavior.get("contract_digest") == contract_digest | |
| and behavior.get("overlay_digest") == overlay_digest | |
| and behavior.get("dependency_digest") == dependency_digest | |
| ) | |