Home

boring / v2

publicBoring-Software-Inc/v2
Overview Code History Branches Pull requestsIssuesInsights Campfire Docs
main
HomeOverview Code PRsIssues

feat(web): dev persona switcher — auto-login without OAuth (§13)

4 months ago

26c2dfb
Authored
grim7/13/2026, 7:17:18 AM
a local convenience, compile-time excluded from prod. inspired by
spatie/laravel-login-link, adapted to tripwire's real product STATES.

- auto-login: a gated route with no session in a dev build trampolines
  through /dev/auto-login, mints the default persona (active — the
  populated dashboard), and lands you in the app. you never see /login;
  it stays reachable directly with a persona panel.
- switcher (floating in the shell + /login panel) jumps between six
  states: fresh maintainer, one repo (auto-select), many repos (picker),
  empty dashboard, active dashboard, and anonymous (signs out and opens
  a seeded PUBLIC run as a stranger).
- sessions are REAL better-auth sessions minted via email/password
  (asResponse → forwarded set-cookie), never oauth, never bypassing
  verification. createAuth gains a devLogin flag enabled only when the
  web head is a dev build.
- two guards, both throw: compile-time import.meta.env.DEV (code absent
  from prod) + runtime loopback-host check. no escape hatch.
- fixtures auto-create per persona on click, namespaced tripwire-demo/*;
  "reset dev data" wipes only that namespace, never a real table.
- the shape-correct seed builder lives in @tripwire/db (shared with the
  coming dev:demo), building contract-valid runs without importing core.

tests: guard (prod ⇒ throws, non-localhost ⇒ throws), the session-mint
mechanism over real postgres, the seeded story's home stats. checks:
typecheck all, biome, boundaries, 215 tests.

Parentcb4771e

19 files changed
  • DECISIONS.md+45−0
  • all-summaries.md+23−0
  • apps/web/src/components/auth/login-page.tsx+9−0
  • apps/web/src/components/dev/auto-login-page.tsx+55−0
  • apps/web/src/components/dev/persona-switcher.tsx+140−0
  • apps/web/src/components/layouts/dashboard-layout.tsx+2−0
  • apps/web/src/lib/dev/personas.ts+72−0
  • apps/web/src/lib/server/auth.ts
+2
−0
  • apps/web/src/lib/server/dev/guard.test.ts+53−0
  • apps/web/src/lib/server/dev/guard.ts+41−0
  • apps/web/src/lib/server/dev/handler.ts+188−0
  • apps/web/src/routes/__root.tsx+12−0
  • apps/web/src/routes/dev.auto-login.tsx+17−0
  • apps/web/src/start.ts+7−0
  • packages/auth/src/dev-login.integration.test.ts+94−0
  • packages/auth/src/server.ts+9−0
  • packages/db/src/index.ts+11−0
  • packages/db/src/seed.ts+544−0
  • packages/db/src/services/seed.integration.test.ts+55−0