#!/usr/bin/env python3 """Write local performance evidence without printing source or process logs.""" import json from wbv2_autopilot import ROOT, CONTROL, Autopilot, contained, now, read_json, sha, write_json def main(): runner = Autopilot() job = "SERVER-OPERATOR-HTTP-PROVIDER" record = runner.state["jobs"][job] if not runner.receipt_valid(record): raise ValueError("local workflow receipt is not current") receipt = read_json(contained(ROOT, record["receipt"])) inventory = read_json(ROOT / "tests/golden/WBV2/dynamic-inventory.json") steps = [{"id": check["id"], "seconds": check["durationSeconds"], "exitCode": check["exitCode"], "log": check["log"], "logSha256": check["logSha256"]} for check in receipt["checks"]] regression_logs = [f"{CONTROL}/local-module-loading/{name}" for name in ("wbv2-module-loader-tests.log", "wbv2-module-loading-results.log", "wbv2-local-supervisor-tests.log")] sources = ["my-tools/wbv2_autopilot.py", "my-tools/wbv2_validation.py", "my-tools/wbv2_autopilot_policy.json", "my-tools/prepare_wbv2_local_workflow.py", "my-tools/test_wbv2_local.py", "my-tools/test_wbv2_validation.py"] report = { "schemaVersion": 1, "task": receipt["queueTask"], "recordedAt": now(), "status": "in_progress", "workflow": receipt["workflow"], "jobStatus": "verified", "executionMode": "local_only", "modelRequests": 0, "sourceTransmissions": 0, "steps": steps, "validationSeconds": round(sum(step["seconds"] for step in steps), 6), "receipt": {"path": record["receipt"], "sha256": sha(ROOT / record["receipt"])}, "artifacts": [{"path": path, "sha256": sha(ROOT / path)} for path in regression_logs + sources], "regressions": {"supervisor": 60, "wasmLoaderUnit": 2, "chromiumModuleLoading": 1}, "sourceAccounting": { "unitCount": inventory["summary"]["unitCount"], "verifiedUnits": inventory["coverage"]["verifiedUnits"], "unverifiedUnits": inventory["coverage"]["unverifiedUnits"], "sourceTreeSha256": inventory["authority"]["sourceTreeSha256"], "receiptBoundUnits": receipt["sourceUnits"], "inventoryIncrement": 0, }, "limits": [ "Recorded inventory coverage is historical; this report does not repair drift or advance the queue.", "A successful incremental build is not a measured clean build.", "Other module results lack executable behavioral contracts; they stay pending until a local contract is supplied.", "No model is called to generate missing implementations or contracts.", ], } destination = ROOT / f"tests/golden/{receipt['queueTask']}/local-execution-efficiency-report.json" write_json(destination, report) lines = ["# Local Execution Efficiency", "", "Source, diagnostics and full logs remain on this machine. Model execution is disabled.", "", "Step | Seconds | Exit", "--- | ---: | ---:"] lines.extend(f"{step['id']} | {step['seconds']:.3f} | {step['exitCode']}" for step in steps) lines += ["", f"Independent validation: {report['validationSeconds']:.3f} seconds. Model requests: 0.", "", "The earlier 782.716-second model turn was rejected before independent validation; it is not a successful-run performance baseline.", "", f"Verified workflow receipt: {record['receipt']}", "", "Supervisor regressions: 60 passed. WASM loader unit tests: 2 passed. Chromium module loading: 1 passed.", "", "Only receipt-backed add/open/save units are bound. The unbound deletion unit was removed from the local contract claim.", "", "Inventory: " + json.dumps(report["sourceAccounting"], ensure_ascii=True), "", *report["limits"]] destination.with_suffix(".md").write_text("\n".join(lines) + "\n", encoding="utf-8") print(json.dumps({"report": str(destination.relative_to(ROOT)), "validationSeconds": report["validationSeconds"], "modelRequests": 0, "verifiedJob": job})) if __name__ == "__main__": main()