Skip to content

fix(e2e): resolve basedpyright errors in logging_client - #32938

Draft
cursor[bot] wants to merge 1 commit into
litellm_internal_stagingfrom
cursor/ci-autofix-automation-5ab5
Draft

fix(e2e): resolve basedpyright errors in logging_client#32938
cursor[bot] wants to merge 1 commit into
litellm_internal_stagingfrom
cursor/ci-autofix-automation-5ab5

Conversation

@cursor

@cursor cursor Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Relevant issues

Linear ticket

Pre-Submission checklist

  • My PR's scope is as isolated as possible; it only solves 1 specific problem

Screenshots / Proof of Fix

Before this PR the tests/e2e basedpyright gate on litellm_internal_staging (commit 2c1d62c) fails with 5 errors in tests/e2e/logging/logging_client.py, run https://github.com/BerriAI/litellm/actions/runs/29165330210/job/86577351892:

tests/e2e/logging/logging_client.py:208:9 - error: Type of "parsed" is Any (reportAny)
tests/e2e/logging/logging_client.py:213:5 - error: Type of "raw" is partially unknown (reportUnknownVariableType)
tests/e2e/logging/logging_client.py:213:11 - error: Type of "get" is partially unknown (reportUnknownMemberType)
tests/e2e/logging/logging_client.py:502:17 - error: No parameter named "trace_id" (reportCallIssue)
tests/e2e/logging/logging_client.py:504:17 - error: No parameter named "from_start_time" (reportCallIssue)
5 errors, 0 warnings, 0 notes

After this PR, running basedpyright tests/e2e/logging/logging_client.py against the same env reports 0 errors, 0 warnings, 0 notes

Type

Bug Fix

Changes

PR #32857 introduced tests/e2e/logging/logging_client.py and tripped the tests/e2e zero-error basedpyright gate that landed in #32918. Two independent issues, both scoped to that one file

completion_response_id fed the request body through json.loads, which basedpyright types as Any, and then called .get on the result. Under reportAny and reportUnknownVariableType/reportUnknownMemberType this surfaces as three errors. Routing the parse through a module-level TypeAdapter[dict[str, object]] gives parsed a concrete type, drops the redundant isinstance(parsed, dict) guard, and swaps the exception path to ValidationError (pydantic reraises decode errors through it). Runtime behavior is unchanged; a non-object body or an id that is not a non-empty string still returns None

list_langfuse_observations constructed LangfuseListParams(trace_id=..., from_start_time=...), but those fields carry Field(alias="traceId"/"fromStartTime"), so pydantic's generated __init__ signature only exposes the aliased kwargs; basedpyright's reportCallIssue catches the mismatch even though populate_by_name=True accepts both at runtime. Passing traceId=/fromStartTime= matches the visible signature. Serialization goes through params.model_dump(by_alias=True, exclude_none=True) inside e2e_http.get, so the outbound query string to Langfuse is byte-for-byte identical

No 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

Open in Web View Automation 

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>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing cursor/ci-autofix-automation-5ab5 (3d829e4) with litellm_internal_staging (2e45fc5)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants