generated from coulomb/repo-seed
command-runner support and first OpenCMIS TCK wrapper boundary
This commit is contained in:
@@ -99,30 +99,60 @@ def _findings_for_evidence(run_id: str, evidence: list[dict[str, Any]]) -> list[
|
||||
for item in evidence:
|
||||
if item["result"] not in {"blocked", "fail", "infrastructure_error"}:
|
||||
continue
|
||||
classification = {
|
||||
"blocked": "runner_not_implemented",
|
||||
"fail": "check_failed",
|
||||
"infrastructure_error": "infrastructure_error",
|
||||
}[item["result"]]
|
||||
findings.append(
|
||||
{
|
||||
"id": f"finding:{item['check_id']}",
|
||||
"run_id": run_id,
|
||||
"status": item["result"],
|
||||
"severity": "info" if item["result"] == "blocked" else "medium",
|
||||
"classification": classification,
|
||||
"severity": _severity_for_item(item),
|
||||
"classification": _classification_for_item(item),
|
||||
"requirement_refs": item["requirement_refs"],
|
||||
"evidence_refs": [item["id"]],
|
||||
"expected": item["result"] == "blocked",
|
||||
"expected": _expected_for_item(item),
|
||||
"waiver_ref": None,
|
||||
"remediation": _remediation_for_result(item["result"]),
|
||||
"remediation": _remediation_for_item(item),
|
||||
}
|
||||
)
|
||||
return findings
|
||||
|
||||
|
||||
def _remediation_for_result(result: str) -> str:
|
||||
def _classification_for_item(item: dict[str, Any]) -> str:
|
||||
result = item["result"]
|
||||
if result == "blocked":
|
||||
blocked_reason = item.get("facts", {}).get("blocked_reason")
|
||||
if isinstance(blocked_reason, str):
|
||||
return blocked_reason
|
||||
return "runner_not_implemented"
|
||||
if result == "fail":
|
||||
return "check_failed"
|
||||
return "infrastructure_error"
|
||||
|
||||
|
||||
def _severity_for_item(item: dict[str, Any]) -> str:
|
||||
if item["result"] == "blocked":
|
||||
return "info"
|
||||
return "medium"
|
||||
|
||||
|
||||
def _expected_for_item(item: dict[str, Any]) -> bool:
|
||||
if item["result"] != "blocked":
|
||||
return False
|
||||
blocked_reason = item.get("facts", {}).get("blocked_reason")
|
||||
return blocked_reason in {
|
||||
"missing_command",
|
||||
"missing_dependency",
|
||||
"tck_invocation_not_configured",
|
||||
}
|
||||
|
||||
|
||||
def _remediation_for_item(item: dict[str, Any]) -> str:
|
||||
result = item["result"]
|
||||
if result == "blocked":
|
||||
blocked_reason = item.get("facts", {}).get("blocked_reason")
|
||||
if blocked_reason == "missing_dependency":
|
||||
return "Install the missing runner dependencies and rerun the assessment."
|
||||
if blocked_reason == "tck_invocation_not_configured":
|
||||
return "Configure the final harness invocation, group mapping, and raw artifact capture."
|
||||
return "Implement or configure the declared extension runner."
|
||||
if result == "infrastructure_error":
|
||||
return "Fix the target, network, credentials, or harness runtime and rerun the assessment."
|
||||
|
||||
Reference in New Issue
Block a user