You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(tests): test_toc_extractor encodes page-1 coverage gap as expected correct behavior #273
ingestion/tests/test_toc_extractor.py at line 163 asserts covered == list(range(2, 9)), explicitly encoding a page-1 coverage gap as the expected correct result. The test name claims 'no gap' but content on page 1 is silently excluded. In production, page 1 is never covered by any section, making its content permanently unreachable via routing.
Root Cause
ingestion/tests/test_toc_extractor.py around line 163:
deftest_out_of_order_raw_toc_keeps_content_and_leaves_no_gap():
raw= [(1, 'A', 5), (1, 'B', 2)] # B on page 2, A on page 5total_pages=8entries=_derive_page_ranges(raw, total_pages)
covered=sorted({pforeinentriesforpinrange(e.page_start, e.page_end+1)})
assertcovered==list(range(2, 9)) # ← page 1 is excluded# The test name says 'no gap' but range(2,9) starts at page 2, not page 1
After sorting and deriving ranges: B=[2,4], A=[5,8]. Page 1 is never assigned to any section. The first entry starts at page 2 because that's where the earliest section begins — but page 1 content is abandoned.
Failure Scenario
A legal PDF has its executive summary on page 1, followed by a table of contents starting page 2.
Activity
piyushmakhija28 commentedon Jun 21, 2026
Fixed in PR #280 (Sprint R3/R4: fix(sprint-r3): root-cause fixes for all 39 bugs from code review round 3 + Sprint R4 round 4)