refactor: share instance ids, graph fetch, and booking slot helpers - #3446
Merged
Conversation
Google and Apple minted the same recurring-instance suffix and copied the same access-role capability table. Move parseAppleInstanceId next to the mint helper so the writer is not also a parser. Co-authored-by: tyler <tyler@switchback.tech>
Calendar, event, people, and notification adapters each repeated bearer
auth, the 30s timeout, JSON parse, and the { response: { status, data } }
error shape. One helper keeps that contract in one place.
Co-authored-by: tyler <tyler@switchback.tech>
Book and reschedule duplicated month-slot query, prefetch, and next-available walks. The guest pages also copied the same alert and sticky footer class, and two thin wrappers only forwarded copy-link props. Co-authored-by: tyler <tyler@switchback.tech>
The writer still annotates instance patch and delete with ParsedAppleInstanceId after the parser moved out of the file. Co-authored-by: tyler <tyler@switchback.tech>
tyler-dane
marked this pull request as ready for review
September 6, 2026 01:25
tyler-dane
enabled auto-merge
September 6, 2026 01:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #3381 (conflicting with main).
What and why
Recent provider and booking work copied the same recurring-instance suffix, access-role capability table, Microsoft Graph fetch/error shape, book-vs-reschedule slot query walks, guest alert/sticky markup, and cancel/reschedule URL pairing. This pass shares those helpers without changing behavior. Microsoft discovery still derives write/invite from
canEditrather than the shared role table, because a default calendar can be non-writable.Verify
VERDICT: PASSChecks run:
test:sync:fast,test:web,test:backend:fast,type-check,lint,knip,test:a11y,test:e2e.Note
Medium Risk
Touches Microsoft Graph error handling and shared recurring-instance id parsing used by Google/Apple sync; refactors are intended to be behavior-preserving but regressions would affect calendar sync and guest booking flows.
Overview
This PR deduplicates repeated sync, backend, and public-booking code without changing product behavior.
Sync providers: Recurring instance id mint/parse moves into
recurring-instance-id.ts, with Google and Apple re-exporting the same logic (Apple drops inline parsing from the event writer). Calendar access-role capabilities are centralized incalendar-role-capabilities.tsfor Apple and Google discovery; Microsoft Graph HTTP is unified inmicrosoftGraphRequestand wired through calendar list, event read/write, subscriptions, and people search (plus unit tests).Public booking:
guestActionUrlspairs cancel and reschedule URLs in the public booking service. The web layer extractsPublicBookingAlertand a shared sticky-step class, drops thin copy-link wrapper components in favor ofPublicBookingCopyGuestAction, and consolidates month slot queries, prefetch, and “next available day” search inpublic-booking.query.ts. Docs update the implementation map to match.Reviewed by Cursor Bugbot for commit 72c89c2. Bugbot is set up for automated code reviews on this repo. Configure here.