Skip to content

refactor(bookings): add round-robin host effective-limits foundation and flow wiring#28715

Open
manurana26770 wants to merge 4 commits intocalcom:mainfrom
manurana26770:feat/individual-member-limits
Open

refactor(bookings): add round-robin host effective-limits foundation and flow wiring#28715
manurana26770 wants to merge 4 commits intocalcom:mainfrom
manurana26770:feat/individual-member-limits

Conversation

@manurana26770
Copy link
Copy Markdown
Contributor

@manurana26770 manurana26770 commented Apr 2, 2026

What does this PR do?

This PR introduces the first foundation slice for per-member round-robin limit settings without changing current booking behavior.

What changes

  • Adds a reusable resolver for round-robin host effective limits with clear precedence:
    • host override when present
    • event-level fallback when not
  • Adds deterministic bucketing for hosts that share the same effective limit profile.
  • Adds a typed helper to extract host-level override values for future schema-backed fields.
  • Wires the bucketing foundation into the regular booking flow without changing current behavior.
  • Adds unit tests for precedence, bucketing, and override extraction behavior.
  • Adds deduplicates host normalization/projection logic in the routing layer by centralizing repeated mapping into a shared path, reducing drift risk without intended behavior change.
  • Adds host-level round-robin override fields end-to-end through data retrieval, typed transport, and routing normalization so overrides can flow into booking logic.
  • Persistence support for those overrides by updating the Prisma schema and adding a migration, enabling database-level storage for per-host limit override fields.

Visual Demo (For contributors especially)

N/A for this foundation PR. The change is internal plumbing and does not introduce a user-facing UI change yet.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code.
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

This PR is a foundation slice, so testing focuses on behavior preservation and contract validation.

  • Run the targeted unit tests:
    • yarn vitest run packages/features/bookings/lib/handleNewBooking/test/resolveRoundRobinHostEffectiveLimits.test.ts
    • yarn vitest run packages/features/bookings/lib/handleNewBooking/test/computeTeamData.test.ts
    • yarn vitest run packages/features/bookings/lib/handleNewBooking/test/round-robin-no-hosts.test.ts
    • yarn vitest run packages/features/users/lib/getRoutedUsers.test.ts
  • Expected result:
    • Event-level limits remain the default source of truth.
    • Host override values are resolved only for round-robin hosts.
    • When no host overrides exist, behavior stays exactly the same as before.
    • Routing host normalization preserves override fields consistently across relevant paths.

Checklist

  • My code follows the style guidelines of this project.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have checked that my changes generate no new warnings.
  • My PR is small and focused.

@manurana26770 manurana26770 requested a review from a team as a code owner April 2, 2026 19:53
@CLAassistant
Copy link
Copy Markdown

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 consumer High priority Created by Linear-GitHub Sync ✨ feature New feature or request labels Apr 2, 2026
Copy link
Copy Markdown
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 3 files

@pull-request-size pull-request-size bot added size/XL and removed size/L labels Apr 2, 2026
@github-actions github-actions bot added the ❗️ migrations contains migration files label Apr 2, 2026
Copy link
Copy Markdown
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 6 files (changes from recent commits).

Prompt for AI agents (unresolved 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="packages/features/users/lib/getRoutedUsers.ts">

<violation number="1" location="packages/features/users/lib/getRoutedUsers.ts:127">
P2: Large duplicated host-projection logic across booking paths increases drift risk for override/effective-limit fields.</violation>
</file>

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

@manurana26770
Copy link
Copy Markdown
Contributor Author

@CarinaWolli could you plz review or tell anybody to review this.
I'm working on this and will be raising more PRs.

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

Labels

consumer ✨ feature New feature or request High priority Created by Linear-GitHub Sync ❗️ migrations contains migration files size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable limit settings on an individual member basis in round-robin events

2 participants