Harden async handlers + profile-load error state (login spinner incident)

↗ view on GitHub · sloth-ninja · 2026-07-21 · 23ed39e3

Production Supabase lost the service_role grant on user_api_keys; the unwrapped
GET /user/profile handler threw, and after the #22 unhandledRejection guard the
request simply never responded - the frontend gate spun on loading forever
(infinite login spinner). This is the code-level defence.

Backend: audited every async route handler; wrapped 56 unwrapped/partial ones
via a new self-contained lib/asyncHandler.ts (fixed generic 500 detail +
console.error via safeErrorLog; mirrors workflows.ts asyncRoute). Handlers with
whole-body try/catch left untouched. Added user.test.ts covering the GET
/user/profile reject path.

Frontend: 15s AbortController timeout on the profile load + an honest error+retry
state in MfaLoginGate, replacing the silent misleading fallback profile.

Docs: DURABLE_LESSONS 2026-07-21 entry + BUILD_LOG entry.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository Sloth-ninja/JessicaOSS
Author sloth-ninja <ezanahaddis@gmail.com>
Authored
Parents e1f91b8d
Stats 14 files changed , +465 , -132
Part of Harden async handlers + profile-load error state (login spinner incident)

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-23ed39e3.md from inside the repo you want the change in.

⬇ Download capture-commit-23ed39e3.md