Skip to content

[CAL-4531] Take into account guest's availability when resch...#28074

Open
SolariSystems wants to merge 3 commits intocalcom:mainfrom
SolariSystems:bounty/SBR_calcom_cal.com_16378
Open

[CAL-4531] Take into account guest's availability when resch...#28074
SolariSystems wants to merge 3 commits intocalcom:mainfrom
SolariSystems:bounty/SBR_calcom_cal.com_16378

Conversation

@SolariSystems
Copy link

Summary

[CAL-4531] Take into account guest's availability when rescheduling.

Testing

Note: Some tests may need attention. See CI results.

/claim #16378


Resolves: #16378

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions bot added $200 bookings area: bookings, availability, timezones, double booking Medium priority Created by Linear-GitHub Sync ✨ feature New feature or request 💎 Bounty A bounty on Algora.io 🧹 Improvements Improvements to existing features. Mostly UX/UI labels Feb 19, 2026
@github-actions
Copy link
Contributor

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:

No release type found in pull request title "[CAL-4531] Take into account guest's availability when resch...". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Feb 19, 2026
@graphite-app
Copy link

graphite-app bot commented Feb 19, 2026

Graphite Automations

"Send notification to Community team when bounty PR opened" took an action on this PR • (02/19/26)

2 teammates were notified to this PR based on Keith Williams's automation.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 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="apps/web/lib/pages/auth/verify-email.ts">

<violation number="1" location="apps/web/lib/pages/auth/verify-email.ts:43">
P1: Test `it(...)` block was inserted into production runtime code, causing a ReferenceError (and recursive call) whenever `moveUserToMatchingOrg` runs.</violation>
</file>

<file name="apps/web/pages/reschedule/[uid].tsx">

<violation number="1" location="apps/web/pages/reschedule/[uid].tsx:10">
P2: pages/reschedule/[uid].tsx does not default export a React component. Next.js requires a default export for every file under pages/, so this route will fail to build or render.</violation>
</file>

<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:17">
P3: Test is flaky because expected Date objects are created separately from the mocked response; millisecond differences will make toEqual fail.</violation>
</file>

<file name="packages/platform/constants/api.ts">

<violation number="1" location="packages/platform/constants/api.ts:4">
P2: The availability endpoint constant was changed to "availability", but server routes still expose schedules under /v2/schedules and client hooks build paths from this constant. This will make availability requests hit /availability instead of /schedules, causing 404s unless the server routes were updated in tandem.</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: Access-denied branch throws a generic Error instead of a TRPCError with UNAUTHORIZED, which will surface as INTERNAL_SERVER_ERROR/500 and inconsistent error shape for tRPC clients.</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 () => {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Test it(...) block was inserted into production runtime code, causing a ReferenceError (and recursive call) whenever moveUserToMatchingOrg runs.

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>Test `it(...)` block was inserted into production runtime code, causing a ReferenceError (and recursive call) whenever `moveUserToMatchingOrg` runs.</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>
Fix with Cubic

@@ -0,0 +1,13 @@
import User from "@prisma/client"; // Add this line
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: pages/reschedule/[uid].tsx does not default export a React component. Next.js requires a default export for every file under pages/, so this route will fail to build or render.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/web/pages/reschedule/[uid].tsx, line 10:

<comment>pages/reschedule/[uid].tsx does not default export a React component. Next.js requires a default export for every file under pages/, so this route will fail to build or render.</comment>

<file context>
@@ -0,0 +1,13 @@
+
+import type { GetScheduleOptions } from "./types";
+
+export const getScheduleHandler = async ({ ctx, input }: GetScheduleOptions) => {
+  const availableSlotsService = getAvailableSlotsService();
+  return await availableSlotsService.getAvailableSlots({ ctx, input });
</file context>
Fix with Cubic

export const V2_ENDPOINTS = {
me: "me",
availability: "schedules",
availability: "availability",
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The availability endpoint constant was changed to "availability", but server routes still expose schedules under /v2/schedules and client hooks build paths from this constant. This will make availability requests hit /availability instead of /schedules, causing 404s unless the server routes were updated in tandem.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/platform/constants/api.ts, line 4:

<comment>The availability endpoint constant was changed to "availability", but server routes still expose schedules under /v2/schedules and client hooks build paths from this constant. This will make availability requests hit /availability instead of /schedules, causing 404s unless the server routes were updated in tandem.</comment>

<file context>
@@ -1,9 +1,10 @@
 export const V2_ENDPOINTS = {
   me: "me",
-  availability: "schedules",
+  availability: "availability",
   eventTypes: "event-types",
   bookings: "bookings",
</file context>
Suggested change
availability: "availability",
availability: "schedules",
Fix with Cubic

if (user && user.type === "USER") {
return await availableSlotsService.getAvailableSlots({ ctx, input });
} else {
throw new Error("Attendee is not a Cal.com user");
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Access-denied branch throws a generic Error instead of a TRPCError with UNAUTHORIZED, which will surface as INTERNAL_SERVER_ERROR/500 and inconsistent error shape for tRPC clients.

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>Access-denied branch throws a generic Error instead of a TRPCError with UNAUTHORIZED, which will surface as INTERNAL_SERVER_ERROR/500 and inconsistent error shape for tRPC clients.</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>
Fix with Cubic


const mockAvailableSlotsService = {
getAvailableSlots: jest.fn().mockResolvedValue([
{ start: new Date(), end: new Date(new Date().getTime() + 60 * 60 * 1000) },
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Test is flaky because expected Date objects are created separately from the mocked response; millisecond differences will make toEqual fail.

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 17:

<comment>Test is flaky because expected Date objects are created separately from the mocked response; millisecond differences will make toEqual fail.</comment>

<file context>
@@ -0,0 +1,54 @@
+
+    const mockAvailableSlotsService = {
+      getAvailableSlots: jest.fn().mockResolvedValue([
+        { start: new Date(), end: new Date(new Date().getTime() + 60 * 60 * 1000) },
+      ]),
+    };
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bookings area: bookings, availability, timezones, double booking 🙋 Bounty claim 💎 Bounty A bounty on Algora.io community Created by Linear-GitHub Sync ✨ feature New feature or request 🧹 Improvements Improvements to existing features. Mostly UX/UI Medium priority Created by Linear-GitHub Sync size/L $200

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-4531] Take into account guest's availability when rescheduling

2 participants

Comments