feat(library): unified library_get_section command#40
Merged
pythoninthegrass merged 9 commits intomainfrom Apr 13, 2026
Merged
Conversation
Replace separate library_get_count + library_get_all calls with a single library_get_section Tauri command that returns tracks + authoritative stats (total_tracks, total_duration) in one SQLite transaction. - Add library_revision table with monotonic counter for cache invalidation - Add stats query functions for favorites, top25, recent, added, playlists - Bump revision on all library mutation paths (add/delete/favorite/playlist) - Add getSection() API method on frontend - Simplify store section loaders to use unified endpoint - Prefer backend-owned total_tracks/total_duration over JS computation - Add 14 Rust tests and 10 Vitest tests for the new command Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- library-operations.js: keep unified endpoint code, adopt main's totalTracks/totalDuration reset during loading - acl-manifests.json: take main's version (includes play_context command); library_get_section will be regenerated on next build Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…oint - Remove unused favorites and playlists imports from library store (unified endpoint handles all sections via library.getSection) - Update FOUC regression tests to mock library.getSection instead of library.getCount + store._fetchPage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The getSection method only had a Tauri invoke path and threw a 501 in non-Tauri environments. Playwright E2E tests run without a Tauri backend, so all accessibility tests timed out waiting for tracks to load. Add an HTTP fallback that composes existing /library + /library/count endpoints into the unified response shape. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The HTTP fallback for getSection always called /library + /library/count
regardless of section type. Playlist sections (playlist-{id}) need to
call /playlists/:id instead, matching the pre-existing REST endpoint
that E2E mock fixtures provide.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the hard throw in browser mode with a REST POST to /queue/play-context. Add corresponding Playwright route mock that builds queue items from library state, rotates to the start track, and returns the expected response shape. Fixes 10 pre-existing E2E failures where double-click-to-play timed out because playContext was unavailable without Tauri IPC.
handleDoubleClickPlay bypassed player.playTrack() (which contains the missing track modal check) by going directly to playContext. Add track.missing to the guard clause so missing tracks fall through to playTrack, which shows the missing track modal as expected.
When using the unified library_get_section backend command, the returned tracks are already authoritative for the requested section. Filtering them against the 'all' section's filteredTracks (via _filterByLibrary) incorrectly drops all tracks when the 'all' section hasn't been loaded or only has a partial first page. Skip the filter in both loadSection and backgroundRefreshSection when useUnified is true.
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
library_get_sectionTauri command that returns tracks + authoritative stats (total_tracks,total_duration) in a single SQLite transaction, replacing separatelibrary_get_count+library_get_allcalls that could read from different DB stateslibrary_revisiontable with monotonic counter bumped on every library mutation (add/delete/favorite/playlist), enabling revision-based cache invalidation on the frontendTest plan
cargo nextest run— 712/712 Rust tests passnpx vitest run— 441/442 frontend tests pass (1 pre-existing failure)🤖 Generated with Claude Code