Return True if the critique indicates acceptable quality (no refinement needed). Logic: - If a numeric X/10 rating is present: pass if rating >= threshold * 10 - If no rating: fail if any critical issue marker is found in the critique
(critique: str, threshold: float = 0.7)
| 205 | |
| 206 | |
| 207 | def passes_quality_check(critique: str, threshold: float = 0.7) -> bool: |
| 208 | """ |
| 209 | Return True if the critique indicates acceptable quality (no refinement needed). |
| 210 | |
| 211 | Logic: |
| 212 | - If a numeric X/10 rating is present: pass if rating >= threshold * 10 |
| 213 | - If no rating: fail if any critical issue marker is found in the critique |
| 214 | """ |
| 215 | rating = extract_rating(critique) |
| 216 | if rating is not None: |
| 217 | return rating >= threshold * 10 |
| 218 | |
| 219 | # No numeric rating — check for critical problem markers |
| 220 | lower = critique.lower() |
| 221 | return not any(marker in lower for marker in _CRITICAL_MARKERS) |
| 222 | |
| 223 | |
| 224 | # ── Internal helpers ────────────────────────────────────────────────────────── |
no test coverage detected