Commit ce4328c
fix(documents): log TOC analyzer failures instead of swallowing them silently (edgartools-hk9w)
The analyzer degraded silently on internal errors — blanket 'except Exception: pass'
in _analyze_generic_toc, _extract_preceding_item_label, _infer_part_from_row_context,
_anchor_matches_heading, and the module-level _find_toc_table_start, plus an
unlogged agent-parser fallthrough. When an agent parser threw or found nothing,
the analyzer dropped to the generic fallback (or returned {}) with no signal —
exactly the blindness that let the GS/Citi section bugs hide.
Every catch now emits logger.debug(..., exc_info=True) with context, matching the
already-logged agent parsers (Workiva/DFIN/Novaworks/Toppan, body-header scan). The
agent fallthrough logs which parser returned nothing before degrading to the generic
scan. The one remaining narrow catch (except (ValueError, AttributeError): continue
in the per-anchor loop) stays as-is — already typed, and per-anchor logging is noise.
Tests: test_agent_fallthrough_logs (caplog asserts the fallthrough log names the
parser) and test_no_blanket_silent_except (guard against any 'except Exception: pass'
regressing). test_toc_agents 44 passed; broader TOC/section/corpus run 85 passed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 4b247a4 commit ce4328c
2 files changed
Lines changed: 44 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
97 | 102 | | |
98 | 103 | | |
99 | 104 | | |
| |||
212 | 217 | | |
213 | 218 | | |
214 | 219 | | |
215 | | - | |
216 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
217 | 223 | | |
218 | 224 | | |
219 | 225 | | |
| |||
951 | 957 | | |
952 | 958 | | |
953 | 959 | | |
954 | | - | |
| 960 | + | |
955 | 961 | | |
956 | 962 | | |
957 | 963 | | |
| |||
1015 | 1021 | | |
1016 | 1022 | | |
1017 | 1023 | | |
| 1024 | + | |
1018 | 1025 | | |
1019 | 1026 | | |
1020 | 1027 | | |
| |||
1332 | 1339 | | |
1333 | 1340 | | |
1334 | 1341 | | |
1335 | | - | |
| 1342 | + | |
1336 | 1343 | | |
1337 | 1344 | | |
1338 | 1345 | | |
| |||
1475 | 1482 | | |
1476 | 1483 | | |
1477 | 1484 | | |
1478 | | - | |
| 1485 | + | |
1479 | 1486 | | |
1480 | 1487 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
0 commit comments