Files
loki/scripts
Mao NakamotoandClaude Opus 4.8 e0ff1276cb feat(auth/infra): Tier 1 reliability guardrails for auth + email
Make the recurring silent-failure class loud and fast instead of
user-reported days later (the X-login saga). Additive hardening, no
rewrite of working auth.

- src/lib/env.ts: boot-time config sanity check — flags missing/whitespace-
  corrupted secrets (the \n-corruption incident), half-set provider key pairs
  (the X-saga shape), and prod email/URL gaps. Logged at boot via
  instrumentation.ts; surfaced in /api/health.
- /api/health: returns 503 when env has a fatal/error issue (deploy + smoke
  go red); detailed issues gated behind CRON_SECRET.
- deploy-hetzner.sh: post-deploy verification asserts /sign-in 200, env health
  200, and that github/google/x-1a/email-password are actually mounted —
  fails the deploy loudly otherwise. This is the guard that would have caught
  the X provider silently un-mounting.
- x-oauth1.ts: ticket signing now trims AUTH_SECRET and throws if empty (no
  forgeable empty-key tickets, no silent \n mismatch).
- email.ts: every send logs success/failure to debug_logs (answerable 'did
  the reset email go out?').
- auth.ts: GitHub provider conditionally mounted like Google/X.

Verified live: deploy self-verification passed; /api/health env clean (0 issues).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 15:51:13 +02:00
..