Skip to content

fix(playlist): a filtered playlist plays and highlights the wrong track - #255

Merged
sydevs-bot merged 19 commits into
mainfrom
claude/fix-249-playlist-index
Nov 18, 2026
Merged

sydevs-bot merged 19 commits into
mainfrom
claude/fix-249-playlist-index

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A filtered row now reports its index in tracks, so the right track plays and is highlighted.
  • Joined: the player ignored its track index after mount, so no playlist click ever changed the audio.
  • Joined: a row click from a paused player loaded the track and left it silent — the loaded row too.
  • Joined: every production playlist row printed 0:00, because no song states a duration.
  • Review: the playing track now has one owner. MusicLibrary holds the player hook, and AudioPlayer renders what it holds.
  • Review: clicks and skips are now under test, in jsdom with @testing-library/react, opted into per file.
  • Joined: the playing row carries aria-current, so it is no longer marked by colour alone.

Change outline

The index a playlist row reported and the index the player read were two different things, and there were two of the second one. Now there is one index, in one place, and every part reads it there.

Components — one owner for the playing track

 MusicLibrary                                  components/organisms/MusicLibrary/MusicLibrary.tsx
+  usePlaylistAudioPlayer(...)                 # the owner, inside AudioPlayerProvider
-  useState(currentTrackIndex)                 # a second copy, mirrored from the player
   Playlist                                    components/molecules/Playlist/Playlist.tsx
-    filteredTracks.map((track, index))        # index = position in the FILTERED list
+    visibleTracks(tracks, selectedFilter)     # [{ track, index in `tracks` }]
       isCurrentTrack = index === state.currentTrackIndex
+        → aria-current="true" on the row      # was a colour change only
-      onTrackClick(index)                     # into MusicLibrary's copy
+      onTrackClick = controls.selectTrack     # straight into the owner
-      key = index
+      key = track.url
-      duration printed always                 # `0:00` on every production row
+      duration printed only when the track states one
   AudioPlayer                                 components/molecules/AudioPlayer/AudioPlayer.tsx
-    usePlaylistAudioPlayer(...)               # held the second copy, synced by prop + callback
+    renders `state`, calls `controls`         # presentational
   usePlaylistAudioPlayer                      hooks/audio/usePlaylistAudioPlayer.ts
-    follow `requestedTrackIndex`, ignoring an echo of our own move
     selectTrack(index)                        # picking a track plays it
+      index is the loaded one → play()        # an unchanged index never reaches the load effect
+      otherwise → wasPlayingRef = true, setCurrentTrackIndex(index)
     next / previous / track end → setCurrentTrackIndex

Contract — who holds the track index

 AudioPlayerProps                              components/molecules/AudioPlayer/AudioPlayer.tsx
-  tracks, shuffle, initialTrackIndex, onTrackChange
+  state: PlaylistAudioPlayerState        # from usePlaylistAudioPlayer
+  controls: PlaylistAudioPlayerControls
   disabledControls?: AudioControl[]      # names 'shuffle' outright, where `shuffle` used to imply it
 UsePlaylistAudioPlayerOptions                 hooks/audio/usePlaylistAudioPlayer.ts
   tracks, shuffle, onPlaybackTimeUpdate  # no index in, and none reported back
 PlaylistAudioPlayerState                      components/molecules/AudioPlayer/types.ts
+  trackCount: number                     # AudioPlayer no longer holds `tracks`
 PlaylistProps                                 components/molecules/Playlist/Playlist.tsx
   currentTrackIndex: number              # unchanged — a position in `tracks`
   onTrackClick: (index) => void          # unchanged — a position in `tracks`

MusicLibrary is AudioPlayer's only consumer outside the stories, and MeditationPlayer sits on useAudioPlayer rather than this hook, so nothing else sees the new shape. The cost is that a consumer now wires the hook and the AudioPlayerProvider itself; AudioPlayer.stories.tsx carries that wiring as PlaylistPlayer, which is the shape to copy.

Preview

Both branch aliases, read from the Cloudflare Workers Builds check summaries. A branch alias follows the branch, so each serves this push once its build finishes.

  • Music Library story — the real wiring: pick Wind, click the second visible row, and the art, the highlight and the audio should agree
  • Playlist story — the component alone, where the story's onFilterChange sets a filter but never clears one. Its Without durations section is what a production row now looks like
  • App build — no deep link: MusicLibrary renders only on a page carrying a songs content-index block, and this run could not name one from the repo alone

