@computed fields from mixin types (with) cause column does not exist error when the model is explicitly included#2539
Conversation
📝 WalkthroughWalkthroughAdds a new Vitest end-to-end test that verifies a computed field inherited via a mixin ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/e2e/orm/client-api/computed-field-nested-include.test.ts (1)
60-60: Prefer typed validation overas anyto maintain type-safety in this regression test.Line 60 suppresses compiler checks that could catch future API/schema drift. The options object should use
satisfiesto validate against the function signature while preserving flexibility with string schemas:♻️ Suggested refactor
- } as any, + } satisfies Parameters<typeof createTestClient>[1],🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/e2e/orm/client-api/computed-field-nested-include.test.ts` at line 60, The test currently uses an unsafe cast ("as any") for the options object; replace that cast with TypeScript's "satisfies" operator to validate the object against the real API parameter type (for example the parameter type of the client function under test, e.g. Parameters<typeof <clientFunction>>[0] or the exported options type from the API), so the literal keeps flexible string-schema values but still gets compile-time validation; locate the options object in computed-field-nested-include.test.ts and change the "as any" to a "satisfies <expected parameter type>" check (import or reference the appropriate function/type used by the test).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/e2e/orm/client-api/computed-field-nested-include.test.ts`:
- Line 60: The test currently uses an unsafe cast ("as any") for the options
object; replace that cast with TypeScript's "satisfies" operator to validate the
object against the real API parameter type (for example the parameter type of
the client function under test, e.g. Parameters<typeof <clientFunction>>[0] or
the exported options type from the API), so the literal keeps flexible
string-schema values but still gets compile-time validation; locate the options
object in computed-field-nested-include.test.ts and change the "as any" to a
"satisfies <expected parameter type>" check (import or reference the appropriate
function/type used by the test).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3260908e-0086-4ab1-91a3-d57d0a4b7523
📒 Files selected for processing (1)
tests/e2e/orm/client-api/computed-field-nested-include.test.ts
9e94d09 to
2abea97
Compare
failing test to illustrate #2540
Summary by CodeRabbit