-
Notifications
You must be signed in to change notification settings - Fork 10
fix(client): raise on an already-failed Storage job instead of returning it #603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
96c3e5a
test(client): pin the shared Storage-job poller's contract
martinsifra 8ecf99d
fix(client): evaluate a Storage job's terminal state in one place
martinsifra e719d5a
docs(client): name every verb that enqueues a Storage job
martinsifra af9a790
docs(test): correct the poller's call-site count to 19 (16/2/1)
martinsifra 09876bf
fix(client): address review -- changelog 0.84.3, pinned poll counts, …
martinsifra 992f995
fix(client): tolerate a non-dict `error` on a failed Storage job
martinsifra 5e1d6bd
test(client): cover the explicit-null `error` body; tidy the gotcha h…
padak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Error extraction still assumes
erroris a dictjob.get("error", {}).get("message", ...)raisesAttributeErrorif the Storage API returnserroras a plain string (the Query-Service poller in this package explicitly handles both shapes — see_extract_query_errortests intests/test_client.py). Pre-existing, but the fix now makes this path reachable from the initial response body too, so a fast-fail whoseerroris a string would surface as an unhandled AttributeError rather thanSTORAGE_JOB_FAILED. Worth a one-line tolerance check while the code is being touched.(Refers to lines 237-243)
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed and fixed in 992f995 — thanks, this one was real, not theoretical.
Reproduced the exact failure first:
And your framing of the reachability is right: pre-existing, but the restructure means the terminal check now also sees the caller's initial response body, so the shape can arrive from one more direction than before.
Worth adding to the case you made — the field is demonstrably not reliably a dict in this repo's own history, not just in principle. Three precedents:
queue.py:250isinstance-guards its ownresultbefore.get("message")._extract_query_job_error(_transfer.py:152) is a documented helper for "strings, dicts and unknown shapes".{"error": 422}— an int — and the CLI renderedAPI error 422: 422. That cost a released bugfix, which is whyBaseHttpClient._raise_api_errornow acceptserroronly when it is a non-empty string._core.pywas the last place reading it bare.One deliberate deviation from the nearest precedent: the queue poller falls back to generic text when
resultis not a dict, which discards a string error's content. I followed_extract_query_job_errorinstead and use a stringerroras the message — it is the more useful of the two, and losing the operator's only diagnostic text to a type check would be its own small bug. Extracted as_storage_job_error_messagewith the reasoning in its docstring so nobody "simplifies" it back.A dict with no usable message, an int, a list, or a missing field all fall back to
"Storage job failed"rather than renderingNoneor a raw repr. Two tests cover it (the string shape, plus five unusable variants), and the 0.84.3 changelog bullet now mentions the hardening.make check: 5755 passed, 12 skipped.