GLM-5.3 · Balanced

feat-convert-insightsbookingservice-to-use-prisma-sql-raw-queries-cal-com

cal.com · TypeScript · M · 100–299 lines · 1 files

The normal review, with one generalist agent. Judge: Claude Haiku 5.5.

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

Published comments (1)

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

Multi-condition Prisma.sql assertions fail against flat expected templates — Because `Prisma.sql` only flattens nested fragments when a query compiles, the results of `buildTeamAuthorizationCondition`, `buildOrgAuthorizationCondition`, and `buildFilterConditions` never `toEqual` the flat expected templates, failing these tests in CI. Have each builder emit a single flat template, like the user-scope branch, or assert on the compiled query instead.

Gold bugs found (0)

None.

Gold bugs missed (3)

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