Skip to content

fix: V2 API returns "Booking limits must be in ascending order" due to unfiltered disabled key in interval limits transformer#28035

Open
muhammadusman586 wants to merge 2 commits intocalcom:mainfrom
muhammadusman586:fix/v2-api-booking-limits-disabled-key
Open

fix: V2 API returns "Booking limits must be in ascending order" due to unfiltered disabled key in interval limits transformer#28035
muhammadusman586 wants to merge 2 commits intocalcom:mainfrom
muhammadusman586:fix/v2-api-booking-limits-disabled-key

Conversation

@muhammadusman586
Copy link

@muhammadusman586 muhammadusman586 commented Feb 18, 2026

What does this PR do?

Fixes a bug where updating an event type via the V2 API fails with "Booking limits must be in ascending order" when bookingLimitsCount includes the disabled property from the BaseBookingLimitsCount_2024_06_14 DTO.

Root Cause

transformIntervalLimitsApiToInternal() in interval-limits.ts iterates all Object.entries() of the input without filtering. The BaseBookingLimitsCount_2024_06_14 class has a disabled?: boolean = false default property. Since BookingLimitsEnum_2024_06_14 only maps day, week, month, year — the disabled key has no mapping, producing res[undefined] = false.

This corrupted object (e.g. { PER_DAY: 5, undefined: false }) is then passed to validateIntervalLimitOrder() in the TRPC update handler, which fails because "undefined" is not a recognized interval limit key.

Flow:
V2 API Controller → InputEventTypesService.transformInputUpdateEventType() → transformIntervalLimitsApiToInternal({ day: 5, disabled: false }) → produces { PER_DAY: 5, undefined: false } ← BUG → validateIntervalLimitOrder() returns false → TRPCError: "Booking limits must be in ascending order"

Related Issue

#27988

Changes

apps/api/v2/.../transformers/api-to-internal/interval-limits.ts

  • Added guard clause to skip keys not present in BookingLimitsEnum_2024_06_14
  • Changed .map().forEach() since the return value is unused

apps/api/v2/.../transformers/api-to-internal/api-to-internal.spec.ts

  • Added test: disabled: false with valid counts → only valid limit keys produced (no undefined key)
  • Added test: disabled: true → returns empty object {}

Open with Devin

@muhammadusman586 muhammadusman586 requested a review from a team as a code owner February 18, 2026 12:17
@CLAassistant
Copy link

CLAassistant commented Feb 18, 2026

CLA assistant check
All committers have signed the CLA.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Feb 18, 2026
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 2 files

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@sahitya-chandra sahitya-chandra added ready-for-e2e run-ci Approve CI to run for external contributors labels Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Created by Linear-GitHub Sync ready-for-e2e run-ci Approve CI to run for external contributors size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments