fix(e2e): resolve basedpyright errors in logging_client - #32938
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(e2e): resolve basedpyright errors in logging_client#32938cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Two zero-error gate regressions from PR #32857: - completion_response_id relied on json.loads (returns Any) and dict.get on an unnarrowed dict, which triggered reportAny and reportUnknownVariableType. Route the parse through a TypeAdapter[dict[str, object]] so parsed and raw are typed and validation errors funnel through ValidationError. - LangfuseListParams(...) was constructed with the field-name kwargs trace_id and from_start_time, but pydantic's Field alias narrows the generated __init__ to traceId and fromStartTime; basedpyright flagged those calls as reportCallIssue. Pass the aliased names; populate_by_name plus by_alias serialization keep runtime identical. Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
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.
Relevant issues
Linear ticket
Pre-Submission checklist
Screenshots / Proof of Fix
Before this PR the tests/e2e basedpyright gate on
litellm_internal_staging(commit 2c1d62c) fails with 5 errors intests/e2e/logging/logging_client.py, run https://github.com/BerriAI/litellm/actions/runs/29165330210/job/86577351892:After this PR, running
basedpyright tests/e2e/logging/logging_client.pyagainst the same env reports0 errors, 0 warnings, 0 notesType
Bug Fix
Changes
PR #32857 introduced
tests/e2e/logging/logging_client.pyand tripped the tests/e2e zero-error basedpyright gate that landed in #32918. Two independent issues, both scoped to that one filecompletion_response_idfed the request body throughjson.loads, which basedpyright types asAny, and then called.geton the result. UnderreportAnyandreportUnknownVariableType/reportUnknownMemberTypethis surfaces as three errors. Routing the parse through a module-levelTypeAdapter[dict[str, object]]givesparseda concrete type, drops the redundantisinstance(parsed, dict)guard, and swaps the exception path toValidationError(pydantic reraises decode errors through it). Runtime behavior is unchanged; a non-object body or anidthat is not a non-empty string still returnsNonelist_langfuse_observationsconstructedLangfuseListParams(trace_id=..., from_start_time=...), but those fields carryField(alias="traceId"/"fromStartTime"), so pydantic's generated__init__signature only exposes the aliased kwargs; basedpyright'sreportCallIssuecatches the mismatch even thoughpopulate_by_name=Trueaccepts both at runtime. PassingtraceId=/fromStartTime=matches the visible signature. Serialization goes throughparams.model_dump(by_alias=True, exclude_none=True)insidee2e_http.get, so the outbound query string to Langfuse is byte-for-byte identicalNo product code touched; scoped strictly to the e2e client so the gate goes green again on the daily promotion PR (#32884) and future PRs targeting
litellm_internal_staging