generated from coulomb/repo-seed
29 lines
947 B
Python
29 lines
947 B
Python
"""SDK fixture normalizer for native runner output."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
|
|
def normalize(context: dict) -> dict:
|
|
run_dir = Path(context["run_dir"])
|
|
runner_result = context["runner_result"]
|
|
artifact_ref = runner_result["facts"]["native_result_ref"]
|
|
native_result = json.loads((run_dir / artifact_ref).read_text(encoding="utf-8"))
|
|
native_status = native_result.get("native_status")
|
|
result = "pass" if native_status == "ok" else "fail"
|
|
return {
|
|
"result": result,
|
|
"observations": native_result.get("observations", []),
|
|
"facts": {
|
|
"native_status": native_status,
|
|
"native_score": native_result.get("native_score"),
|
|
"normalized_by": "native-probe-normalizer"
|
|
},
|
|
"artifact_refs": [
|
|
artifact_ref
|
|
],
|
|
"requirement_refs": native_result.get("requirement_refs", []),
|
|
}
|