Fail loudly when PasHub truncates the evidence list 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-22 12:56:55 +00:00
parent f54b420ae1
commit d8f673a31f
2 changed files with 19 additions and 0 deletions

View file

@ -41,6 +41,10 @@ class UnauthorizedError(Exception):
pass
class TruncatedEvidenceListError(Exception):
pass
class PashubClient:
def __init__(self, token: str):

View file

@ -12,6 +12,7 @@ from backend.pashub_fetcher.pashub_client import (
DownloadedFiles,
PashubClient,
RdSapSummary,
TruncatedEvidenceListError,
UnauthorizedError,
)
@ -377,3 +378,17 @@ def test_get_evidence_list_requests_a_single_large_page() -> None:
"pageIndex": 0,
"pageSize": 100,
}
def test_get_evidence_list_raises_when_response_is_truncated() -> None:
# Arrange
client = make_client()
payload = {
"results": [make_evidence_item(f"id-{i}") for i in range(100)],
"totalItemCount": 250,
}
client.session.get = MagicMock(return_value=make_response(payload=payload))
# Act / Assert
with pytest.raises(TruncatedEvidenceListError, match=r"100 of 250"):
client._get_evidence_list("job-1")