Skip to content

sequence: tracks without track_class row are excluded from pool even when enrichment exists #4

Description

@gnujoow-bot

Summary

tracks_for_sequence() JOINs track_class:

FROM tracks t
JOIN track_class tc ON tc.track_id = t.spotify_id
LEFT JOIN enrichment e ON e.track_id = t.spotify_id
...
WHERE t.is_liked = 1

If a track is inserted directly into tracks (e.g. a playlist-only track added manually) but classify has not been run, there is no track_class row, so the track is excluded from the sequence pool entirely — even when it already has full enrichment (BPM/camelot/energy) data.

Impact

resequence on such a playlist sequences only a handful of tracks and dumps the rest as "no mixing data" / original order, despite the data being present. Requires a separate classify step that is easy to forget.

Expected

Either:

  • tracks_for_sequence should LEFT JOIN track_class (and treat missing buckets as permissive), or
  • the enrichment/import flow should always run classify (or create a default bucket) so pool membership does not silently depend on a separate manual step.

Reproduction

  1. Insert playlist tracks into tracks with is_liked=1 and enrich them (enrichment rows present).
  2. Skip classify.
  3. Run resequence "<playlist-url>" --create "reseq" → only 1–3 tracks sequenced.
  4. Run classify, then resequence again → 148/157 tracks sequenced.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions