docs(quick-14): complete queue/player desync fix plan
This commit is contained in:
+4
-3
@@ -62,17 +62,18 @@ Decisions from v1.0 are archived in PROJECT.md Key Decisions table. Key patterns
|
||||
| 011 | Fix neovim crash during library scan (configurable log level) | 2026-03-05 | c45bca4 |
|
||||
| 012 | Add favorite icon to album dropdown track rows | 2026-03-05 | 12a0bbc |
|
||||
| 013 | Fix all golangci-lint issues (zero issues) | 2026-03-05 | e1a95e6 |
|
||||
| 014 | Fix queue/player desync after track load failure | 2026-03-05 | 2820de2 |
|
||||
|
||||
## Session Continuity
|
||||
|
||||
### Last Session
|
||||
|
||||
**Date:** 2026-03-05
|
||||
**What happened:** Quick task 13 — fixed all 31+ golangci-lint issues across 12 Go files. Mechanical fixes only (errcheck, golines, gofumpt, wsl, nlreturn, intrange, unused). Zero behavioral changes.
|
||||
**Where we stopped:** Quick task 13 complete. `golangci-lint run ./...` reports 0 issues.
|
||||
**What happened:** Quick task 14 — fixed queue/player desync after track load failure. Added roll-back-on-failure semantics to all queue index advancement paths (Next, Previous, OnPlaybackFinished, PlayIndex, playFromStart). `playCurrentTrack` and `playOrLoadCurrentTrack` now return bool.
|
||||
**Where we stopped:** Quick task 14 complete. All 28 queue tests pass, go vet clean.
|
||||
**Next action:** Continue with next task
|
||||
|
||||
---
|
||||
*State initialized: 2026-02-27*
|
||||
Last activity: 2026-03-05 - Fix all golangci-lint issues
|
||||
Last activity: 2026-03-05 - Fix queue/player desync after track load failure
|
||||
*Last updated: 2026-03-05*
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
phase: quick-14
|
||||
plan: 14
|
||||
subsystem: queue
|
||||
tags: [bug-fix, queue, player-sync, rollback]
|
||||
dependency_graph:
|
||||
requires: []
|
||||
provides: [roll-back-on-failure-pattern]
|
||||
affects: [backend/queue]
|
||||
tech_stack:
|
||||
added: []
|
||||
patterns: [roll-back-on-failure for index advancement]
|
||||
key_files:
|
||||
created: []
|
||||
modified:
|
||||
- backend/queue/queue.go
|
||||
- backend/queue/handlers.go
|
||||
decisions:
|
||||
- Extended roll-back pattern to PlayIndex and playFromStart (not in plan but same bug pattern)
|
||||
metrics:
|
||||
duration: 567s
|
||||
completed: "2026-03-05"
|
||||
tasks_completed: 2
|
||||
tasks_total: 2
|
||||
---
|
||||
|
||||
# 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 returns `bool` — false on load failure or play error
|
||||
- `playOrLoadCurrentTrack()` now returns `bool` — propagates from `playCurrentTrack`/`loadCurrentTrack`
|
||||
- `loadCurrentTrack()` already returned `bool` — no change needed
|
||||
|
||||
### Task 2: Add roll-back-on-failure to all index advancement call sites (2820de2)
|
||||
|
||||
- **Next()**: Saves `prevIndex` before 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()` and `playFromStart()` had the same desync bug — they set `currentIndex` and called `playCurrentTrack()` without checking the return, then emitted `QueueIndexChanged` unconditionally
|
||||
- **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/...` — passes
|
||||
- `go test ./backend/queue/... -v -count=1` — 28/28 tests pass
|
||||
- `go vet ./backend/queue/...` — no warnings
|
||||
|
||||
## Self-Check: PASSED
|
||||
|
||||
All files exist, all commits verified.
|
||||
Reference in New Issue
Block a user