Skip to content

Code Review Bench PR #26775 - fix(companion): event type links for org user#5

Closed
ketkarameya wants to merge 7 commits intobase_pr_26775_20260125_6368from
corrupted_pr_26775_20260125_6368
Closed

Code Review Bench PR #26775 - fix(companion): event type links for org user#5
ketkarameya wants to merge 7 commits intobase_pr_26775_20260125_6368from
corrupted_pr_26775_20260125_6368

Conversation

@ketkarameya
Copy link

@ketkarameya ketkarameya commented Feb 10, 2026

Benchmark PR for Gitar evaluation

Original PR: agentic-review-benchmarks#5

fix(companion): event type links for org user


Summary by Gitar

  • Problem: Organization users received incorrect event type links because client-side URL construction (cal.com/{username}/{slug}) doesn't account for custom domains or org-specific URL patterns
  • Solution: Shifted to using API-provided bookingUrl field instead of building URLs client-side, with fallback to original pattern for backward compatibility
  • Scope: Updated 21 files across web, iOS, Android, and browser extension platforms with consistent null-check pattern before using bookingUrl
  • Breaking change avoided: Added bookingUrl as optional field to EventType interface, removed obsolete buildEventTypeLink() method from CalComAPIService
  • Technical debt: Removed unused imports, updated color scheme from blue (#007AFF) to black (#000000), fixed React Native layout inconsistencies

dhairyashiil and others added 7 commits January 25, 2026 12:01
Addresses Cubic AI review feedback (confidence 9/10): The username was
hardcoded to 'username' but still used by BasicsTab as a fallback for
URL display when bookingUrl is unavailable. This restores the useEffect
that fetches the actual username from CalComAPIService.getUsername().

Co-Authored-By: unknown <>
const [conferencingOptions, setConferencingOptions] = useState<ConferencingOption[]>([]);
const [conferencingLoading, setConferencingLoading] = useState(false);
const [eventTypeData, setEventTypeData] = useState<EventType | null>(null);
const [bookingUrl, setBookingUrl] = useState<string>("");

Choose a reason for hiding this comment

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

🚨 Bug: setBookingUrl is never called — preview/copy always fails

In event-type-detail.tsx, the bookingUrl state is initialized as an empty string ("") on line 180, but setBookingUrl is never called anywhere in the component. This means bookingUrl will always be "" (falsy), so:

  1. handlePreview will always show "Booking URL not available. Please save the event type first." and return early.
  2. handleCopyLink will always show the same error and return early.
  3. BasicsTab receives bookingUrl="" which is falsy, so it falls back to the old cal.com/{username}/ display.

The component loads event type data into eventTypeData state (line 179), which should contain bookingUrl from the API. There needs to be a call like setBookingUrl(eventTypeData.bookingUrl || "") in the effect that processes the loaded event type data, or bookingUrl should be read directly from eventTypeData?.bookingUrl instead of duplicating it into separate state.

Was this helpful? React with 👍 / 👎

  • Apply suggested fix

const bookingUrl = `https://cal.com/${
eventType.users?.[0]?.username || "user"
}/${eventType.slug}`;
const bookingUrl =

Choose a reason for hiding this comment

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

⚠️ Bug: First copy button handler in content.ts not updated to use bookingUrl

In content.ts, there are two copy button click handlers. The first one (line 1125-1128) was NOT updated to use eventType.bookingUrl — it still always constructs the URL using the old https://cal.com/{username}/{slug} pattern. The second handler (line 1871-1873) was correctly updated with the fallback pattern.

This means organization users clicking the copy button in the first UI context (appears to be the general web integration) will still get incorrect URLs, defeating the purpose of this PR.

Fix: Update the first copy handler to match the pattern used everywhere else:

const bookingUrl =
  eventType.bookingUrl ||
  `https://cal.com/${eventType.users?.[0]?.username || "user"}/${eventType.slug}`;

Was this helpful? React with 👍 / 👎

Suggested change
const bookingUrl =
const bookingUrl =
eventType.bookingUrl ||
`https://cal.com/${
eventType.users?.[0]?.username || "user"
}/${eventType.slug}`;
  • Apply suggested fix

Copy link

@gitar-bot-staging gitar-bot-staging bot left a comment

Choose a reason for hiding this comment

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

⚠️ This PR is blocked due to unresolved code review findings.

Configure merge blocking · Maintainers can dismiss this review. Gitar never approves changes.

@gitar-bot-staging
Copy link

gitar-bot-staging bot commented Feb 10, 2026

Code Review 🚫 Blocked 0 resolved / 3 findings

Critical: setBookingUrl is never called in event-type-detail.tsx, so preview/copy/BasicsTab URL will always fail. Also, one copy button handler in content.ts was missed during the migration to bookingUrl.

🚨 Bug: setBookingUrl is never called — preview/copy always fails

📄 companion/app/(tabs)/(event-types)/event-type-detail.tsx:180

In event-type-detail.tsx, the bookingUrl state is initialized as an empty string ("") on line 180, but setBookingUrl is never called anywhere in the component. This means bookingUrl will always be "" (falsy), so:

  1. handlePreview will always show "Booking URL not available. Please save the event type first." and return early.
  2. handleCopyLink will always show the same error and return early.
  3. BasicsTab receives bookingUrl="" which is falsy, so it falls back to the old cal.com/{username}/ display.

The component loads event type data into eventTypeData state (line 179), which should contain bookingUrl from the API. There needs to be a call like setBookingUrl(eventTypeData.bookingUrl || "") in the effect that processes the loaded event type data, or bookingUrl should be read directly from eventTypeData?.bookingUrl instead of duplicating it into separate state.

⚠️ Bug: First copy button handler in content.ts not updated to use bookingUrl

📄 companion/extension/entrypoints/content.ts:1125

In content.ts, there are two copy button click handlers. The first one (line 1125-1128) was NOT updated to use eventType.bookingUrl — it still always constructs the URL using the old https://cal.com/{username}/{slug} pattern. The second handler (line 1871-1873) was correctly updated with the fallback pattern.

This means organization users clicking the copy button in the first UI context (appears to be the general web integration) will still get incorrect URLs, defeating the purpose of this PR.

Fix: Update the first copy handler to match the pattern used everywhere else:

const bookingUrl =
  eventType.bookingUrl ||
  `https://cal.com/${eventType.users?.[0]?.username || "user"}/${eventType.slug}`;
Suggested fix
                    const bookingUrl =
                      eventType.bookingUrl ||
                      `https://cal.com/${
                        eventType.users?.[0]?.username || "user"
                      }/${eventType.slug}`;
💡 Quality: Relocated getUsername swallows original error cause

📄 companion/services/calcom.ts:1659

The relocated getUsername function wraps the call in try/catch and throws a new generic Error("Failed to get username"), discarding the original error's message and stack trace. The original version had no try/catch and simply let errors propagate naturally, which preserved the full diagnostic context.

Consider either removing the try/catch (as before) or preserving the cause:

throw new Error("Failed to get username", { cause: error });
Suggested fix
  } catch (error) {
    throw new Error("Failed to get username", { cause: error });
  }
