From bd928828e33f55b67548ed6bc8c56b6ff180436c Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 8 Jul 2026 09:06:26 +0000 Subject: [PATCH] =?UTF-8?q?Skip=20and=20report=20a=20document=20with=20no?= =?UTF-8?q?=20Document=20Type=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- domain/bulk_document_download/package_plan.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/domain/bulk_document_download/package_plan.py b/domain/bulk_document_download/package_plan.py index 64e57950d..bcd122aad 100644 --- a/domain/bulk_document_download/package_plan.py +++ b/domain/bulk_document_download/package_plan.py @@ -64,8 +64,17 @@ def plan_download_package( per property, the latest file of each Document Type, null-Document-Type rows skipped and reported.""" latest_by_group: dict[tuple[str, str], ResolvedDocument] = {} + skipped: list[SkippedDocument] = [] for document in documents: - assert document.document_type is not None + if document.document_type is None: + skipped.append( + SkippedDocument( + landlord_property_id=document.landlord_property_id, + s3_key=document.s3_key, + reason="null_document_type", + ) + ) + continue group = (document.landlord_property_id, document.document_type) incumbent = latest_by_group.get(group) if incumbent is None or document.uploaded_at > incumbent.uploaded_at: @@ -80,4 +89,4 @@ def plan_download_package( ) for document in latest_by_group.values() ] - return DownloadPackagePlan(entries=tuple(entries), skipped=()) + return DownloadPackagePlan(entries=tuple(entries), skipped=tuple(skipped))