Skip to content

Conversation

@anikdhabal
Copy link
Contributor

@anikdhabal anikdhabal commented Dec 15, 2025

What does this PR do?

Refactored CalEventParser to use narrow input shapes instead of passing the full CalendarEvent. This reduces coupling, improves type safety, and makes helpers easier to reuse.

Summary of Changes

  • Refactors

    • Narrowed helper inputs to primitives/small objects (e.g., getWhat(title), getDescription(t, description), getAppsStatus(t, appsStatus), getUid(uid), getVideoCallPassword(videoCallData)).
    • Simplified location/video-call helpers to use location string, videoCallData, and uid with no behavior change.
    • getLabelValueMapFromResponses now takes { customInputs, userFieldsResponses, responses, eventTypeId } (Prisma/CalEventResponses types).
    • ManageLink updated to pass explicit fields to getCancelLink and getBookingUrl.
  • Updated Call Sites

    • Calendar services: feishucalendar, googlecalendar, larkcalendar, zohocalendar
    • CRM services: hubspot, pipedrive-crm, salesforce, zoho-bigin, zohocrm
    • Core features: EventManager.ts, CalendarManager.ts, videoClient.ts
    • Email components: ManageLink.tsx
  • Type Fixes

    • Updated narrow input shapes to accept null for location (matching CalendarEvent type)
    • Updated recurringEvent type to accept RecurringEvent | null instead of boolean
    • Updated videoCallData type to be more flexible { type?: string; url?: string } for compatibility with various call sites
  • Test Updates

    • Updated CalEventParser.test.ts to use narrow input shapes: getPublicVideoCallUrl(calEvent.uid) and getVideoCallPassword(calEvent.videoCallData)

Migration

Update call sites to pass only the fields each helper needs:

  • getWhat(calEvent.title), getDescription(t, calEvent.description), isDailyVideoCall(calEvent.videoCallData), getPublicVideoCallUrl(calEvent.uid)
  • For getLocation, pass: { videoCallData, additionalInformation, location, uid }
  • For booking/manage/cancel/reschedule links, construct param objects with required fields (platform URLs, type, organizer, uid, attendeeSeatId, bookerUrl, team)

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - internal refactor only.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

@vercel
Copy link

vercel bot commented Dec 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Review Updated (UTC)
api-v2 Ignored Ignored Preview Jan 10, 2026 7:10pm
cal Ignored Ignored Jan 10, 2026 7:10pm
cal-companion Ignored Ignored Preview Jan 10, 2026 7:10pm
cal-eu Ignored Ignored Jan 10, 2026 7:10pm

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.

1 issue found across 3 files

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/lib/CalEventParser.ts">

<violation number="1" location="packages/lib/CalEventParser.ts:181">
P0: Critical bug: When `uid` is null/undefined, the fallback UUID generation now uses `JSON.stringify(uid)` instead of the original `JSON.stringify(calEvent)`. This means all events without a UID will generate the **same** fallback UUID (since `JSON.stringify(null)` always produces `&quot;null&quot;`), leading to potential booking UID collisions.

The original code used the entire calEvent object to generate a unique fallback UID. Consider passing the full calEvent or relevant identifying properties to maintain uniqueness.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@github-actions
Copy link
Contributor

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions bot added the Stale label Dec 30, 2025
anikdhabal and others added 2 commits January 9, 2026 11:05
…fix type errors

- Update getUid call sites to pass only uid instead of whole CalendarEvent
- Update getLocation call sites to pass narrow shape with videoCallData, additionalInformation, location, uid
- Update narrow input shapes to accept null for location (matching CalendarEvent type)
- Update recurringEvent type to accept RecurringEvent | null instead of boolean
- Update videoCallData type to be more flexible ({ type?: string; url?: string })
- Fix ManageLink.tsx to pass recurringEvent directly instead of converting to boolean

Co-Authored-By: [email protected] <[email protected]>
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Jan 9, 2026
- Update getPublicVideoCallUrl test to pass uid instead of calEvent
- Update getVideoCallPassword tests to pass videoCallData instead of calEvent

Co-Authored-By: [email protected] <[email protected]>
@anikdhabal anikdhabal marked this pull request as ready for review January 9, 2026 07:48
@anikdhabal anikdhabal requested a review from a team as a code owner January 9, 2026 07:48
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.

1 issue found across 16 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/lib/bookings/getLabelValueMapFromResponses.ts">

<violation number="1" location="packages/lib/bookings/getLabelValueMapFromResponses.ts:6">
P2: Use `import type` for `Prisma` since it's only used for type annotations (`Prisma.JsonObject`). This avoids bundling unnecessary Prisma runtime code.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@anikdhabal anikdhabal force-pushed the refcator-caleventparser-isp branch from 59cf9a9 to 37c28c4 Compare January 9, 2026 16:27
@keithwillcode keithwillcode added the core area: core, team members only label Jan 10, 2026
@vercel vercel bot temporarily deployed to Preview – dev January 13, 2026 08:40 Inactive
@anikdhabal anikdhabal added this to the v6.2 milestone Jan 17, 2026
@anikdhabal anikdhabal merged commit 9fcddbf into main Jan 17, 2026
47 of 48 checks passed
@anikdhabal anikdhabal deleted the refcator-caleventparser-isp branch January 17, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only ready-for-e2e size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants