fix: finalize S-52 runtime production contract
This commit is contained in:
@@ -40,6 +40,7 @@ def audit_runtime(features: list[tuple[str, dict[str, Any]]]) -> dict[str, Any]:
|
||||
|
||||
csp_counts = Counter(str(props.get("s52_runtime_csp") or "") for _, props in runtime)
|
||||
leaked = Counter()
|
||||
unknown_fact_exceptions = Counter()
|
||||
for _, props in runtime:
|
||||
csp = str(props.get("s52_runtime_csp") or "")
|
||||
if not csp:
|
||||
@@ -51,13 +52,21 @@ def audit_runtime(features: list[tuple[str, dict[str, Any]]]) -> dict[str, Any]:
|
||||
leaked[key] += 1
|
||||
if csp in {"DEPARE01", "DEPARE02"}:
|
||||
if "depth_min_m" not in props:
|
||||
failures.append(f"{csp} 缺少 depth_min_m")
|
||||
if props.get("canonical_object_type") == "dredged_area":
|
||||
unknown_fact_exceptions["DEPARE:dredged_area_missing_depth_min"] += 1
|
||||
else:
|
||||
failures.append(f"{csp} 缺少 depth_min_m")
|
||||
if "s52_area_color" in props:
|
||||
leaked["DEPARE:s52_area_color"] += 1
|
||||
elif csp == "DEPCNT02" and "contour_depth_m" not in props:
|
||||
failures.append("DEPCNT02 缺少 contour_depth_m")
|
||||
elif csp == "SOUNDG02" and "s52_sounding_depth_m" not in props:
|
||||
failures.append("SOUNDG02 缺少 s52_sounding_depth_m")
|
||||
elif csp in {"OBSTRN04", "WRECKS02"} and "s52_hazard_depth_m" not in props:
|
||||
if csp == "OBSTRN04" and props.get("s52_expsou_code") == 1:
|
||||
unknown_fact_exceptions["OBSTRN04:EXPSOU1_unknown_hazard_depth"] += 1
|
||||
else:
|
||||
failures.append(f"{csp} 缺少 s52_hazard_depth_m")
|
||||
|
||||
if leaked:
|
||||
failures.append(f"发现 runtime 最终状态泄漏: {dict(leaked)}")
|
||||
@@ -79,6 +88,7 @@ def audit_runtime(features: list[tuple[str, dict[str, Any]]]) -> dict[str, Any]:
|
||||
"s52_surrounding_min_drval2_m",
|
||||
)
|
||||
},
|
||||
"unknown_fact_exceptions": dict(unknown_fact_exceptions),
|
||||
"dynamic_final_leaks": dict(leaked),
|
||||
"failures": failures,
|
||||
"status": "PASS" if not failures else "FAIL",
|
||||
|
||||
Reference in New Issue
Block a user