Skip to content

Conversation

@bandhan-majumder
Copy link
Contributor

What does this PR do?

Allows title appear correctly in ics-feed app integrations while trouble shooting availability

Visual Demo (For contributors especially)

https://www.loom.com/share/9cc458a846d042d19708d858b0b208ed?sid=1b225829-3fa5-49cc-b2c1-bdb83852ad48

Video Demo (if applicable):

  • Show screen recordings of the issue or feature.
  • Demonstrate how to reproduce the issue, the behavior before and after the change.

Image Demo (if applicable):

  • Add side-by-side screenshots of the original and updated change.
  • Highlight any significant change(s).

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. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Install ICS feed app
  2. add a url of (google calendar) any calendar in ics integration
  3. create any event in that calendar
  4. go to availabililty
  5. troubleshoot an availability, check the title of the event which is marked as busy slot. It has exactly the title that the calendar has
  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

@bandhan-majumder bandhan-majumder requested a review from a team as a code owner September 18, 2025 18:28
@vercel
Copy link

vercel bot commented Sep 18, 2025

@bandhan-majumder is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Sep 18, 2025
@graphite-app graphite-app bot requested a review from a team September 18, 2025 18:28
@github-actions github-actions bot added the 🐛 bug Something isn't working label Sep 18, 2025
@dosubot dosubot bot added the app-store area: app store, apps, calendar integrations, google calendar, outlook, lark, apple calendar label Sep 18, 2025
@bandhan-majumder
Copy link
Contributor Author

I had to add // eslint-disable-next-line @typescript-eslint/no-explicit-any before an any type which was implemented previously so that it does not cause eslint issue with my current change in this file.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 19, 2025

Walkthrough