Rules 🎸 1 action taken

Gitar Rules

🎸 Summary Enhancement: Appended 'Summary by Gitar' section with 5 technical bullet points explaining the problem, solution, scope, breaking changes, and technical debt addressed

5 rules not applicable. Show all rules by commenting gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@kayagokalp
Copy link

Benchmark Evaluation Results

Ground Truth Bugs (Recall: 3/4 = 75.0%)

ID Severity Title Found?
GT-5-001 Critical bookingUrl state declared but never populated, breaking prev Yes
GT-5-002 Important Copy button inconsistently ignores eventType.bookingUrl whil Yes
GT-5-003 Important Share/copy/preview functions require optional bookingUrl fie No
GT-5-004 Minor getUsername error handling discards original error context Yes

Extra Gitar Findings

File Line Valid Bug? Notes
(none) - - -

Summary

  • Recall: 75.0% (3/4)
  • Precision: 100.0% (3/3)
  • Precision counts ground truth matches + valid extra findings as true positives

@kayagokalp kayagokalp closed this Feb 25, 2026
@kayagokalp kayagokalp deleted the corrupted_pr_26775_20260125_6368 branch February 25, 2026 02:05
@kayagokalp kayagokalp restored the corrupted_pr_26775_20260125_6368 branch February 25, 2026 02:17
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.

4 participants