Skip to content

refactor: reuse shared booking and up-next helpers - #3044

Merged
tyler-dane merged 3 commits into
mainfrom
cursor/code-simplification-cf47
Sep 1, 2026
Merged

refactor: reuse shared booking and up-next helpers#3044
tyler-dane merged 3 commits into
mainfrom
cursor/code-simplification-cf47

Conversation

@cursor

@cursor cursor Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Behavior-preserving cleanup of leftovers from recent merges (#3026, #3034, #3040), without touching the open booking overflow (#3043) or onboarding game (#3036) PRs.

  • Guest URL search uses the shared timezone helper and the booking month/date key checks instead of local copies.
  • Host BookingCopyLink uses useCopiedFlag, the same copy-state hook as the guest cancel link.
  • Up Next V reads upNext.conference.url from the grid projection, matching the card instead of a second events.find.
  • Guest form and reservation service share isGuestEmail from core.
  • toBookingErrorResponse uses BookingException.statusCode instead of looking the status up again.

Simplicity

Deleted local copies. No new abstractions beyond exporting helpers that already had two call sites. Public booking error messages, URL drop-invalid-to-undefined, copy toasts, and conference join behavior stay the same.

Automated validation

bun run verify package checks passed after rebase onto origin/main:

Selected packages: core, web, backend
Checks run: test:core, test:web, test:backend, type-check, lint, knip

Focused suites: booking search/format, BookingCopyLink, Up Next card/banner (46 passed); core contracts + booking.error (31 passed). Playwright Chromium was installed; the event-action-row a11y spec flaked once on contrast and passed on retry.

Independent review

.agents/handoffs/simplify-recent-3040.md

VERDICT: no confirmed findings
FINDINGS:
(none)

Test plan

  • bun run verify
  • bun test:web -- packages/web/src/booking/public-booking-search.test.ts packages/web/src/booking/public-booking.format.test.ts packages/web/src/booking/BookingCopyLink.test.tsx packages/web/src/components/Sidebar/UpNextCard/
  • bun test packages/core/src/types/booking.contracts.test.ts packages/backend/src/booking/booking.error.test.ts
  • bunx playwright test e2e/accessibility/app-a11y.spec.ts -g "event action row" --workers=1
Open in Web View Automation 

Note

Low Risk
Refactor-only with tests and verify passing; minor assumption that shared timezone validation and grid conference match prior behavior.

Overview
Behavior-preserving cleanup that deduplicates booking and sidebar helpers left over from recent merges, without changing guest-facing validation rules or URL parsing semantics.

Guest email is centralized in @core/types/booking.contracts as isGuestEmail (and GUEST_EMAIL_PATTERN); the public guest form and public-booking.service both call it instead of local regex copies. Public booking URL search now uses isBookingMonthKey / isBookingDateKey from public-booking.format and isValidTimeZone from browser-timezone instead of inline patterns and a local timezone check.

Host BookingCopyLink switches to the shared useCopiedFlag hook (same pattern as the guest cancel link) for copy state and toasts. Up Next reads conferenceUrl from upNext?.conference?.url on the grid projection instead of re-deriving it from sourceEvent.content when kind === "details".

Booking API errors: toBookingErrorResponse returns BookingException.statusCode directly rather than mapping bookingCode through STATUS_BY_CODE again. Agent ledger/handoff files document verification for task simplify-recent-3040.

Reviewed by Cursor Bugbot for commit f65bc4a. Bugbot is set up for automated code reviews on this repo. Configure here.

cursoragent and others added 3 commits September 1, 2026 01:11
Reuse the existing timezone helper and month/date key checks instead of
local copies, and point the host copy button at useCopiedFlag.

Co-authored-by: tyler <tyler@switchback.tech>
The grid view model already joins conference onto the event. Shortcuts
and the card now use the same field instead of a second events.find.

Co-authored-by: tyler <tyler@switchback.tech>
Co-authored-by: tyler <tyler@switchback.tech>
@tyler-dane
tyler-dane marked this pull request as ready for review September 1, 2026 01:17
@tyler-dane
tyler-dane merged commit c2a69e9 into main Sep 1, 2026
31 checks passed
@tyler-dane
tyler-dane deleted the cursor/code-simplification-cf47 branch September 1, 2026 01:24
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.

2 participants