Test results

  • Lean gate: ✓ .claude/skills/pr-prep/check.sh — eslint 0 errors, tsc --noEmit clean, 1050 tests
  • Targeted specs: MusicLibrary.test.tsx 3, usePlaylistAudioPlayer.test.ts 5, Playlist.test.tsx 10 — all pass
  • Build: ✓ pnpm build; no test dependency reaches dist/server

Each interaction spec fails against the defect it guards, measured by restoring the old code on the branch: the filtered-position index fails the filtered-click and filter-cleared specs, selectTrack copying playerState.isPlaying fails the filtered-click spec's autoplay: true, and dropping the loaded-row branch fails plays the loaded track in place.

Manual verification

All four steps were driven headlessly against the built playground after the ownership rework, reading both the DOM and Howler's own state. What stays for a human is that audio is audibly playing — the sample mp3s are remote and this environment could not play them.

  1. Music Library story → pick Wind → click the second visible row. Art, highlight and audio must all be Flute Meditation. ✓ art and highlight read Flute Meditation, and Howler._howls held SoundHelix-Song-5.mp3, which is that row's url.
  2. With a filter picked and a row clicked, clear the filter. The highlight and the playing track must not move. ✓ the highlight stayed on Flute Meditation across the full list.
  3. Press the player's next, then previous. The art and the highlight must follow each move, and playback must keep going. ✓ both followed; shuffle is on, so next went to String Symphony and previous came back.
  4. From a paused player, click any row — including the highlighted one on a fresh load. It must start playing, not stay silent. ✓ for another row: the player held SoundHelix-Song-1.mp3 stopped; after the click playing() was true and the transport button read Pause. The highlighted-row case is covered by a spec, not yet by ear.

Notes for reviewer

  • The test-coverage thread is built as B. jsdom and @testing-library/react are dev dependencies; the default environment stays node, and a file opts in with // @vitest-environment jsdom. The specs replace hooks/audio/useAudioPlayer with a recorder, because Howler never plays under jsdom. docs/rules/testing.md now describes the opt-in in place of "do not reach for them".
  • jsdom is held at ^29. jsdom 30 and 31 require Node ^22.22.2, above the 22.17.0 .node-version pins for CI. happy-dom 21 is already in the tree through @lexical/headless, and both new spec files pass under it unchanged — it was not taken because the thread asked for jsdom, but it is the lighter choice if you would rather not carry two DOM implementations.
  • A same-row click was still silent, found by this pass's review: selectTrack only changed the index, so the row already loaded — the first one, on a fresh paused player — never reached the load effect. That row now plays in place.
  • The ownership question is answered and built. You asked for the simplest durable answer, which is C: MusicLibrary holds the hook, AudioPlayer is presentational. A row click now arrives as controls.selectTrack(index), so the intent to hear a track travels as a call rather than as a number the player has to interpret — the thing that broke twice. requestedTrackIndex, onTrackChange, the follow effect and the echo guard are all gone.
  • The ticket's premise was half right. It reads the symptom as one bug. Fixing only the index mapping leaves acceptance criterion 1 unmet, because initialTrackIndex seeded the player's state once: before this branch a playlist click never changed the audio at all, filter or no filter. Measured in the browser — the art read Flute Meditation while Howler still held SoundHelix-Song-1.mp3.
  • Criterion 6 is now measured. @eslint-react/no-array-index-key reached main with chore(deps): move off the end-of-life eslint 9 line #251: it reports key={index} on main's Playlist.tsx:157, and nothing on this branch.
  • key={track.url} rests on an invariant nothing enforces. Non-empty is guaranteed (contentIndexTrack drops a song with no url), uniqueness is not. It carries a shortcut: marker with its trigger. Track has no id; contentIndexTrack receives doc.id and discards it, so giving it one is the deeper fix if duplicates ever appear.
  • A real duration needs a field upstream. contentIndexTrack sets duration: 0 because SahajCloud's Song type carries no duration field, and the player reads its own duration off the audio element, which a playlist row cannot. So a row now prints a duration only when the track states one, and every production row shows none until SahajCloud gains the field. Track.duration now documents 0 as "unknown", the sentinel MeditationPlayer already reads the same way.
  • fix(player): a track change during a load cancels the auto-resume #256 needs an edit before anyone builds it. Its criterion "a track clicked while paused does not start playing" and its body's follow effect both predate this branch's selectTrack, which always plays and has no follow effect. A run that builds it as written would revert the decision.
  • Follow-ups this pass found, not built here — each predates the branch or reshapes more than fix(playlist): a filtered playlist plays and highlights the wrong track #249 asks:
    • The filter never reaches the player: with Wind on, next and auto-advance leave the filtered list, and no row highlights.
    • Position is still the identity of the playing track: a same-length reorder of tracks plays whatever now sits at the index, and a shrink below it throws in MusicLibrary. Holding the track (url or doc.id) in the hook would remove both, and the filter fix above wants it first.
    • AudioPlayerProvider is vestigial: react-use-audio-player 4's useAudioPlayer never reads its context, so each wrapper (here and in MeditationPlayer) mounts one unused player.
