@@ -270,9 +270,8 @@ else:
270270 if isinstance(score, (int, float)) and score > 2:
271271 errors.append(f"{prefix}: severity='critical' but scores[{cat}]={score} (critical requires score 1-2)")
272272
273- # Validate score-severity consistency: if all findings in a dimension are
274- # severity=minor, that dimension's score must be 4 or 5 (scoring rules state
275- # 'Minor only or no findings -> score 4-5'; score 3 is reserved for important).
273+ # Score-severity consistency: scores are driven by the worst finding severity.
274+ # No findings → 5, minor only → 4, important → 3, critical → 1-2.
276275if isinstance(findings, list) and isinstance(scores, dict):
277276 from collections import defaultdict
278277 dim_severities: dict = defaultdict(set)
@@ -281,22 +280,16 @@ if isinstance(findings, list) and isinstance(scores, dict):
281280 sev = finding.get("severity")
282281 if cat and sev:
283282 dim_severities[cat].add(sev)
284- for dim, sevs in dim_severities.items():
285- score = scores.get(dim)
286- if isinstance(score, (int, float)) and score < 4 and sevs == {"minor"}:
287- errors.append(
288- f"score '{dim}'={score} violates scoring rules: all findings in "
289- f"this dimension are severity='minor', which requires score 4-5 "
290- f"(score 3 is reserved for important findings)"
291- )
292- # No-findings low-score check (6d83-b949): if a dimension has no findings
293- # at all, its score must be 4 or 5 per scoring rules ("no findings → score 4-5").
294283 for dim, score in scores.items():
295- if dim not in dim_severities and isinstance(score, (int, float)) and score < 4:
296- errors.append(
297- f"score '{dim}'={score} violates scoring rules: this dimension has "
298- f"no findings, which requires score 4-5"
299- )
284+ if not isinstance(score, (int, float)):
285+ continue
286+ sevs = dim_severities.get(dim, set())
287+ if not sevs and score != 5:
288+ errors.append(f"score '{dim}'={score}: no findings requires score 5")
289+ elif sevs == {"minor"} and score != 4:
290+ errors.append(f"score '{dim}'={score}: minor-only findings requires score 4")
291+ elif "important" in sevs and "critical" not in sevs and score != 3:
292+ errors.append(f"score '{dim}'={score}: important (no critical) findings requires score 3")
300293
301294# Validate summary
302295summary = data.get("summary")
0 commit comments