From 38cae15f4d84312078ef39c0869e45175cb0547c Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 14 Jul 2026 13:50:31 +0000 Subject: [PATCH] =?UTF-8?q?Preserve=20SharePoint=20distribution=20when=20t?= =?UTF-8?q?he=20site-note=20save=20fails=20loudly=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- backend/pashub_fetcher/pashub_service.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/pashub_fetcher/pashub_service.py b/backend/pashub_fetcher/pashub_service.py index 02ca24003..18caab333 100644 --- a/backend/pashub_fetcher/pashub_service.py +++ b/backend/pashub_fetcher/pashub_service.py @@ -119,6 +119,7 @@ class PashubService: job_id, include_other=request.get_other_files ) + upload_records: List[_FileUploadRecord] = [] if uprn or hubspot_deal_id: logger.info("Uploading files to s3") file_source = ( @@ -129,7 +130,6 @@ class PashubService: upload_records = self._upload_to_s3_and_update_db( downloaded.core, uprn, hubspot_deal_id, file_source ) - self._save_site_notes(upload_records, active_client, job_id) if downloaded.other: self._upload_to_s3_and_update_db( @@ -153,6 +153,11 @@ class PashubService: property_folder_path = f"{request.sharepoint_link}/{match}" self._upload_to_sharepoint(property_folder_path, downloaded.core + downloaded.other) + # Ordered after S3 + SharePoint so a loud RdSAP Summary failure cannot + # cost us file distribution: the Property refuses to persist with an + # incomplete Lodged Performance, but the evidence is already delivered. + self._save_site_notes(upload_records, active_client, job_id) + for df in downloaded.core + downloaded.other: try: os.remove(df.file_path)