fix: seed playlist channels in group-pane order, not alphabetically#40
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A newly-created playlist laid out its groups in provider group order (
groups.position_order) but its flat channel list in alphabeticalgroup_titleorder — 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 channelsORDER BY group_title, id(alphabetical), but the playlist's groups are seeded ingroups()order (position_order).seedFromProvider()assigns each channel its flatposition_orderin stream order, so the channel order followed the alphabet, not the group order.Fix
streamForSeed()now orders by the group'sposition_order—ORDER BY COALESCE(g.position_order, 1e12), group_title COLLATE NOCASE, id— matchinggroups()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
test_seed_flat_order_follows_group_order_not_alphabetical— fixture seeds groupsUS-ENT(10)beforeCANADA(20)(deliberately non-alphabetical); asserts the flat order leads with the US-ENT block.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].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