DeepSeek V4.1 Flash · Heavy
feat-convert-insightsbookingservice-to-use-prisma-sql-raw-queries-cal-com
cal.com · TypeScript · M · 100–299 lines · 1 files
The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Haiku 5.5.
- Gold bugs found
- 1 of 3
- Comments published
- 4
- Comments matching a bug
- 1
- Comments not matching
- 3
- Cost of this PR
- $0.273
Published comments (4)
Public options type makes teamId optional, losing compile-time safety — A `team`-scope call that omits `teamId` now compiles and silently returns zero rows via `insightsBookingServiceOptionsSchema.safeParse`. Keep the constructor parameter typed as `InsightsBookingServiceOptions` and make `teamId` required for the `team` variant.
Org-scope test assertion depends on unordered array order — `TeamRepository.findAllByParentId` and `MembershipRepository.findAllByTeamIds` use no `orderBy`, so Postgres can return rows in any order and this assertion flaps. Assert the `teamIds` and `userIds` arrays order-independently, or add `orderBy` to the repositories.
Restore deleted caching tests for authorization and filter conditions — Deleting this block leaves no test that calls `getAuthorizationConditions()` or `getFilterConditions()` twice, so a broken memoization in `cachedAuthConditions` or `cachedFilterConditions` would pass CI. Restore both tests against the new `Prisma.Sql` return type.
Prisma.sql assertions compare internal structure instead of SQL — `toEqual` against a `Prisma.sql` template deep-compares the internal `strings`/`values` arrays, and the nested `conditions.reduce` templates partition `strings` differently, so the assertion can mismatch. Compare `conditions.sql` and `conditions.values` instead. **Also found in:** - `packages/lib/server/service/__tests__/insightsBooking.integration-test.ts:429-431`