GLM-5.3 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 Opus 5.5.

Gold bugs found
1 of 3
Comments published
2
Comments matching a bug
1
Comments not matching
1
Cost of this PR
$0.206

Published comments (2)

mediumbugpackages/lib/server/service/insightsBooking.ts:29-34

Public options type marks teamId optional, but schema requires it for scope "team" — A call site omitting `teamId` for scope "team" now type-checks but fails `insightsBookingServiceOptionsSchema` validation at runtime, silently degrading to empty results instead of a compile-time error. Split `InsightsBookingServicePublicOptions` into a discriminated union so `scope: "team"` requires `teamId`.

mediumbugpackages/lib/server/service/__tests__/insightsBooking.integration-test.ts:295-299

toEqual on composed Prisma.Sql compares internals, not rendered SQL — These assertions can never pass: `toEqual` deep-compares `Prisma.Sql` internals (`strings`/`values`), and fragments composed by `buildTeamAuthorizationCondition` keep nested `Sql` objects inside `values`, never matching the flat literal template. Build the expectation with the same composition the service performs, or assert on `conditions.sql`. **Also found in:** - `packages/lib/server/service/__tests__/insightsBooking.integration-test.ts:332-343` - `packages/lib/server/service/__tests__/insightsBooking.integration-test.ts:429-431`

Gold bugs found (1)

mediumThe new public options type makes teamId optional for team scope, so a missing teamId compiles and silently yields empty insights instead of a type error.

Gold bugs missed (2)

mediumThe getBaseConditions test uses a single booking matching both auth and filter conditions, so it would pass even if the conditions were not combined.
highClaims getBaseConditions returns OR fragments without parentheses, so a caller appending `AND <extra>` would leak rows outside the authorization scope.