Commit a8c54c9
committed
fix(engine): surface scanner exceptions as failure rows in canonical results
Both ``_run_sequential`` and ``_run_parallel`` previously caught
exceptions raised from ``scanner.scan()`` and silently dropped the
scanner from the result list. Other scanners that failed via the
``_run_in_container`` path produced an ``execution_failed`` ScanResult
row visible in argus-results.json; scanners with custom ``scan()``
implementations that raise (FileNotFoundError when a binary is missing,
RuntimeError, TimeoutExpired, etc.) disappeared entirely.
Concretely: ``lint-dockerfile`` (HadolintLinter) calls
``subprocess.run(['hadolint', ...])`` directly. When hadolint is not
installed locally and the container backend is unavailable, the
FileNotFoundError propagates up through scan() — the engine logged
the exception and moved on, leaving no trace in canonical results.
The user looking at argus-results.json had no signal that
lint-dockerfile was even attempted, much less why it didn't run.
Per ADR-016: silent failures are the anti-pattern. The fix:
* New ``_failure_result(scanner_name, exc, duration_ms=None)`` helper at
the top of ``argus/core/engine.py`` builds a ScanResult with the
same ``execution_failed`` and ``execution_failure_reason`` metadata
shape ``_run_in_container`` already emits for output-less docker
runs.
* ``_run_sequential`` (line 304) appends the failure row before the
fail-fast check, so even with --fail-fast the scanner that broke
the loop is visible in results.
* ``_run_parallel`` (line 389) does the same when collecting futures.
Tests updated:
* ``test_run_handles_scanner_exception``,
``test_local_backend_fails_if_unavailable``,
``test_docker_backend_no_image_raises``,
``test_timeout_raises_on_slow_scanner``,
``test_version_mismatch_raises_by_default``,
``test_auto_backend_local_fallback_checks_version``,
``test_run_skips_unavailable_scanners`` (renamed),
``test_fail_fast_aborts_after_failure``,
``test_without_fail_fast_continues_after_failure`` — all updated
from ``len(results) == 0`` (silent drop) to asserting the
``execution_failed`` failure row.
* New ``test_parallel_failure_surfaces_as_failure_row`` —
regression test for the lint-dockerfile bug specifically: scanner
raises FileNotFoundError in parallel mode, failure row appears in
canonical results with the exception type captured.
1517 SDK tests pass.1 parent 0bf1a26 commit a8c54c9
2 files changed
Lines changed: 113 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
28 | 53 | | |
29 | 54 | | |
30 | 55 | | |
| |||
312 | 337 | | |
313 | 338 | | |
314 | 339 | | |
315 | | - | |
| 340 | + | |
316 | 341 | | |
317 | 342 | | |
318 | 343 | | |
319 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
320 | 352 | | |
321 | 353 | | |
322 | 354 | | |
| |||
386 | 418 | | |
387 | 419 | | |
388 | 420 | | |
389 | | - | |
| 421 | + | |
390 | 422 | | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
391 | 427 | | |
392 | 428 | | |
393 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
104 | 108 | | |
105 | 109 | | |
106 | 110 | | |
107 | 111 | | |
108 | 112 | | |
109 | 113 | | |
110 | | - | |
| 114 | + | |
| 115 | + | |
111 | 116 | | |
112 | 117 | | |
113 | 118 | | |
| |||
177 | 182 | | |
178 | 183 | | |
179 | 184 | | |
180 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
181 | 190 | | |
182 | 191 | | |
183 | 192 | | |
| |||
207 | 216 | | |
208 | 217 | | |
209 | 218 | | |
210 | | - | |
| 219 | + | |
| 220 | + | |
211 | 221 | | |
212 | | - | |
| 222 | + | |
| 223 | + | |
213 | 224 | | |
214 | 225 | | |
215 | 226 | | |
| |||
238 | 249 | | |
239 | 250 | | |
240 | 251 | | |
241 | | - | |
| 252 | + | |
| 253 | + | |
242 | 254 | | |
243 | 255 | | |
244 | 256 | | |
| |||
325 | 337 | | |
326 | 338 | | |
327 | 339 | | |
328 | | - | |
329 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
330 | 347 | | |
331 | 348 | | |
332 | 349 | | |
| |||
348 | 365 | | |
349 | 366 | | |
350 | 367 | | |
351 | | - | |
352 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
353 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
354 | 375 | | |
355 | 376 | | |
356 | 377 | | |
| |||
371 | 392 | | |
372 | 393 | | |
373 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
374 | 429 | | |
375 | 430 | | |
376 | 431 | | |
| |||
463 | 518 | | |
464 | 519 | | |
465 | 520 | | |
466 | | - | |
467 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
468 | 524 | | |
469 | 525 | | |
470 | 526 | | |
| |||
1399 | 1455 | | |
1400 | 1456 | | |
1401 | 1457 | | |
1402 | | - | |
| 1458 | + | |
| 1459 | + | |
1403 | 1460 | | |
1404 | | - | |
| 1461 | + | |
| 1462 | + | |
1405 | 1463 | | |
1406 | 1464 | | |
1407 | 1465 | | |
| |||
1477 | 1535 | | |
1478 | 1536 | | |
1479 | 1537 | | |
1480 | | - | |
1481 | | - | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
1482 | 1541 | | |
1483 | 1542 | | |
1484 | 1543 | | |
| |||
0 commit comments