watchparty/server/src
Nicolas 0c439259ac
All checks were successful
Publier l'image Docker / publish (push) Successful in 6s
Add server-side logging of the party lifecycle
Requested now that the app is actually running on real infrastructure:
visibility from docker logs/journalctl into what's happening (parties
created/destroyed, who joined/left, play/pause, pause requests) without
needing to reproduce a bug through the UI first.

server/src/logger.js: a deliberately tiny partyLog(message) - plain
console.log, prefixed [watchparty:party], ISO timestamp - plus a
who(userId, userName) formatter shared by every call site. No logging
library; this app runs as a single container, not behind a log
aggregator, so a consistent grep-able prefix is what actually helps here.

Covers the party's business lifecycle end to end, logged at the source so
every caller (REST and socket) is covered without repeating the check:
- partyManager.js: create, join, leave (also covers a host handoff or the
  party being destroyed, both fall out of leave), advanceQueue,
  removeIdleParties.
- socketHandler.js: playstate and requestPause, since those two mutate
  member state directly rather than through a PartyManager method.

The one thing that needed real care: the host's player re-sends its
CURRENT play/pause state every 3 seconds regardless of whether anything
changed (the heartbeat), on top of firing per actual play/pause/seeked
event. Logging every "playstate" message as it arrives would mean one log
line every 3 seconds per active party, forever. The handler instead
compares incoming isPaused against the member's previous value and only
logs on an actual flip - so a party generates exactly one line per real
pause or resume, never one per heartbeat tick.

Verified directly against the real shipped modules, not reimplemented
mocks: a scripted create/join/advanceQueue/leave/idle-sweep sequence
against the real partyManager.js produced exactly the expected line at
every step; a fake io/socket pair driving the real socketHandler.js
through start -> 5 unchanged heartbeats -> pause -> 3 unchanged
heartbeats -> resume logged exactly 3 playstate lines (not 9) at exactly
the right points, and a throttled repeat requestPause produced no second
line - all assertions passed, counted programmatically.

docs/architecture.md has the full writeup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-14 00:53:55 +02:00
..
embyAuth.js Redesign home page: library tabs, poster tiles, ongoing parties list 2026-09-13 21:54:14 +02:00
embyProxy.js Proxy all Emby access through our own backend; drop server-url field; use Emby's real theme colors 2026-09-13 21:36:26 +02:00
index.js Filter sidebar to films/musique/clips vidéos/TV, fix music videos not being playable 2026-09-14 00:40:07 +02:00
logger.js Add server-side logging of the party lifecycle 2026-09-14 00:53:55 +02:00
partyManager.js Add server-side logging of the party lifecycle 2026-09-14 00:53:55 +02:00
socketHandler.js Add server-side logging of the party lifecycle 2026-09-14 00:53:55 +02:00