Skip to content

fix: seed playlist channels in group-pane order, not alphabetically#40

Merged
mwlistscom merged 1 commit into
mainfrom
fix/seed-flat-order-follows-groups
Jul 20, 2026
Merged

fix: seed playlist channels in group-pane order, not alphabetically#40
mwlistscom merged 1 commit into
mainfrom
fix/seed-flat-order-follows-groups

Conversation

@mwlistscom

Copy link
Copy Markdown
Owner

Problem

A newly-created playlist laid out its groups in provider group order (groups.position_order) but its flat channel list in alphabetical group_title order — so the two disagreed. Reported live on playlist 34 (provider "Grey"): the group pane led with WORLD CUP while the channel list led with ARABIC.

Cause

ProviderStore::streamForSeed() ordered channels ORDER BY group_title, id (alphabetical), but the playlist's groups are seeded in groups() order (position_order). seedFromProvider() assigns each channel its flat position_order in stream order, so the channel order followed the alphabet, not the group order.

Fix

streamForSeed() now orders by the group's position_orderORDER BY COALESCE(g.position_order, 1e12), group_title COLLATE NOCASE, id — matching groups() exactly (orphan-group channels sort last; id order within a group). A fresh playlist's channel order now follows its group order. insertNewFromProvider() inherits the same order for appended new groups (within-group it's still id order — no behaviour change there).

Tests

  • New: test_seed_flat_order_follows_group_order_not_alphabetical — fixture seeds groups US-ENT(10) before CANADA(20) (deliberately non-alphabetical); asserts the flat order leads with the US-ENT block.
  • Updated: test_refresh_inserts_new_channels_into_group_and_new_group_at_end — expectations corrected from the old alphabetical order [3,4,5,1,2] to the group-following order [1,2,3,4,5].
  • Full suite: 273 tests, 946 assertions, 0 failures.

Note on existing playlists

Already-seeded playlists keep their stored order (this only changes new seeds). The one reported playlist was repaired in place with reindexChannels(true) (renumbers to group order, preserving within-group order) — non-destructive.

🤖 Generated with Claude Code

https://claude.ai/code/session_0189TuurZ7tt33g1pwbgesNh

A newly-seeded playlist laid its groups out in provider group order
(groups.position_order) but its flat channel list in alphabetical
group_title order, so the two disagreed — e.g. the group pane led with
"WORLD CUP" while the channel list led with "ARABIC". ProviderStore::
streamForSeed() now emits channels ordered by the group's position_order
(matching groups() exactly; orphan-group channels sort last, id order
within a group), so a fresh playlist's channel order follows its group
order. insertNewFromProvider() inherits the same order for appended new
groups.

- New test: seed flat order follows group order, not alphabetical.
- Updated test_refresh_inserts_new_channels_into_group_and_new_group_at_end
  expectations to the corrected (group-following) seed order.
- Full suite: 273 tests, 946 assertions, 0 failures.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0189TuurZ7tt33g1pwbgesNh
@mwlistscom
mwlistscom merged commit 1ebab6e into main Jul 20, 2026
3 checks passed
@mwlistscom
mwlistscom deleted the fix/seed-flat-order-follows-groups branch July 20, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant