Skip to content

Conversation

@tomerqodo
Copy link

Benchmark PR from qodo-benchmark#716

@augmentcode
Copy link

augmentcode bot commented Jan 22, 2026

🤖 Augment PR Summary

Summary: Refactors the platform @calcom/atoms package to avoid direct dependencies on @calcom/trpc/server types.

Changes:

  • Replaced tRPC server type/schema imports in atoms hooks with locally-defined schedule/slot types.
  • Added atoms-local schedule types (and a basic input validator) and expanded booker types to include available-slot response shapes.
  • Updated tests to import slot types from @calcom/atoms/booker/types instead of tRPC.
  • Tightened lint/tsconfig constraints to prevent atoms from importing from @calcom/trpc.

Technical Note: This keeps atoms decoupled from server-only tRPC modules while preserving type coverage for the REST endpoints it calls.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 4 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.


export type Slot = {
time: string;
userIds?: string[];
Copy link

Choose a reason for hiding this comment

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

Slot.userIds is typed as string[], but the previous tRPC Slot type and other slot-related code paths use numeric user IDs (number[]). This mismatch can cause downstream type errors or incorrect assumptions when consuming onTimeslotsLoaded data.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

bookingUid?: string;
away?: boolean;
fromUser?: {
id: string;
Copy link

Choose a reason for hiding this comment

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

SlotInfo.fromUser.id is typed as string, but the shared availability types (IFromUser) use a numeric id: number. If the API returns numbers here, this will mis-type the response for any consumers that rely on fromUser.id.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

id: number;
userId: number | null;
eventTypeId: number | null;
days: string[];
Copy link

Choose a reason for hiding this comment

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

availability.days is typed as string[], but the atoms /schedules/all endpoint delegates to the tRPC availability list handler which returns numeric weekday indices (number[]) from Prisma. This mismatch can break consumers like getScheduleListItemData/ScheduleListItem that expect number[].

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

throw new Error('Invalid input: name must be a non-empty string');
}

return data as CreateScheduleInput;
Copy link

Choose a reason for hiding this comment

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

validateCreateScheduleInput only validates name and then casts the entire object to CreateScheduleInput, so invalid schedule/eventTypeId shapes can still pass. This function name suggests full validation, so callers may get a false sense of safety.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants