test: fix structured reask evidence and live coverage conclusions
This commit is contained in:
+10
-2
@@ -225,11 +225,12 @@ _SAFE_FIELDS = frozenset(
|
||||
"error_type",
|
||||
"error_status",
|
||||
"evidence_notes",
|
||||
"subruns",
|
||||
}
|
||||
)
|
||||
_ATTEMPT_FIELDS = frozenset({"call_id", "error_type", "http"})
|
||||
_HTTP_FIELDS = frozenset(
|
||||
{"status_code", "request_checks", "identity_captured", "error_body_complete"}
|
||||
{"status_code", "request_checks", "identity_captured", "error_body_complete", "machine_type"}
|
||||
)
|
||||
|
||||
|
||||
@@ -243,6 +244,8 @@ def _validate_safe(fields: Mapping[str, Any]) -> None:
|
||||
for event in attempt["http"]:
|
||||
if not isinstance(event, dict) or set(event) != _HTTP_FIELDS:
|
||||
raise ValueError("非法 HTTP 报告")
|
||||
if event["machine_type"] not in ("model_not_found", "omitted"):
|
||||
raise ValueError("报告机器字段不是认可枚举")
|
||||
if not isinstance(event["request_checks"], dict) or any(
|
||||
type(v) is not bool for v in event["request_checks"].values()
|
||||
):
|
||||
@@ -273,7 +276,7 @@ def write_live_round(
|
||||
|
||||
|
||||
def safe_attempts(attempts: Sequence[AttemptEvidence]) -> list[dict[str, Any]]:
|
||||
"""只导出事实布尔值、异常类和状态;不落盘任何上游正文。"""
|
||||
"""只导出事实、异常类与认可机器枚举;任意上游字符串一律省略。"""
|
||||
return [
|
||||
{
|
||||
"call_id": attempt.call_id,
|
||||
@@ -284,6 +287,11 @@ def safe_attempts(attempts: Sequence[AttemptEvidence]) -> list[dict[str, Any]]:
|
||||
"request_checks": dict(event.request_checks),
|
||||
"identity_captured": event.raw_identity[0],
|
||||
"error_body_complete": event.error_body is not None,
|
||||
"machine_type": (
|
||||
"model_not_found"
|
||||
if error_machine_type(event) == "model_not_found"
|
||||
else "omitted"
|
||||
),
|
||||
}
|
||||
for event in attempt.http
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user