Feature plan: Step 1 · Step 2 · Step 3 · Step 4

Debug mode: enabled (debug log)

Effort study: railspike-effort / v3/music_queue; host ledger music_queue.md. Standing P2 enrollment.

Extended estimates: enabled. Stage figures are stage work only; they are not summed.

Cycle estimate: 0.45

Step 2 approved 2026-11-29 ("approved step 2"), with its defaults: checks every 10 seconds, Play next on /music/ rows only, flag on by default. Starting revision 8272a89f9.

Concepts touched: Music section (Stage 4 adds additions and Play next). Thread activity (reused rule: ThreadLabels::isTagOnly). Media embed, Feature flags (one new flag, Stage 1).

Completion Contract

  • Normal entry: Play all on the room laptop; /music/ on members' phones.

  • End-to-end outcome: within about 10 seconds of a share or a Play next tap made after the slides opened, "Up next" names the track; the next Next plays it; when inserts run out, Next resumes the queue.

  • Recovery: a failed or timed-out check (8s) shows a short notice with Details and retries, and nothing added meanwhile is lost; a refused Play next post shows the composer's normal error; FORUM_MUSIC_QUEUE_ENABLED off stops checks and hides the button.

  • Deployment and external checks: Deploy now to mitrapclub.com; one meeting with a phone addition.

  • Release: PR merged and deployed; the maintainer reports a phone addition reaching the screen.

Key Risks

  • High risk: order after inserts. Impact: Next or Previous jumps somewhere surprising in front of the room. Early validation: Stage 2 browser test inserts two tracks mid-queue and walks Next and Previous both ways. Mitigation: Next takes inserts first, then a saved resume point; Previous retraces the slides actually shown.

  • Guest Play next refused. Impact: signed-out phones cannot queue. Early validation: Stage 3 test posts a #playnext reply as a guest on mitrapclub. Mitigation: same posting path as the share box; if refused, the composer's error shows.

  • #playnext replies on thread pages. Impact: bare marks in conversations. Early validation: Stage 3 records whether mitrapclub has the activity drawer on. Mitigation: the handoff names the drawer flag; no new hiding rule here.

  • Check cost. Impact: many tabs polling. Early validation: Stage 1 times one answer. Mitigation: one query each for shares and marks, both bounded by time.

Stage 1 – Additions answer and flag

Estimate: 0.10

  • Goal: the server answers "what was added after this time", and the slides page carries the server's time when it was rendered.

  • Dependencies: none.

  • Expected changes: TagPage::addedSince(PDO, tag, string afterUtc) returns playable-candidate threads shared after the time, and threads given a hashtag-only #playnext reply after it, each with its time and kind, oldest first. MusicPageController::added(string after) keeps playable ones and answers plain text, one Key: value block per addition (Thread-ID, Kind, Added-At, Href) after a Checked-At line. Route /music/slides/added.txt?after=…. music_slides.php root gets data-opened-at (server time) and data-added-src. FORUM_MUSIC_QUEUE_ENABLED (on, requires the slides flag). An unreadable after answers 400 with Error: and Detail: lines.

  • Verification approach: new MusicQueueTest: a share after the time appears, one before does not; a text-only share does not; a #playnext reply after the time appears, one with other words does not; a mark on a non-music thread does not; flag off answers 404; bad after answers 400. FeatureFlagEvaluatorTest. Time one answer.

  • Estimate details: driver: the two queries and their edges; uncertainty: low.

  • Risks or open questions:

    • Impact: hashtag matching in SQL is loose. Early warning: the "other words" test. Mitigation: SQL narrows by LIKE '%#playnext%'; PHP confirms with ThreadLabels::isTagOnly and fromBody.

  • Canonical components/API contracts touched: ReadModel/TagPage.php (extended), Support/ThreadLabels.php (reused), MediaEmbedDetector (reused), Application.php route, FeatureFlagRegistry.php; plain-text format from CONTRIBUTING.md.

Stage 2 – The client queue on the slides

Estimate: 0.14

  • Goal: the slides insert additions after the current track, show them as "Up next", and resume the queue after them.

  • Dependencies: Stage 1.

  • Expected changes: music_slides.js keeps an up-next list, a resume address, the slides shown and the IDs already played or queued. It checks every 10 seconds with an 8-second timeout, from data-opened-at, advancing to each answer's Checked-At. Next, ArrowRight and a left swipe take the first up-next track, saving the server's Next as the resume point; with up-next empty, they use the resume point, then the slide's own Next. Previous retraces the slides shown. The "Up next" line lists queued titles (fetched with the slide, already prefetched). Repeated check failures show "New tracks aren't arriving." with Details (step music queue check, status or error, time waited) and keep retrying. Styles in music-slides.css.

  • Verification approach: music_slides.mjs additions: a share posted after opening shows in Up next within one check (the test shortens the interval through a data attribute); Next plays it with autoplay=1; a second addition plays next; then Next resumes at the track after the one that was current; Previous walks back through what played; an aborted check shows the notice and a later check recovers; a mark made before opening never appears; flag off makes no checks.

  • Estimate details: driver: queue and history edge cases; uncertainty: medium.

  • Risks or open questions:

    • Impact: an inserted track also sits later in the newest-first queue and plays twice. Early warning: test with a Play next on an older track. Mitigation: the played set skips it when the queue reaches it.

  • Canonical components/API contracts touched: public/assets/music_slides.js (extended), media_embed_inline_player.js (reused through the existing start path), music-slides.css.

Stage 3 – Play next on /music/ rows

Estimate: 0.10

  • Goal: a Play next button on each playable Music row posts a #playnext reply and returns to /music/ with that row marked Queued.

  • Dependencies: Stage 1.

  • Expected changes: music.php passes a Play next form into each playable row through a new optional rowAction slot in thread_row.php (a plain form: thread_id, parent_id, body #playnext, board_tags music, return_to /music/?queued=<id>). resolveComposeReplyReturnTo returns to /music/?queued=<id> for a #music thread when asked. The row named by queued shows "Queued" in place of the button. With JavaScript, the share box's signing scripts sign it as they sign a share; without, it posts as guest.

  • Verification approach: MusicPageTest: rows with a player have the form, text rows do not; flag off hides it; the queued row shows Queued. Compose test: a guest #playnext reply on mitrapclub succeeds and returns to /music/?queued=…; a forged return_to for a non-music thread goes to the thread. music_share.mjs still passes; the browser test taps Play next and sees Queued. Record whether mitrapclub sets the activity drawer flag.

  • Estimate details: driver: compose return rule and row slot; uncertainty: medium (guest reply rules).

  • Risks or open questions:

    • Impact: lazy signing may not cover a second form on the page. Early warning: the browser tap with a key present. Mitigation: if it does not, post as guest and record it.

  • Canonical components/API contracts touched: templates/partials/thread_row.php (new optional slot), templates/pages/music.php, Http/ComposeAndAccountKeyController.php (resolveComposeReplyReturnTo), lazy signing scripts (reused).

Stage 4 – Concept update and the meeting replay

Estimate: 0.05

  • Goal: record the feature and replay the known environment.

  • Dependencies: Stages 1–3.

  • Expected changes: docs/concepts/music_section.md additions and Play next paragraph; Step 4 summary; ledger closeout.

  • Verification approach: after deploy, at a meeting: the room laptop runs Play all signed out; a phone shares a link and another taps Play next as a guest; both reach Up next and play. Pending until then; workspace tests do not count.

  • Estimate details: driver: waiting on a meeting; uncertainty: low for the work.

  • Risks or open questions: none new.

  • Canonical components/API contracts touched: concept file only.

— Claude · 2026-11-29 UTC · Model: claude-opus-5-5