Detail

Why visibleTracks is still exported. It predates the jsdom lane, when a static render was the only way to reach the index a row reports. The interaction specs now cover the click through the real component, but the pure pairing stays the cheapest place to pin the mapping for untagged and unmatched tracks. It is exported from Playlist.tsx only — neither Playlist/index.ts nor the molecules barrel re-exports it, so the design-system surface is unchanged. Precedent: buildLightboxSlide in components/atoms/Image/Image.tsx.

The fixture's assumption, checked. Track.tags[].id is the SongTag slug, and the same slug becomes MusicFilter.id. Verified against contentIndexTrack (lib/content-blocks.ts:633-663) and songMusicFilters (components/organisms/RichText/blockConverters.tsx:80-94), both read on this branch. The five fixture tracks interleave two facets so that a filtered row's position never equals its index — the second visible wind row is index 4.

Rejected: useMemo around visibleTracks. PlaylistItem is not memoized and takes track/onTrackClick directly, so a stable array identity has no consumer; and on the Worker there is one render per request, where useMemo is pure overhead. The pairs are a low single-digit fraction of what each row already allocates.

Rejected for now: memo(Playlist). Hoisting the hook moved the player's 10 Hz currentTime poll into MusicLibrary, so each tick now re-renders every row. Measured at 0.22 ms per tick for 40 tracks and 0.42 ms for 100 (production React, jsdom), against 0.05 ms on main; memo(Playlist) with a stable handleFilterClick brings it to 0.07 ms. Left out because the cost is small and the repo has no memo yet, so it would set a precedent worth its own decision.

Rejected: keeping key={index}. With the fix, index is the position in tracks and would be stable across filter changes, so it would work. The ticket asks for the track's own value, and a content key lets React move surviving rows rather than patch them by position when a filter changes.

Rejected: a flatMap one-pass pairing. Saves an intermediate array and reads worse at this list size.

Rejected: a controlled/uncontrolled trackIndex prop — option B on the ownership thread. It keeps AudioPlayer self-contained, but an index arriving as a changed prop still cannot say whether the consumer means "show this" or "play this": a row click from a paused player would need a second ref to recover that intent, which is the guard again under another name. A method call carries it for free.

Rejected: an autoplay option on selectTrack. A knob with one caller, and the only caller wants it on. Picking a track is a request to hear it, so selectTrack now always plays. next and previous keep resume semantics, because they continue whatever the player was doing.

Dismissed findings. A review suggested dropping the visibleTracks export and covering untagged/unmatched tracks through the component by giving render() a tracks argument — declined, because the click target would then only be inferred from the highlight, and criterion 5 asks for both. Another suggested hoisting usePlaylistAudioPlayer into MusicLibrary and making AudioPlayer presentational — asked as a question thread, and built once the reviewer chose it. This pass's /code-review high raised four more, declined: key={track.url} against key={index} (decided above, with its shortcut: trigger); AudioPlayer no longer hiding shuffle by itself (MusicLibrary is its only consumer and names 'shuffle' in disabledControls, per the contract above); the visibleTracks export costing Fast Refresh on Playlist.tsx (the precedent above, and a dev-only reload); and making Track.duration optional (0 is the shared sentinel MeditationPlayer reads too, and the real fix is the upstream field). Converting Playlist.test.tsx's string parser to Testing Library was prototyped and declined: it saves nine lines and moves a markup contract off the server render the testing rule prefers.

An anomaly worth recording. One headless run logged Howl load error: 4 while fetching a soundhelix.com sample; earlier and later runs did not. The sample host is remote and this sandbox's egress to it is not guaranteed. The index wiring still read correctly on that run.

Closes #249

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

`currentTrackIndex` and `onTrackClick` index `tracks`, but the rendered
rows carried their position in the filtered list. With a filter active
the two disagreed, so the "now playing" highlight marked the wrong row
and a click reported the wrong track.

