Skip to content

ci(lint): generate prisma client before basedpyright type check - #31660

Closed
ryan-crabbe-berri wants to merge 1 commit into
litellm_internal_stagingfrom
litellm_ci_prisma_generate_typecheck
Closed

ci(lint): generate prisma client before basedpyright type check#31660
ryan-crabbe-berri wants to merge 1 commit into
litellm_internal_stagingfrom
litellm_ci_prisma_generate_typecheck

Conversation

@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor

Relevant issues

Follow-up from review feedback on #31227 asking why a # pyright: ignore was needed on from prisma import Json

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

The lint workflow installs prisma but never generates the client, so basedpyright type-checks against an ungenerated package where client.py, models.py and fields.py do not exist (they are emitted by prisma generate, not shipped by pip). With the client absent, from prisma import Json resolves to nothing:

$ # generated client removed to mirror the CI environment
$ printf 'from prisma import Json\nx = Json(False)\n' > /tmp/probe.py
$ basedpyright /tmp/probe.py
reportAttributeAccessIssue  "Json" is unknown import symbol
reportUnknownVariableType   Type of "Json" is unknown

After prisma generate --schema litellm/proxy/schema.prisma, the same import resolves cleanly:

$ prisma generate --schema litellm/proxy/schema.prisma
$ basedpyright /tmp/probe.py
0 errors, 0 warnings, 0 notes

The generate step here matches what test-unit-proxy-legacy.yml, mutation-test.yml and the Docker images already do, and the basedpyright budget gate is unaffected: the per-rule deltas from generating the client are tiny (a handful fewer unknown-symbol errors) and the gate compares head against base, both of which now run with the same generated client.

Type

🚄 Infrastructure

Changes

Generate the prisma client in the lint workflow before the basedpyright budget gate so the type check sees prisma's real types instead of treating every prisma import as an unknown symbol. This is the root cause behind needing pyright ignores on prisma imports; with the client generated those ignores are no longer required

The lint workflow type-checks against an ungenerated prisma package, so
prisma's real types (the generated client, models and fields, including
Json) are absent and basedpyright treats every 'from prisma import ...'
as an unknown symbol. Generate the client first so the type check runs
against the same prisma types that ship in Docker and run at runtime,
matching the generate step the other CI workflows already perform.
@ryan-crabbe-berri
ryan-crabbe-berri requested a review from a team June 30, 2026 00:43
@greptile-apps

greptile-apps Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates the lint workflow so basedpyright sees the generated Prisma client. The main changes are:

  • Adds prisma generate --schema litellm/proxy/schema.prisma after dependency installation.
  • Runs Prisma generation before the basedpyright budget gate.
  • Keeps the change isolated to .github/workflows/test-linting.yml.

Confidence Score: 5/5

The workflow change is narrowly scoped and aligns the lint job with existing Prisma generation usage elsewhere in the project.

Only the lint workflow is modified, and the added generation step directly supports the described type-checking path without changing application runtime behavior.

T-Rex T-Rex Logs

What T-Rex did

  • The initial workflow log shows a failure path where the process jumped from Print OpenAI version to the Check basedpyright budget, with basedpyright reporting Type of "Json" is unknown and Type of "x" is unknown, exiting with code 1.
  • The updated workflow adds a Generate Prisma client step before the basedpyright budget gate, invoking uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma.
  • Prisma generation now exits with code 0.
  • Basedpyright diagnostics are empty after the change.
  • The probe exits with code 0 after the change.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "ci(lint): generate prisma client before ..." | Re-trigger Greptile

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ryan-crabbe-berri

ryan-crabbe-berri commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

we are not losing type safety by skipping prisma generate in CI. The DB calls already go through PrismaWrapper.getattr -> Any, so prisma's generated types have nowhere to land regardless. The only honest way to recover that type safety is to type those wrappers against the generated client, which is a separate refactor. The pyright ignore on the count branch is correct as-is, for the reason now documented in the close comment.

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.

1 participant