From 446320983a99b4c98a6933657e2dc0a3acd0c0dc Mon Sep 17 00:00:00 2001 From: Chris Coutinho Date: Sat, 6 Jun 2026 14:13:07 +0200 Subject: [PATCH] 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) --- nextcloud_mcp_server/vector/processor.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nextcloud_mcp_server/vector/processor.py b/nextcloud_mcp_server/vector/processor.py index a879e340..4e99cb6e 100644 --- a/nextcloud_mcp_server/vector/processor.py +++ b/nextcloud_mcp_server/vector/processor.py @@ -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(