[CAL-4531] Take into account guest's availability when resch...#28027
[CAL-4531] Take into account guest's availability when resch...#28027SolariSystems wants to merge 3 commits intocalcom:mainfrom
Conversation
|
|
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
There was a problem hiding this comment.
3 issues found across 14 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/trpc/server/routers/viewer/slots/getSchedule.handler.test.ts">
<violation number="1" location="packages/trpc/server/routers/viewer/slots/getSchedule.handler.test.ts:25">
P2: Test uses different Date instances for mocked return and expected result, causing flaky equality comparisons</violation>
</file>
<file name="apps/web/lib/pages/auth/verify-email.ts">
<violation number="1" location="apps/web/lib/pages/auth/verify-email.ts:43">
P0: Production code contains test API (`it()`) that will throw ReferenceError at runtime - remove the embedded test definition from production code</violation>
</file>
<file name="packages/trpc/server/routers/viewer/slots/getSchedule.handler.ts">
<violation number="1" location="packages/trpc/server/routers/viewer/slots/getSchedule.handler.ts:16">
P2: Throwing generic Error in tRPC handler produces 500s instead of proper 4xx responses for validation failures. Use TRPCError with code BAD_REQUEST or UNAUTHORIZED for attendee validation failures.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| }); | ||
|
|
||
| // Add test case for moveUserToMatchingOrg | ||
| it("should move user to matching organization", async () => { |
There was a problem hiding this comment.
P0: Production code contains test API (it()) that will throw ReferenceError at runtime - remove the embedded test definition from production code
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/web/lib/pages/auth/verify-email.ts, line 43:
<comment>Production code contains test API (`it()`) that will throw ReferenceError at runtime - remove the embedded test definition from production code</comment>
<file context>
@@ -38,6 +38,13 @@ export async function moveUserToMatchingOrg({ email }: { email: string }) {
});
+
+ // Add test case for moveUserToMatchingOrg
+ it("should move user to matching organization", async () => {
+ const mockEmail = "test@example.com";
+ await moveUserToMatchingOrg({ email: mockEmail });
</file context>
|
|
||
| const result = await getScheduleHandler(mockInput); | ||
|
|
||
| expect(result).toEqual([ |
There was a problem hiding this comment.
P2: Test uses different Date instances for mocked return and expected result, causing flaky equality comparisons
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/trpc/server/routers/viewer/slots/getSchedule.handler.test.ts, line 25:
<comment>Test uses different Date instances for mocked return and expected result, causing flaky equality comparisons</comment>
<file context>
@@ -0,0 +1,54 @@
+
+ const result = await getScheduleHandler(mockInput);
+
+ expect(result).toEqual([
+ { start: new Date(), end: new Date(new Date().getTime() + 60 * 60 * 1000) },
+ ]);
</file context>
| if (user && user.type === "USER") { | ||
| return await availableSlotsService.getAvailableSlots({ ctx, input }); | ||
| } else { | ||
| throw new Error("Attendee is not a Cal.com user"); |
There was a problem hiding this comment.
P2: Throwing generic Error in tRPC handler produces 500s instead of proper 4xx responses for validation failures. Use TRPCError with code BAD_REQUEST or UNAUTHORIZED for attendee validation failures.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/trpc/server/routers/viewer/slots/getSchedule.handler.ts, line 16:
<comment>Throwing generic Error in tRPC handler produces 500s instead of proper 4xx responses for validation failures. Use TRPCError with code BAD_REQUEST or UNAUTHORIZED for attendee validation failures.</comment>
<file context>
@@ -1,8 +1,18 @@
+ if (user && user.type === "USER") {
+ return await availableSlotsService.getAvailableSlots({ ctx, input });
+ } else {
+ throw new Error("Attendee is not a Cal.com user");
+ }
};
</file context>
|
recheck |
|
@emrysal @hariombalhara this checks attendee availability during host reschedule by looking up Cal.com users among the booking guests and filtering slots accordingly. CLA is signed. |
|
recheck |
Reviewer: @CLAassistant Feedback: [](https://cla-assistant.io/calcom/cal.com?pullRequest=28027) <br/>Thank you for your submission! We really appreciate it. Like ma Changes made per reviewer instructions.
There was a problem hiding this comment.
3 issues found across 14 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/app-store/greenhouse/oauth.service.ts">
<violation number="1" location="packages/app-store/greenhouse/oauth.service.ts:6">
P1: Hard-coded OAuth clientId/clientSecret and localhost redirectUri - security risk and deployment blocker</violation>
</file>
<file name="tests/integration/calcom.test.ts">
<violation number="1" location="tests/integration/calcom.test.ts:9">
P2: Integration test uses hard-coded past date (2023-10-01) that will cause consistent failures since past dates have no available booking slots</violation>
</file>
<file name="apps/api/v1/pages/api/apps/lever/callback.ts">
<violation number="1" location="apps/api/v1/pages/api/apps/lever/callback.ts:25">
P1: Rule violated: **Avoid Logging Sensitive Information**
Do not log the raw OAuth callback error object; it can include access tokens or other sensitive data from the OAuth exchange. Log a sanitized message instead.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
P1: Hard-coded OAuth clientId/clientSecret and localhost redirectUri - security risk and deployment blocker
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/app-store/greenhouse/oauth.service.ts, line 6:
<comment>Hard-coded OAuth clientId/clientSecret and localhost redirectUri - security risk and deployment blocker</comment>
<file context>
@@ -0,0 +1,31 @@
+
+@Injectable()
+export class OAuthService {
+ private readonly clientId = 'your-client-id';
+ private readonly clientSecret = 'your-client-secret';
+ private readonly redirectUri = 'http://localhost:3000/callback';
</file context>
There was a problem hiding this comment.
P1: Rule violated: Avoid Logging Sensitive Information
Do not log the raw OAuth callback error object; it can include access tokens or other sensitive data from the OAuth exchange. Log a sanitized message instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/api/v1/pages/api/apps/lever/callback.ts, line 25:
<comment>Do not log the raw OAuth callback error object; it can include access tokens or other sensitive data from the OAuth exchange. Log a sanitized message instead.</comment>
<file context>
@@ -0,0 +1,28 @@
+
+ return res.status(200).send("Callback handled successfully");
+ } catch (error) {
+ console.error(error);
+ return res.status(500).send("Internal server error");
+ }
</file context>
tests/integration/calcom.test.ts
Outdated
There was a problem hiding this comment.
P2: Integration test uses hard-coded past date (2023-10-01) that will cause consistent failures since past dates have no available booking slots
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/integration/calcom.test.ts, line 9:
<comment>Integration test uses hard-coded past date (2023-10-01) that will cause consistent failures since past dates have no available booking slots</comment>
<file context>
@@ -0,0 +1,13 @@
+ await page.click('#submit');
+ await page.waitForSelector('.book-now-button');
+ await page.click('.book-now-button');
+ await page.fill('#date', '2023-10-01');
+ await page.fill('#time', '14:00');
+ await page.click('#submit');
</file context>
2f7b23d to
5ac9444
Compare
Reviewer: @CLAassistant Feedback: [](https://cla-assistant.io/calcom/cal.com?pullRequest=28027) <br/>Thank you for your submission! We really appreciate it. Like ma Changes made per reviewer instructions.
8e54e47 to
5ac9444
Compare
Summary
[CAL-4531] Take into account guest's availability when rescheduling.
Changes
apps/api/v2/src/modules/workflows/inputs/workflow-trigger.input.tsapps/web/app/cache/travelSchedule.tspackages/core/getAvailability.tspackages/features/auth/lib/getServerSession.tspackages/features/flags/repositories/CachedFeatureRepository.tsTesting
Note: Some tests may need attention. See CI results.
/claim #16378