DeepSeek V4 Pro · Balanced
oauth-credential-sync-and-app-integration-enhancements-cal-com
cal.com · TypeScript · M · 100–299 lines · 6 files
The normal review, with one generalist agent. Judge: Claude Opus 5.5.
- Gold bugs found
- 7 of 19
- Comments published
- 7
- Comments matching a bug
- 7
- Comments not matching
- 0
- Cost of this PR
- $0.624
Published comments (7)
Use app.dirName for appStoreMetadata lookup — The lookup returns `undefined` and the webhook 404s for any app whose slug differs from its directory name. Query and index by `app.dirName` to match `_appRegistry.ts`.
Token refresh persists safeParse envelope instead of parsed credentials — The full `safeParse` envelope is persisted, so the next `googleCredentialSchema.parse(credential.key)` fails. Store the `.data` property of `parseRefreshTokenResponse` instead.
Microsoft refresh overwrites refresh token with placeholder — The placeholder `"refresh_token"` overwrites the real token, breaking every subsequent refresh. Preserve `o365AuthCredentials.refresh_token` as the final spread property.
minimumTokenResponseSchema's computed keys collapse to the same string — Both computed keys collapse to `"[object Object]"`, so the expiry field is neither validated nor retained. Use `.passthrough()` on an object with `access_token` to preserve the actual properties.
Sync path returns raw fetch Response instead of caller expected token shape — The raw `fetch` Response leaks into callers that expect the same shape as the non-sync path, causing `undefined` reads and runtime errors in Google, Hubspot, and zoho. Parse and normalize the sync response to match the refresh-function result.
refreshOAuthTokens receives credential id instead of user id — The sync endpoint receives a credential row id, not the user id every other provider sends. Pass `credential.userId` instead of `credentialId`.
Unconditional Salesforce token refresh discards refreshed token and writes DB — This unconditionally refreshes and writes to the DB on every service construction, but the returned connection still uses the stale token and the refreshed value is discarded. Only refresh when the stored token is expired, or use the newly fetched token.