This change updates packages/app-store/ics-feedcalendar/lib/CalendarService.ts to include a title field on emitted events from getAvailability. The title is derived from each VEVENT’s summary (vevent.getFirstPropertyValue("summary")). The local events array type is updated from { start: string; end: string }[] to { start: string; end: string; title: string }[]. Title is attached for both recurring instances (inside the loop) and non-recurring events. A lint suppression (// eslint-disable-next-line @typescript-eslint/no-explicit-any) is added before accessing vevent’s jCal tzid. No other logic related to timezone or recurrence handling is modified.

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues Check ✅ Passed The linked issues require that busy slots from ICS feeds display the actual event title instead of a generic "Busy"; the change in CalendarService extracts the VEVENT summary and attaches it to emitted events in both recurring and non‑recurring paths, which directly implements that coding requirement. The change is scoped to the event payload and references the correct issue numbers, so the primary coding objectives from the linked issues are met.
Out of Scope Changes Check ✅ Passed The provided diff summary shows only an extension of the event shape to include a title and a single ESLint suppression; there are no other feature additions, removals, or unrelated refactors indicated, so I find no out‑of‑scope changes relative to the linked issues. The change appears minimal and focused on the reported bug.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title clearly identifies the main change as a bug fix related to displaying the correct busy slot title in the ICS feed integration troubleshooting flow and directly reflects the content of the code modifications. It succinctly conveys the problem being addressed without unrelated details.
Description Check ✅ Passed The description outlines the purpose of the PR, references the relevant GitHub and Linear issue numbers, links a visual demo, and provides clear testing instructions that align with the changes to include event titles in the ICS feed integration troubleshooting. It remains focused on the modifications made and their verification steps, demonstrating direct relevance to the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the bookings area: bookings, availability, timezones, double booking label Sep 19, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
packages/app-store/ics-feedcalendar/lib/CalendarService.ts (4)

162-166: Remove any/jCal indexing; use ICAL.Property.getParameter('tzid') and add safe title fallback.

Eliminates the lint suppression and avoids undefined titles at runtime.

Apply:

-        const title = vevent.getFirstPropertyValue("summary");
+        const titleRaw = vevent.getFirstPropertyValue("summary");
+        const title = typeof titleRaw === "string" && titleRaw.trim() ? titleRaw : "Busy";
         const dtstartProperty = vevent.getFirstProperty("dtstart");
-        // eslint-disable-next-line @typescript-eslint/no-explicit-any
-        const tzidFromDtstart = dtstartProperty ? (dtstartProperty as any).jCal[1].tzid : undefined;
+        const tzidFromDtstart = dtstartProperty?.getParameter?.("tzid") as string | undefined;

268-269: Avoid as string; pass the sanitized title and consider instance overrides.

as string can mask undefined. Use the sanitized title. If you need per-occurrence overrides, resolve summary from currentEvent.item.component (optional follow-up).

Apply:

-                title: title as string,
+                title,

Optional (per-occurrence override inside the loop, if needed later):

const occTitleRaw = currentEvent?.item?.component?.getFirstPropertyValue?.("summary");
const occTitle = typeof occTitleRaw === "string" && occTitleRaw.trim() ? occTitleRaw : title;
...
title: occTitle,

289-290: Same here: drop the cast; use the sanitized title.

-          title: title as string,
+          title,

149-149: Use shared EventBusyDate (extend with title)

EventBusyDate (packages/types/Calendar.d.ts) currently lacks title — replace ad‑hoc literal to avoid drift: either add title to the shared type or locally intersect.

Recommended changes:

Add title?: string to the shared type (preferred):

--- packages/types/Calendar.d.ts
@@
 export type EventBusyDate = {
   start: Date | string;
   end: Date | string;
+  title?: string;
   source?: string | null;
 }

Then update local usage:

-    const events: { start: string; end: string; title: string }[] = [];
+    const events: EventBusyDate[] = [];

Or, if you don't want to change the shared type, intersect locally:

-    const events: { start: string; end: string; title: string }[] = [];
+    const events: (EventBusyDate & { title: string })[] = [];

Files: packages/app-store/ics-feedcalendar/lib/CalendarService.ts (line ~149), packages/types/Calendar.d.ts.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7fbeeae and f72032f.

📒 Files selected for processing (1)
  • packages/app-store/ics-feedcalendar/lib/CalendarService.ts (4 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*Service.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Service files must include Service suffix, use PascalCase matching exported class, and avoid generic names (e.g., MembershipService.ts)

Files:

  • packages/app-store/ics-feedcalendar/lib/CalendarService.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/app-store/ics-feedcalendar/lib/CalendarService.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/app-store/ics-feedcalendar/lib/CalendarService.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/app-store/ics-feedcalendar/lib/CalendarService.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: supalarry
PR: calcom/cal.com#23364
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/transformers/internal-to-api/internal-to-api.spec.ts:295-296
Timestamp: 2025-08-27T13:32:46.887Z
Learning: In calcom/cal.com, when transforming booking fields from internal to API format, tests in organizations-event-types.e2e-spec.ts already expect name field label and placeholder to be empty strings ("") rather than undefined. PR changes that set these to explicit empty strings are typically fixing implementation to match existing test expectations rather than breaking changes.
Learnt from: din-prajapati
PR: calcom/cal.com#21854
File: packages/app-store/office365calendar/__tests__/unit_tests/SubscriptionManager.test.ts:0-0
Timestamp: 2025-08-05T12:04:29.037Z
Learning: In packages/app-store/office365calendar/lib/CalendarService.ts, the fetcher method in Office365CalendarService class is public, not private. It was specifically changed from private to public in this PR to support proper testing and external access patterns.
📚 Learning: 2025-08-05T12:04:29.037Z
Learnt from: din-prajapati
PR: calcom/cal.com#21854
File: packages/app-store/office365calendar/__tests__/unit_tests/SubscriptionManager.test.ts:0-0
Timestamp: 2025-08-05T12:04:29.037Z
Learning: In packages/app-store/office365calendar/lib/CalendarService.ts, the fetcher method in Office365CalendarService class is public, not private. It was specifically changed from private to public in this PR to support proper testing and external access patterns.

Applied to files:

  • packages/app-store/ics-feedcalendar/lib/CalendarService.ts
📚 Learning: 2025-08-27T13:32:46.887Z
Learnt from: supalarry
PR: calcom/cal.com#23364
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/transformers/internal-to-api/internal-to-api.spec.ts:295-296
Timestamp: 2025-08-27T13:32:46.887Z
Learning: In calcom/cal.com, when transforming booking fields from internal to API format, tests in organizations-event-types.e2e-spec.ts already expect name field label and placeholder to be empty strings ("") rather than undefined. PR changes that set these to explicit empty strings are typically fixing implementation to match existing test expectations rather than breaking changes.

Applied to files:

  • packages/app-store/ics-feedcalendar/lib/CalendarService.ts
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Install dependencies / Yarn install & cache
  • GitHub Check: Codacy Static Code Analysis

Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

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

LGTM

@bandhan-majumder
Copy link
Contributor Author

@anikdhabal @CarinaWolli
can I get a review from you too ?

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2025

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added the Stale label Oct 6, 2025
@bandhan-majumder
Copy link
Contributor Author

@anikdhabal @Udit-takkar

Can I get a review of this PR from you please

@github-actions github-actions bot removed the Stale label Oct 7, 2025
@bandhan-majumder
Copy link
Contributor Author

@CarinaWolli @Udit-takkar can you please review this?

@bandhan-majumder
Copy link
Contributor Author

can you please review this? @keithwillcode @anikdhabal

@bandhan-majumder
Copy link
Contributor Author

hey @CarinaWolli , can you please review this PR

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.

No issues found across 1 file

Pallava-Joshi
Pallava-Joshi previously approved these changes Nov 25, 2025
Copy link
Member

@Pallava-Joshi Pallava-Joshi left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @bandhan-majumder

@anikdhabal anikdhabal enabled auto-merge (squash) December 4, 2025 05:20
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 1 file

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/app-store/ics-feedcalendar/lib/CalendarService.ts">

<violation number="1" location="packages/app-store/ics-feedcalendar/lib/CalendarService.ts:162">
P2: `String(null)` returns the literal string `&quot;null&quot;` and `String(undefined)` returns `&quot;undefined&quot;`. If an ICS event lacks a SUMMARY property (which is optional per RFC 5545), the title will display as &quot;null&quot; instead of an empty string or fallback value.</violation>
</file>

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

// if (vevent?.getFirstPropertyValue("transp") === "TRANSPARENT") return;

const event = new ICAL.Event(vevent);
const title = String(vevent.getFirstPropertyValue("summary"));
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 4, 2025

Choose a reason for hiding this comment

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

P2: String(null) returns the literal string "null" and String(undefined) returns "undefined". If an ICS event lacks a SUMMARY property (which is optional per RFC 5545), the title will display as "null" instead of an empty string or fallback value.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/app-store/ics-feedcalendar/lib/CalendarService.ts, line 162:

<comment>`String(null)` returns the literal string `&quot;null&quot;` and `String(undefined)` returns `&quot;undefined&quot;`. If an ICS event lacks a SUMMARY property (which is optional per RFC 5545), the title will display as &quot;null&quot; instead of an empty string or fallback value.</comment>

<file context>
@@ -159,7 +159,9 @@ export default class ICSFeedCalendarService implements Calendar {
         // if (vevent?.getFirstPropertyValue(&quot;transp&quot;) === &quot;TRANSPARENT&quot;) return;
 
         const event = new ICAL.Event(vevent);
+        const title = String(vevent.getFirstPropertyValue(&quot;summary&quot;));
         const dtstartProperty = vevent.getFirstProperty(&quot;dtstart&quot;);
+        // eslint-disable-next-line @typescript-eslint/no-explicit-any
</file context>
Suggested change
const title = String(vevent.getFirstPropertyValue("summary"));
const title = String(vevent.getFirstPropertyValue("summary") ?? "");
Fix with Cubic

@anikdhabal anikdhabal merged commit 741144b into calcom:main Dec 4, 2025
31 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app-store area: app store, apps, calendar integrations, google calendar, outlook, lark, apple calendar bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working community Created by Linear-GitHub Sync ready-for-e2e size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: ICS feed integration shows every busy slot as "Busy" in availability troubleshoot

5 participants