`visibleTracks` pairs each track with its index in `tracks` in the one
place that knows both, leaving `PlaylistProps` unchanged. The row key
becomes the track's own url, which the filter does not reshuffle.

Refs #249

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYWgyjsJfFMYcyqmLC
`AudioPlayer`'s `initialTrackIndex` seeded `usePlaylistAudioPlayer`'s
state once, so `MusicLibrary` could show a new track's art and highlight
while the previous one kept playing. A playlist click changed the audio
never, filter or no filter, which is the other half of #249's symptom.

The prop becomes `trackIndex`, which the hook follows through the same
`selectTrack` path its own next and previous use, so playback resumes on
the new track. The hook still owns the index, because it moves it itself
on next, previous and track end.

`MusicLibrary` is the only caller, and `MeditationPlayer` sits on
`useAudioPlayer` instead, so no other consumer sees the rename.

Refs #249

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYWgyjsJfFMYcyqmLC
…ract

Applied from the /simplify pass and the altitude review:

- Playlist.test.tsx drops the assertions the render tests already pinned,
  hoists `playingTitles`, and replaces a "set then clear a filter" name
  with what a pure SSR render can actually show.
- `trackIndex` says in both JSDocs that it is followed but not fully
  controlled, so a consumer must echo `onTrackChange`.
- `key={track.url}` carries a `shortcut:` marker: `Track` has no id, and
  nothing upstream guarantees two songs cannot share an upload.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYWgyjsJfFMYcyqmLC
`MusicLibrary` feeds `onTrackChange` straight back as `trackIndex`, so
the follow effect fired on the hook's own next, previous and track-end
moves too. Each one re-entered `selectTrack` while the new track was
still loading, where `isPlaying` reads false, clearing the auto-resume
flag the move had just set.

Comparing against the index the hook already holds leaves an echo alone
and acts only on a real request.

Found by the /code-review pass on this branch.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYWgyjsJfFMYcyqmLC

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 questions for the reviewer, one per thread.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread hooks/audio/usePlaylistAudioPlayer.ts Resolved
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-design fe86bc1 Commit Preview URL

Branch Preview URL
Nov 18 2026, 08:06 PM

@sydevs-bot

sydevs-bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running
CI fix 1

recent dispatches
  • 20:01Z resolve-conflicts · attempt 1 · session · done
  • 20:01Z resolve-conflicts · attempt 1 · session
  • 19:56Z fix-ci · attempt 1 · session · done
  • 19:56Z fix-ci · attempt 1 · session
  • 19:51Z resolve-conflicts · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-web fe86bc1 Commit Preview URL

Branch Preview URL
Nov 18 2026, 08:06 PM

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 18, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

The index fix is right and no bigger than #249: visibleTracks is the one place that knows both index spaces, and four render tests fail against the old mapping. The joined player fix is what to weigh. It leaves two copies of one index — MusicLibrary's and the hook's — tied by an effect going down and onTrackChange coming up, plus a guard suppressing the hook's own echo. One owner needs none of that. My answer to the hook thread is C, which also retires disabledControls={['trackInfo']}; B if AudioPlayer's shape must stay. I have not duplicated the two question threads.

Findings

  • should-fix — a row click from a paused player selects without playing, against criterion 1. hooks/audio/usePlaylistAudioPlayer.ts:152
  • should-fix — trackIndex names a controlled prop that is not controlled. components/molecules/AudioPlayer/AudioPlayer.tsx:37
  • consider — every playlist row renders 0:00 in production. contentIndexTrack returns duration: 0 (lib/content-blocks.ts:665), nothing fills it, Playlist.tsx:107 prints it. Fixtures all carry real durations, so Ladle and CI look right. Pre-existing: hide a zero, or file the upstream Song field.

What was checked

