Pull warning signals from a tool result.
(result: dict[str, Any])
| 316 | |
| 317 | |
| 318 | def _extract_warnings(result: dict[str, Any]) -> list[str]: |
| 319 | """Pull warning signals from a tool result.""" |
| 320 | warnings: list[str] = [] |
| 321 | |
| 322 | # Test gaps |
| 323 | test_gaps = result.get("test_gaps") |
| 324 | if isinstance(test_gaps, list) and test_gaps: |
| 325 | names = [g.get("name", g) if isinstance(g, dict) else str(g) for g in test_gaps[:5]] |
| 326 | warnings.append( |
| 327 | f"Test coverage gaps: {', '.join(names)}" |
| 328 | ) |
| 329 | |
| 330 | # High risk score |
| 331 | risk = result.get("risk_score") |
| 332 | if isinstance(risk, (int, float)) and risk > 0.7: |
| 333 | warnings.append(f"High risk score ({risk:.2f}) — review carefully") |
| 334 | |
| 335 | # Coupling warnings from architecture overview |
| 336 | arch_warnings = result.get("warnings") |
| 337 | if isinstance(arch_warnings, list): |
| 338 | for w in arch_warnings[:3]: |
| 339 | if isinstance(w, str): |
| 340 | warnings.append(w) |
| 341 | elif isinstance(w, dict) and "message" in w: |
| 342 | warnings.append(w["message"]) |
| 343 | |
| 344 | return warnings |
| 345 | |
| 346 | |
| 347 | def _build_related( |