Repository navigation
test(utils): raise the post-success hook error from a guardrail in the failure-hook regression - #42646
Conversation
…e failure-hook regression Since #42535 a plain logger raising inside async_post_call_success_deployment_hook is logged and the completed request returns, so the regression added by #36657 for "a post-success error never reaches async_post_call_failure_deployment_hook" failed with DID NOT RAISE on every main run once #42603 revived the misc unit shard. The raising callback is now a CustomGuardrail, the one kind of callback whose post-success raise still propagates, which keeps the original assertions intact
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 17b9dd3. Configure here.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
TLDR
Problem this solves:
misc / Run testscheck fails on every run since fix(utils): isolate callback errors in async_post_call_success_deployment_hook #42535How it solves it:
User Flow
Before: a contributor opening a PR into main sees the required
misc / Run testscheck fail on a test they never touched, on every pushmisc / Run testsfrom test-unit.yml turns red while the other shards go greenFAILED tests/test_litellm/test_utils.py::test_wrapper_async_does_not_fire_failure_hook_for_post_success_error - Failed: DID NOT RAISE <class 'RuntimeError'>and1 failed, 6532 passed, 25 skippedAfter: the same contributor's PR gets a green
misc / Run testscheckmisc / Run testsfrom test-unit.yml goes green with the other shardsRelevant issues
No linked issue. Follow-up to #42535, which changed the behavior the test expected, and #42603, which brought the misc shard back so the stale test ran again
Affected release
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Shared setup: a fresh worktree at the named commit with
make bootstrap, then the one test main's misc shard fails onBefore (1953603)
E Failed: DID NOT RAISE <class 'RuntimeError'>, thenFAILED tests/test_litellm/test_utils.py::test_wrapper_async_does_not_fire_failure_hook_for_post_success_errorand1 failed, 76 warnings in 6.81smisc / Run testsat this commit, https://github.com/BerriAI/litellm/actions/runs/35806170176/job/107007408694:2 workers [6558 items], then1 failed, 6532 passed, 25 skipped, 509 warnings, 2 rerun in 391.64sAfter (17b9dd3)
1 passed, 76 warnings in 0.59suv run pytest tests/test_litellm/test_utils.py -k "success_deployment_hook or failure_hook_for" -p no:cacheprovider --no-cov:15 passed, 380 deselected(was1 failed, 14 passedat the merge base)Left contains one more item: RuntimeError('boom in success hook, model call itself succeeded')Failed: DID NOT RAISE <class 'RuntimeError'>misc / Run testsjob, https://github.com/BerriAI/litellm/actions/runs/35808610579/job/107015265898:2 workers [6588 items]then6563 passed, 25 skipped, 509 warnings in 442.80s(main's run 107007408694 had1 failedon 6558 items)Type
✅ Test
Caveats (if any)
Low
acompletionwrapper here; a plain logger's isolated error is covered by fix(utils): isolate callback errors in async_post_call_success_deployment_hook #42535's direct hook testsmisc / Run testsshard, not a live-proxy A/B: the PR ships no runtime files, so the shard is the only surface that changesFinal Attestation
The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
17b9dd3 passes /live-pr-risk