@@ -285,15 +285,13 @@ def test_retry_decision_delegates_to_sdk_classification(
285285 assert core_with_mock_sdk .sdk .fullscans .post .call_count == expected_calls
286286
287287
288- @pytest .mark .parametrize ("status_code" , [413 , 414 , 431 ])
289- def test_oversized_request_is_not_retried_and_names_the_cause (
288+ @pytest .mark .parametrize ("status_code" , [414 , 431 ])
289+ def test_oversized_request_target_is_not_retried_and_names_the_cause (
290290 core_with_mock_sdk , tmp_path , no_sleep , status_code
291291):
292292 """
293- A proxy that refuses the request line reports 413, 414 or 431 depending on which limit
294- it checks. None of them are worth a retry (the same oversized URL goes back out), and
295- the SDK's own message is a status code plus the proxy's response body, which does not
296- say what to change.
293+ URI and header size failures are deterministic for the same request, and the SDK's
294+ message does not say which metadata to shorten.
297295 """
298296 manifest = tmp_path / "package.json"
299297 manifest .write_text ("{}" )
@@ -310,3 +308,21 @@ def test_oversized_request_is_not_retried_and_names_the_cause(
310308 # The SDK's original text is kept so the proxy's own response stays available.
311309 assert f"original_status_code:{ status_code } " in message
312310 assert exc_info .value .status_code == status_code
311+
312+
313+ def test_413_reports_upload_and_metadata_causes (core_with_mock_sdk , tmp_path , no_sleep ):
314+ manifest = tmp_path / "package.json"
315+ manifest .write_text ("{}" )
316+ core_with_mock_sdk .sdk .fullscans .post .side_effect = _catch_all_failure (413 )
317+
318+ with pytest .raises (APIFailure ) as exc_info :
319+ core_with_mock_sdk .create_full_scan ([str (manifest )], MagicMock ())
320+
321+ assert core_with_mock_sdk .sdk .fullscans .post .call_count == 1
322+ no_sleep .assert_not_called ()
323+ message = str (exc_info .value )
324+ assert "oversized multipart upload" in message
325+ assert "oversized scan metadata" in message
326+ assert "--commit-message" in message
327+ assert "original_status_code:413" in message
328+ assert exc_info .value .status_code == 413
0 commit comments