Repository navigation
test(logging): pick this test's own records out of the shared log batch - #41487
Merged
Merged
Conversation
The generic API logger batches whatever is queued when it flushes, so records from tests in other files in the same job land in the same request. Two tests assumed otherwise: one read actual_request[0], the other counted NDJSON lines, and both broke whenever another file logged first. Select by the messages each test sent instead, which keeps the format assertions and stops the order from deciding the outcome.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Greptile SummaryThe PR updates two logging tests to select their own records from shared batches by matching request messages
Confidence Score: 5/5The PR appears safe to merge, with the previous annotation finding fully addressed and no new blocking issues The latest changes only add a supported typing import, local annotations, and formatting. The previous finding is fully fixed, and no additional repository-rule violations were identified Important Files Changed
Reviews (2): Last reviewed commit: "style(test): annotate the new locals as ..." | Re-trigger Greptile |
Contributor
Author
yucheng-berri
approved these changes
Sep 16, 2026
yuneng-berri
enabled auto-merge
September 16, 2026 22:57
This was referenced Sep 17, 2026
Merged
7 tasks done
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
TLDR
Problem this solves:
How it solves it:
User Flow
This is a test-only change. No runtime behavior changes, so there is no end user flow to describe
Relevant issues
Affected release
Linear ticket
Pre-Submission checklist
Screenshots / Proof of Fix
This PR only touches a test file, so there is nothing to exercise against a live proxy: runtime behavior is identical before and after. The bug is ordering inside one pytest process, so the proof is the contaminated order going red to green, plus a mutation check that the relaxed assertions still bite
The logging_testing job runs every file under tests/logging_callback_tests in one process, so a file that logs before these tests leaves records in the generic logger's queue. test_bedrock_knowledgebase_hook.py is one such file
Before (4bf04b2)
contaminated order: an extra failure appears in the generic file
uv run pytest tests/logging_callback_tests/test_bedrock_knowledgebase_hook.py tests/logging_callback_tests/test_generic_api_callback.py -qon CI the leak landed on the sibling test instead
The test only ever called gpt-5.5, so the claude-3.5-sonnet records came from another file
After (baca62d)
contaminated order: the generic file no longer contributes a failure
uv run pytest tests/logging_callback_tests/test_bedrock_knowledgebase_hook.py tests/logging_callback_tests/test_generic_api_callback.py -qthe generic file on its own
uv run pytest tests/logging_callback_tests/test_generic_api_callback.py -qthe relaxed assertions still catch a dropped record
data = "\n".join(safe_dumps(log) for log in self.log_queue)toself.log_queue[:1]inlitellm/integrations/generic_api/generic_api_callback.pyuv run pytest tests/logging_callback_tests/test_generic_api_callback.py -qType
✅ Test
Caveats (if any)
Low
Final Attestation