Repository navigation
fix(service-client): keep the presigned rejection when the InBody fallback fails - #5003
dolfim-ibm wants to merge 2 commits into
Conversation
…lback fails When a server rejects the presigned_url target and then also rejects the InBody fallback, the client raised only the InBody error. This hid the actionable cause, for example that artifact storage is not enabled. The client now reports both rejections in the error detail. Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
|
✅ DCO Check Passed Thanks @dolfim-ibm, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit This pull request preserves the initial presigned URL rejection details when the CI safety: no concern found. A maintainer must still approve CI. The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at fbf2c39204. It read the code and did not run it.
The change is small and the logic is correct for the main case. One defect remains in the combined message: when the InBody rejection has no string detail, the message starts with the text "None". The reviewer does not need to check anything else for merge.
A maintainer makes the merge decision. This review never approves the pull request.
| fallback_exc.message, | ||
| status_code=fallback_exc.status_code, | ||
| detail=( | ||
| f"{fallback_exc.detail} The client tried the InBody target because " |
There was a problem hiding this comment.
suggestion: Combined detail starts with "None" when the InBody error has no detail
ServiceError.detail is str | None. _http_error_detail returns None when the response detail is not a string. FastAPI validation errors use a list for detail. In that case the InBody 400/422 error has detail=None. The f-string then gives None The client tried the InBody target because .... Only use fallback_exc.detail when it is set. Otherwise start the text at "The client tried ...". The ServiceError.__str__ already omits an empty detail. This is a message defect only, so it does not block the merge.
| ] | ||
|
|
||
|
|
||
| def test_submit_auto_reports_presigned_rejection_when_inbody_is_also_rejected() -> None: |
There was a problem hiding this comment.
suggestion: Test covers only the sync path
The PR changes three call sites: the sync _submit_conversion_job_with_auto_target, AsyncDoclingServiceClient.submit, and process_one in submit_and_retrieve_each. The new test covers only the sync path. The two async copies of the same try/except block have no test. A single async test for submit that uses the same fake would catch a later divergence between the copies.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
When the InBody rejection has no string detail (for example, a FastAPI validation error with a list detail), the combined message started with the text "None". Add the InBody detail only when it is set. Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the changes since fbf2c39204 at bf7d0f8834. It read the code and did not run it.
The update removes the None prefix when the InBody error detail is empty. The reviewer must check that the async error handling matches the sync error handling.
Earlier findings
- fixed (suggestion): Combined detail starts with "None" when the InBody error has no detail
- open (suggestion): Test covers only the sync path
A maintainer makes the merge decision. This review never approves the pull request.
When the server rejects the
presigned_urltarget, the service client falls back to theinbodytarget. If the server also rejectsinbody, the client raised only theinbodyerror and hid the actionable cause (for example, artifact storage is not enabled). This showed up with docling-mcp in remote mode against a deployment that allows onlypresigned_url/storage targets: users saw onlytarget kind 'inbody' is not allowed.The client now keeps both rejections in the error detail, in the sync
submit/convertpath and in both async fallback paths. Fallback errors other than 400/422 (for example usage-limit errors) are raised unchanged.Checklist:
Review evidence:
Task submission failed. (status=422, detail=target kind 'inbody' is not allowed. Allowed values: ['presigned_url', 's3', 'zip'].)... target kind 'inbody' is not allowed. ... The client tried the InBody target because the server rejected the presigned_url target: Presigned URL target requires artifact storage to be configured and enabled on the server.test_submit_auto_reports_presigned_rejection_when_inbody_is_also_rejected.uv run pytest tests/test_service_client_sdk_unit.py tests/test_service_client_fake_service.py: 205 passed.make validatehooks (prek) on the changed files: passed.