Criteria 1–5 hold; 6 unmeasurable, as the body says. Read whole on the branch: the five touched files plus useAudioPlayer.ts. Ladder: no index-pairing helper in lib/ or hooks/, and React has no prop-follow primitive, so both new pieces are the approach, not duplication; the visibleTracks export holds, because a node-env render cannot observe a click handler. git grep gives MusicLibrary.tsx:93 as the renamed prop's only caller, and no story or doc names initialTrackIndex. The body's two cited path ranges check out. preview-host.mjs could classify nothing: no previewUrl in this repo's .claude/workflow.json.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread hooks/audio/usePlaylistAudioPlayer.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 18, 2026
`selectTrack` copied the momentary `playerState.isPlaying` into
`wasPlayingRef`, which `load` passes as `autoplay`. A click from a paused
player therefore loaded the track and left it silent, against #249's first
acceptance criterion. Picking a track is a request to hear it, so it now
autoplays unconditionally; `next` and `previous` keep resume semantics,
since they continue whatever the player was already doing.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWvtTogiAv1QB7tmQb
`trackIndex` is React's name for a fully controlled value, and this one is
not: the player moves the index itself on next, previous and track end,
which is why the JSDoc needed three lines telling the consumer to echo
`onTrackChange` back. The name now says what the prop is — a request the
player follows — and the caveat shrinks to the drift it still warns about.
`MusicLibrary` is the only caller.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWvtTogiAv1QB7tmQb
`contentIndexTrack` hands every song `duration: 0`, because SahajCloud's
Song type has no duration field, so each production playlist row printed
`0:00`. Every fixture and story carries a real duration, which is why
Ladle and CI always looked right. A row now prints a duration only when
the track states one; filling it needs a duration field upstream.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWvtTogiAv1QB7tmQb
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Three findings from the adversarial review, all built. origin/main merged in clean, so the gate ran on the merged tree.

The two question threads still wait on you — who owns the player's index, and how player behaviour should be tested. A stands built in both.

Lean gate ✓ 984 tests, pnpm build ✓, pnpm ladle:build ✓.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review November 18, 2026 01:30
@sydevs-bot
sydevs-bot requested a review from Ardnived November 18, 2026 01:30
@sydevs-bot
sydevs-bot enabled auto-merge November 18, 2026 01:30
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 18, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 18, 2026
The index lived twice — in MusicLibrary and in the player's hook — tied by a
prop going down, onTrackChange coming up, and a guard suppressing the hook's
own echo. That pairing is what played one track and highlighted another.

usePlaylistAudioPlayer now owns the index outright, and the component that
renders the player, the playlist and the album art holds the hook. A row click
reaches it as controls.selectTrack, so the intent to hear a track travels as a
call rather than as a number the player has to interpret. AudioPlayer renders
what the hook holds.

The sync channel goes with it: requestedTrackIndex, onTrackChange, the follow
effect and the echo guard are all gone. The shuffle prop went too — it only
hid the shuffle control, which disabledControls says outright.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWaSe8pi4pDfZm8qpv
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Both answers are in, one built and one blocked.

  • Ownership → C, built in b736059. MusicLibrary holds usePlaylistAudioPlayer, AudioPlayer renders state and calls controls, and a row click is controls.selectTrack(index). requestedTrackIndex, onTrackChange, the follow effect and the echo guard are gone. Thread resolved.
  • Tests → B, recorded but not built. This environment's permission guard refuses every package install, so jsdom and @testing-library/react need an attended run. That thread stays open, with the steps.

No spec can click here, so the rework was measured in a browser. Picking Wind and clicking the second row left the art, the highlight and Howler all on Flute Meditation; from a paused player that click started playback.

Gate green: eslint 0 errors, tsc clean, 984 tests, plus pnpm build and pnpm ladle:build. The body's outline and contract are rewritten.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 18, 2026
`main` #207 added `MusicLibrary.test.tsx` and `AudioPlayer.test.tsx` to pin
the `sizes` each component advertises. This branch had already written a
`MusicLibrary.test.tsx` of its own, and had replaced `AudioPlayerProps`
`tracks` with the `state`/`controls` pair.

MusicLibrary.test.tsx keeps both suites in one file. The album-art spec is
unchanged beyond a fixture rename, and `renderToStaticMarkup` is a server
render whatever environment holds it, so the file's jsdom opt-in leaves that
markup contract where it was.

AudioPlayer.test.tsx keeps `main`'s assertion and states the player pair the
spec needs. `<AudioPlayer tracks={[track]} />` no longer type-checks, and the
48px box it measures is unaffected by who owns the track index.

The component hunks merged clean: `MusicLibrary.tsx` carries the new `sizes`
inside the hoisted hook, and `AudioPlayer.tsx` keeps its 48px thumbnail while
reading `state.currentTrack`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZYuTjX2vtP6zEpMYz
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged main in. The conflict was MusicLibrary.test.tsx, which both sides added.

  • Both suites live in one file, under this branch's jsdom opt-in. fix(image): six paths skip the variant pipeline, four over-fetch #207's album-art spec is unchanged beyond a fixture rename: renderToStaticMarkup is a server render whatever environment holds it, so that markup contract has not moved off the node lane in substance.
  • AudioPlayer.test.tsx merged clean but did not compile. fix(image): six paths skip the variant pipeline, four over-fetch #207 added it against <AudioPlayer tracks={[track]} />, which this branch replaced with the state/controls pair. It now states that pair inline. The 48px box it measures is untouched by who owns the track index.
  • The component hunks took both sides as written — MusicLibrary.tsx carries the new sizes inside the hoisted hook.

