Let guests search Spotify and request songs #40

Merged
forgejo-admin merged 2 commits from feature/live-requests into main 2026-09-28 06:38:31 +00:00

Problem

Guests can follow the set, but they can't ask for anything.

Solution

App server

  • Search: search({ q }) proxies Spotify search (10 results) and labels tracks already played this session by URI.
    • It logs in as the app (client credentials) and caches the token. The token source is injectable, because that login method is still unverified for this development-mode app.
    • Missing credentials turn search off with a clear message, and the server still starts; in test mode a fake catalog stands in.
  • Requests: request(track) merges into one live request per track per session, and meToo({ requestId }) joins one.
    • A guest can have at most 3 pending requests; a fourth is refused with "You have 3 requests waiting — wait for one to play".
    • A closed session refuses search, requests and "me too".
  • What guests see: requests() lists requested, queued and played; dismissed requests disappear. History rows say "requested by Ana, Ben".
  • DJ calls:
    • djRequests({ sessionId }) returns pending and queued requests.
    • setRequestStatus sets pending, queued or dismissed, but a request that has played stays played.
    • reportPlay with a requestId marks the request played.
  • Guest-supplied data: the track URI must look like spotify:track:… and cover art must come from i.scdn.co.

Guest site

  • A Requests tab with a debounced search box and "played 21:14" labels.
  • Status chips (requested, queued, played ✓) and "me too" on the session's requests.
  • Failures show inline, and nothing is queued on the phone.

Also: every expect(promise).rejects in the app server tests is now awaited. Unawaited, they never asserted. All of them still pass.

This is Slice 4 of projects/2026-09-27-dj-online-companion/plan.md.

Testing

  • bun run test: 182 pass. That includes 22 request tests and 7 Spotify tests.
  • bun run check: clean. bun run build:live builds.
  • Smoke run with bun run live in test mode and the fake catalog: Ana requests Libertango, Ben taps "me too", and the DJ's list shows "Libertango by Ana, Ben".

🤖 Generated with Claude Code

## Problem Guests can follow the set, but they can't ask for anything. ## Solution **App server** - **Search:** `search({ q })` proxies Spotify search (10 results) and labels tracks already played this session by URI. - It logs in as the app (client credentials) and caches the token. The token source is injectable, because that login method is still unverified for this development-mode app. - Missing credentials turn search off with a clear message, and the server still starts; in test mode a fake catalog stands in. - **Requests:** `request(track)` merges into one live request per track per session, and `meToo({ requestId })` joins one. - A guest can have at most 3 pending requests; a fourth is refused with "You have 3 requests waiting — wait for one to play". - A closed session refuses search, requests and "me too". - **What guests see:** `requests()` lists requested, queued and played; dismissed requests disappear. History rows say "requested by Ana, Ben". - **DJ calls:** - `djRequests({ sessionId })` returns pending and queued requests. - `setRequestStatus` sets pending, queued or dismissed, but a request that has played stays played. - `reportPlay` with a `requestId` marks the request played. - **Guest-supplied data:** the track URI must look like `spotify:track:…` and cover art must come from `i.scdn.co`. **Guest site** - A Requests tab with a debounced search box and "played 21:14" labels. - Status chips (requested, queued, played ✓) and "me too" on the session's requests. - Failures show inline, and nothing is queued on the phone. **Also:** every `expect(promise).rejects` in the app server tests is now awaited. Unawaited, they never asserted. All of them still pass. This is Slice 4 of `projects/2026-09-27-dj-online-companion/plan.md`. ## Testing - `bun run test`: 182 pass. That includes 22 request tests and 7 Spotify tests. - `bun run check`: clean. `bun run build:live` builds. - Smoke run with `bun run live` in test mode and the fake catalog: Ana requests Libertango, Ben taps "me too", and the DJ's list shows "Libertango by Ana, Ben". 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Search proxies Spotify (client credentials, injectable token source; a fixed fake catalog in test mode without credentials). Requests merge per track while live, 'me too' joins one, a guest may wait on at most 3, and every guest sees each request as requested, queued or played; dismissed ones vanish. Played requests credit their requesters in history. The DJ side gets djRequests and setRequestStatus for the console panel (Slice 6).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unawaited expect(promise).rejects never asserts; every one now awaits.
All still pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
forgejo-admin deleted branch feature/live-requests 2026-09-28 06:38:31 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
celilo/tango-dj!40
No description provided.