fix(vector): skip page-assignment span/warning on empty boundaries

Address claude-review round 4 on PR #868: tighten the assign_page_numbers
guard from `page_boundaries is not None` to a truthy check, so a PDF with an
empty boundary list no longer enters the trace span and fires the alarming
"NO page numbers assigned" warning for a harmless no-op.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-06 14:13:07 +02:00
co-authored by Claude Opus 4.8
parent 20b4bc6ab9
commit 446320983a
+3 -5
View File
@@ -739,11 +739,9 @@ async def _index_document(
chunk_span.set_attribute(_ATTR_CHUNK_COUNT, len(chunks))
# Assign page numbers for the char-based path (page-aware already sets them).
if (
not use_page_aware
and doc_task.doc_type == "file"
and page_boundaries is not None
):
# Truthy guard (not "is not None"): an empty boundary list has nothing to
# assign, so skip the span and the "NO page numbers assigned" warning.
if not use_page_aware and doc_task.doc_type == "file" and page_boundaries:
# Type narrowing: page_boundaries is guaranteed to be list[dict] here
page_boundaries_list = cast(list[dict[str, Any]], page_boundaries)
with trace_operation(