Repository navigation
docs: align resume-marker comments with actual latch behavior (#788) - #789
Merged
Merged
Conversation
The _resume_applied latch is consumed on the first playlist build after startup regardless of shuffle mode or an empty playlist; resume only fires when that first build is non-shuffle with a non-empty playlist. Update the __init__ comment and _apply_resume_position docstring to state this, so they stop promising 'applied on the first non-shuffle build' which the code does not deliver. Toggling shuffle off is a clean restart by design. No behavior or test changes. Follow-up to #786 (PR #787 Sourcery review discussion_r4037863165).
Reviewer's guide (collapsed on small PRs)Reviewer's GuideDocumentation-only clarification of playlist resume behavior: the startup latch is consumed on the first build of any kind, while resume takes effect only for a non-shuffle first build with media; no code or tests were changed. State diagram for startup resume latch behaviorstateDiagram-v2
[*] --> Unconsumed
Unconsumed --> ConsumedWithoutResume: First build with shuffle or empty playlist
Unconsumed --> Resumed: First non-shuffle build with non-empty playlist and marker
Unconsumed --> ConsumedWithoutResume: First non-shuffle build with non-empty playlist without marker
Resumed --> ConsumedWithoutResume: Later rebuild or restart_playlist
ConsumedWithoutResume --> ConsumedWithoutResume: Later rebuild or restart_playlist
Resumed --> [*]
ConsumedWithoutResume --> [*]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Summary
Documentation-only follow-up to #786 (PR #787). Addresses the Sourcery
bug_riskreview comment on #787 (discussion_r4037863165).The
_resume_appliedone-shot latch is consumed on the first playlist build after startup, regardless of shuffle mode or an empty playlist. Resume only fires when that first build is non-shuffle with a non-empty playlist. The previous comments/docstring promised "applied once, on the first non-shuffle build after startup", which the code does not deliver — if Picframe starts in shuffle mode or with no media, the latch is spent and a later non-shuffle rebuild starts at slot 0.After review this behavior is by design: toggling shuffle off mid-session is a clean playlist restart from slot 0, and resume is intentionally startup-only. So the fix is to make the docs honest, not to change the code.
Changes
src/picframe/core/services/playlist.py:__init__comment aboveself._resume_applied— states the latch is consumed on the first build of any kind, resume only fires on a non-shuffle non-empty first build, and a shuffled/empty first build spends the latch so a later non-shuffle rebuild starts at slot 0 (clean restart by design)._apply_resume_positiondocstring — corrects "Only applied on the first non-shuffle build after startup" to describe the actual consume-on-first-build behavior.No code or test changes.
Verification
python -m pytest test/core/services/test_playlist.py→ 38 passedpython -m mypy src/picframe/core/services/playlist.py→ Success, no issuespython -m ruff check/ruff format --check→ cleanCloses #788.
Summary by Sourcery
Enhancements: