fix(GRO-2234): transparent re-mint on 401 for portal Book New submit #55

Merged
Flea Flicker merged 2 commits from flea-flicker/gro-2234-portal-waitlist-remint-on-401 into dev 2026-06-08 19:13:03 +00:00

2 Commits

Author SHA1 Message Date
Flea Flicker 0766332712 ci: re-trigger checks (transient runner failure)
CI / Test (pull_request) Successful in 25s
CI / Lint & Typecheck (pull_request) Successful in 27s
CI / Build & Push Docker Image (pull_request) Successful in 38s
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-08 19:11:26 +00:00
Flea Flicker 915a310e0a fix(GRO-2234): transparent re-mint on 401 for portal Book New submit
CI / Test (pull_request) Failing after 14m28s
CI / Lint & Typecheck (pull_request) Failing after 14m29s
CI / Build & Push Docker Image (pull_request) Has been skipped
A deliberately-paced Book New wizard could outlive the portal impersonation
session, so the final POST /api/portal/waitlist returned 401 and the UI showed
"Failed to book appointment. Please try again."

BookingFlow now retries once on a 401: it re-mints a fresh portal session via
POST /api/portal/session-from-auth (the customer's Better Auth cookie is still
valid) and resubmits the waitlist request with the new
X-Impersonation-Session-Id. Falls through to the existing error if no Better
Auth session is available (staff/dev impersonation paths).

- Appointments.tsx: remintPortalSession() helper; handleConfirmBooking submits
  via submitWaitlist(id) and retries once after a 401 re-mint.
- Test: first waitlist POST 401 -> re-mint -> retry with fresh id -> success;
  asserts exactly one re-mint and the header sequence.
- UAT_PLAYBOOK.md 5.12e: TC-WEB-5.12.25 slow-wizard submit succeeds.

Companion to groombook/api GRO-2234 (bounded sliding expiration).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-08 18:55:00 +00:00