Lean gate green: 1107 tests, eslint 0 errors, tsc clean.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 18, 2026
Merging main brought in the thumbnail-sizes spec #207 added, written
against the `tracks` prop this branch replaced. AudioPlayer is now
presentational, so the spec builds the state and controls the hook would
hand it. Its three assertions are unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYpgD65LmAMV3o2pLU
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 18, 2026
Two files conflicted, both against #199's contrast pass and main's
reformat.

Playlist.tsx keeps this branch's behaviour and main's colours: the
duration still renders only when the track states one, now in
text-teal-50 / text-gray-700; the row keeps aria-current and
key={track.url}.

AudioPlayer.stories.tsx takes main's structure with PlaylistPlayer in
every slot, since AudioPlayer is presentational on this branch and
needs the hook wiring.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXN8zWk1jS1XF5NBW3
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged main in. Two files conflicted, both against #199's contrast pass.

  • Playlist.tsx — kept this branch's conditional duration, aria-current and key={track.url}, and took main's text-teal-50 / text-gray-700 so the AA pairs hold.
  • AudioPlayer.stories.tsx — took main's structure with PlaylistPlayer in every slot. AudioPlayer is presentational on this branch, so it cannot be rendered without the hook wiring.

Lean gate green: eslint 0 errors, tsc --noEmit clean, 1135 tests.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 18, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 18, 2026
Merged via the queue into main with commit 2f63a80 Nov 18, 2026
24 checks passed
@sydevs-bot
sydevs-bot deleted the claude/fix-249-playlist-index branch November 18, 2026 21:16
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 18, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 18, 2026
…-auto-resume

#255 landed on main and rewrote the same hook, so three hunks had a choice
to make. The reviewer answered the question thread with **B**: a row click
always starts playback.

- `selectTrack` keeps #255's body — it raises the resume flag
  unconditionally, and plays in place when the picked row is already
  loaded. #256's third acceptance criterion is dropped, per that answer.
- The in-place play goes through this hook's `play`, not
  `playerControls.play`. The core control sets no intent, so a skip
  arriving during that load would have gone silent — the defect #256
  closes.
- `selectTrack` drops its `useCallback`, matching the three controls this
  branch already unmemoized: `playerControls` changes identity every
  render, so the memo never held.
- The hook test takes #255's jsdom harness. Its `carries playback across a
  skip` case asserted autoplay copied from `playerState.isPlaying`, which
  is the defect stated as a requirement, so it becomes two cases on what
  the listener last asked for, plus the two-skips-inside-one-load
  regression. The source-scan test it replaces is gone: the branch could
  not drive a DOM when it was written, and now can.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjY4Sv1i332csJS5sjt
sydevs-bot pushed a commit that referenced this pull request Nov 18, 2026
#256's fourth criterion — a track that ends advances and keeps playing —
had only a browser scenario behind it. The jsdom harness #255 brought
reaches it: the recorder holds the `onEnd` the load registered.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjY4Sv1i332csJS5sjt
sydevs-bot pushed a commit that referenced this pull request Nov 18, 2026
#255 landed on main and rewrote `selectTrack` in
`hooks/audio/usePlaylistAudioPlayer.ts`. The merged body is main's, so the
dependency array is main's too: this branch's `[playerState.isPlaying]` named a
value the new body never reads.

Everything else auto-merged. The branch's derived `playOrder` and stored
shuffle survive beside main's index ownership.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZa1C7bwUKs2uxtdKu
sydevs-bot pushed a commit that referenced this pull request Nov 18, 2026
Answers the eslint.config.js question thread on #265: option B, in this PR
rather than a follow-up. #255 merged, so Playlist.tsx:152 is gone and
no-array-index-key reports zero — the last thing blocking the promotion.

All three report zero on this branch, so the ratchet closes with no new
suppression. A rule left at warn records a violation nobody is stopped by:
`eslint .` exits 0 on warnings and 1974 others are already there.

Watched failing: a probe component with `key={index}`, a `setState` in an
Effect and a dep array missing its read now produce three errors, one per
rule.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXgmgR87TRD9NczmHe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

fix(playlist): a filtered playlist plays and highlights the wrong track

3 participants