collab-presence 0009 A: real session identity for presence + comments

presenceUser()/userSlug() now resolve the authenticated user: a plain
/api/me fetch (GPL no-link rule — no closed contract import) races the WASM
boot and is awaited before presence/comments bind. `?user=`/`?libowner=`
overrides are gated behind VITE_ALLOW_USER_OVERRIDE=1 (dev script + e2e
harnesses set it; prod builds never do). Anonymous/example-backend sessions
keep the pre-auth slug fallback. Fixes prod's empty presence (everyone was
"local-user", deduped as own tabs) and comment authorship in one move.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A42xfPFNdfsUt9eowkC9eM
This commit is contained in:
Gergő Törcsvári 2026-07-16 14:31:05 +02:00
commit 6675c1f0fc
No known key found for this signature in database
GPG key ID: 8E75F2CDE64E5322
8 changed files with 173 additions and 10 deletions

View file

@ -40,6 +40,12 @@ VITE_WASM_ROOT=/wasm
# Leave UNSET for dev and the demo: every route renders locally.
# VITE_APP_URL=https://app.pcbjam.com
# Honor `?user=` / `?libowner=` identity overrides ("1"). Dev servers and e2e
# harnesses set this so specs can mint isolated per-run identities; NEVER set
# it on a production build — the session user from /api/me (or the VITE_USER
# fallback) is the identity there (collab-presence 0009).
# VITE_ALLOW_USER_OVERRIDE=1
# Where the in-editor waitlist form POSTs (default https://www.pcbjam.com/api/waitlist).
# The demo is static with no backend, so it cross-posts to the landing site's
# serverless endpoint, which must send CORS for this origin (see