ci(lint): generate prisma client before basedpyright type check - #31660
ci(lint): generate prisma client before basedpyright type check#31660ryan-crabbe-berri wants to merge 1 commit into
Conversation
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.
Greptile SummaryThis PR updates the lint workflow so basedpyright sees the generated Prisma client. The main changes are:
Confidence Score: 5/5The 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.
What T-Rex did
Reviews (1): Last reviewed commit: "ci(lint): generate prisma client before ..." | Re-trigger Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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. |
Relevant issues
Follow-up from review feedback on #31227 asking why a
# pyright: ignorewas needed onfrom prisma import JsonLinear ticket
Pre-Submission checklist
@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewScreenshots / 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.pyandfields.pydo not exist (they are emitted byprisma generate, not shipped by pip). With the client absent,from prisma import Jsonresolves to nothing:After
prisma generate --schema litellm/proxy/schema.prisma, the same import resolves cleanly:The generate step here matches what
test-unit-proxy-legacy.yml,mutation-test.ymland 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