Build booking rows consistently for paid and free orders - #1904
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe shared booking-line API now separates checkout-line construction from order-booking generation. Paid payment processing and free reservations use ID-based listing alignment, stricter lookup validation, and revised capacity errors. Tests cover booking allocation, checkout flows, ticket context, package terms, and payment outcomes. ChangesCheckout booking flow
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant PaymentOrReservationFlow
participant checkoutBookingLines
participant bookingsForOrder
participant attendeesApi.createBookingAtomic
PaymentOrReservationFlow->>checkoutBookingLines: build lines from checkout items, listings, and paid amounts
checkoutBookingLines-->>PaymentOrReservationFlow: return validated booking lines
PaymentOrReservationFlow->>bookingsForOrder: apply order date, duration, and allocations
bookingsForOrder-->>PaymentOrReservationFlow: return booking rows
PaymentOrReservationFlow->>attendeesApi.createBookingAtomic: submit booking rows
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/features/api/payment-processing/create.ts`:
- Around line 330-335: Update the paid-path failure handling in the result
success check to guard package orders before passing a listing name to
formatPostPaymentError. Reuse the free path’s package-detection logic and
provide the established generic message for package orders, while preserving the
named-listing message for non-package orders.
In `@src/shared/booking-lines.ts`:
- Around line 40-52: Rename the nullable helper paidAmountFor to
paidAmountForOrNull and update every call site and reference accordingly,
preserving its existing number-or-undefined behavior and error handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d72d0e0f-e1ea-412b-a154-d97b5a640560
📒 Files selected for processing (11)
scripts/mutation/equivalent-mutants.txtsrc/features/api/payment-processing/create.tssrc/features/public/ticket-payment.tssrc/shared/booking-lines.tstest/features/api/payment-processing/create.test.tstest/features/public/ticket-payment.test.tstest/features/public/ticket-payment/checkout.test.tstest/features/public/ticket-payment/context.test.tstest/features/public/ticket-payment/free-reservation.test.tstest/features/public/ticket-payment/packages.test.tstest/shared/booking-lines.test.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/features/api/payment-processing/create.ts`:
- Around line 331-337: Add a concise comment immediately before
validatedItems[0]!.name documenting that every capacity result includes at least
one validated item with a listing, making the non-null assertion a guaranteed
invariant. Keep the existing package redaction logic and errorName calculation
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 5762e023-b20b-4c99-85a3-ea090e6c28eb
📒 Files selected for processing (3)
src/features/api/payment-processing/create.tssrc/shared/booking-lines.tstest/features/api/payment-processing/create.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2cfff6b9c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@CodeRabbit review |
✅ Action performedReview finished.
|
What changed
Why
Paid and free checkout completion built the same booking data separately. One shared path prevents those results from drifting and makes incomplete checkout data fail clearly.
Checks
nix develop -c deno task precommitSummary by CodeRabbit