3 months ago
7d4d3cdA raw `throw new Response(...)` in the org/staff/session guards can't cross the
server-fn RPC boundary — Seroval can't serialize a Response, so SSR route loads
crashed (opening a non-member/nonexistent org 404'd with a client "Invariant
failed" + server "Seroval Error" instead of a clean not-found). Guards now throw
TanStack control-flow that serializes cleanly:
- org-guard: every denial — no session, no such org, non-member, or
member-but-not-admin — collapses to notFound(), so org existence is never
disclosed (same posture as /admin).
- staff-guard: 404 denials -> notFound().
- session gate: no session -> redirect('/login').
- moderation-queue: foreign/missing item -> notFound().
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>Parent6566405