2.4 KiB
2.4 KiB
phase, plan, subsystem, tags, dependency_graph, tech_stack, key_files, decisions, metrics
| phase | plan | subsystem | tags | dependency_graph | tech_stack | key_files | decisions | metrics | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| quick-14 | 14 | queue |
|
|
|
|
|
|
Quick Task 14: Fix Queue/Player Desync After Track Load Failure
Roll-back-on-failure semantics for all queue index advancement paths, ensuring currentIndex always reflects the track the player actually has loaded.
What Changed
Task 1: Make playOrLoadCurrentTrack and playCurrentTrack return bool (6eeddda)
playCurrentTrack()now returnsbool— false on load failure or play errorplayOrLoadCurrentTrack()now returnsbool— propagates fromplayCurrentTrack/loadCurrentTrackloadCurrentTrack()already returnedbool— no change needed
Task 2: Add roll-back-on-failure to all index advancement call sites (2820de2)
- Next(): Saves
prevIndexbefore advancing; rolls back on failure; RepeatOne path guards emit - Previous(): All three branches (RepeatOne, restart >3s, navigate-to-previous) guard emit or roll back
- OnPlaybackFinished(): RepeatOne path guards emit; main advance path rolls back on failure
- PlayIndex(): Rolls back to previous index on failure
- playFromStart(): Rolls back to -1 on failure
Deviations from Plan
Auto-fixed Issues
1. [Rule 1 - Bug] Extended roll-back to PlayIndex and playFromStart
- Found during: Task 2
- Issue:
PlayIndex()andplayFromStart()had the same desync bug — they setcurrentIndexand calledplayCurrentTrack()without checking the return, then emittedQueueIndexChangedunconditionally - Fix: Applied the same roll-back pattern: save previous index, attempt load, roll back on failure
- Files modified: backend/queue/queue.go
- Commit:
2820de2
Verification
go build ./backend/...— passesgo test ./backend/queue/... -v -count=1— 28/28 tests passgo vet ./backend/queue/...— no warnings
Self-Check: PASSED
All files exist, all commits verified.