Skip to content

Commit a238ce5

Browse files
committed
ci(coverage): guard health-check skip against empty exception message
If a skipped case raised an exception with an empty str() (e.g. ImportError() with no message), str(exc).strip().splitlines()[-1] indexed an empty list -> IndexError inside the except handler, which is uncaught and crashes the graceful-skip path. Fall back to '(no message)'. Caught by Claude Code Review on #1471.
1 parent bb6a850 commit a238ce5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

.github/scripts/check_coverage_map_health.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
try:
2525
current_keys.add(b.to_case().coverage_key())
2626
except Exception as exc: # noqa: BLE001 — a case file that won't import must not crash the health check
27-
unloadable.append((getattr(b, "trace", repr(b)), str(exc).strip().splitlines()[-1][:140]))
27+
last_line = (str(exc).strip().splitlines() or ["(no message)"])[-1][:140]
28+
unloadable.append((getattr(b, "trace", repr(b)), last_line))
2829
if unloadable:
2930
print(f"Note: {len(unloadable)} case(s) could not be loaded in this lightweight job (excluded from the check):")
3031
for trace, err in unloadable[:15]:

0 commit comments

Comments
 (0)