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

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

Published comments (1)

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

teamId missing from required fields in InsightsBookingServicePublicOptions union — Callers passing `scope: "team"` without `teamId` still type-check, but `insightsBookingServiceOptionsSchema` rejects them, silently nulling `this.options` so queries degrade to `NOTHING_CONDITION` and return zero rows with no error. Make `teamId` required on `InsightsBookingServicePublicOptions`, or raise validation failures explicitly in the constructor.

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.