From c95d3b20dceb0b65ea539e643ce0f3ecb542a9fa Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 22 Jul 2026 12:57:25 +0000 Subject: [PATCH] =?UTF-8?q?Fail=20loudly=20when=20PasHub=20truncates=20the?= =?UTF-8?q?=20evidence=20list=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_client.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/backend/pashub_fetcher/pashub_client.py b/backend/pashub_fetcher/pashub_client.py index 11cf403c7..aadaed41f 100644 --- a/backend/pashub_fetcher/pashub_client.py +++ b/backend/pashub_fetcher/pashub_client.py @@ -192,7 +192,17 @@ class PashubClient: r.raise_for_status() - results = r.json().get("results", []) + payload: Dict[str, Any] = r.json() + results: List[Dict[str, Any]] = payload.get("results", []) + total: int = payload.get("totalItemCount", len(results)) + + if len(results) < total: + raise TruncatedEvidenceListError( + f"PasHub returned {len(results)} of {total} evidence files for job " + f"{job_id} - the response was truncated and the evidence set is " + f"incomplete. Increase _EVIDENCE_PAGE_SIZE in pashub_client.py " + f"above {total} and re-run." + ) return [EvidenceFileData.from_api(item) for item in results]