Commit d42139e
feat(library): unified library_get_section command (#40)
* feat(library): add unified library_get_section command
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>
* fix(ci): remove unused imports and update FOUC tests for unified endpoint
- 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>
* fix(ci): prefix unused conn variable in test_section_unknown
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(ci): add HTTP fallback for getSection in Playwright E2E tests
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>
* fix(ci): handle playlist sections in getSection HTTP fallback
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>
* fix(e2e): add HTTP fallback for queue.playContext()
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.
* fix(e2e): route missing tracks through playTrack for modal display
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.
* fix: skip _filterByLibrary for unified backend section loads
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.
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent c900d0c commit d42139e
File tree
17 files changed
+1397
-99
lines changed- app/frontend
- __tests__
- js
- api
- stores
- utils
- tests/fixtures
- crates/mt-tauri/src
- db
- library
17 files changed
+1397
-99
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
| 572 | + | |
| 573 | + | |
572 | 574 | | |
573 | 575 | | |
574 | 576 | | |
575 | | - | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
576 | 586 | | |
577 | 587 | | |
578 | | - | |
| 588 | + | |
579 | 589 | | |
580 | 590 | | |
581 | 591 | | |
| |||
603 | 613 | | |
604 | 614 | | |
605 | 615 | | |
606 | | - | |
607 | 616 | | |
608 | 617 | | |
609 | 618 | | |
| |||
613 | 622 | | |
614 | 623 | | |
615 | 624 | | |
616 | | - | |
617 | | - | |
| 625 | + | |
| 626 | + | |
618 | 627 | | |
619 | 628 | | |
620 | 629 | | |
621 | 630 | | |
622 | 631 | | |
623 | | - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
624 | 640 | | |
625 | 641 | | |
626 | 642 | | |
| |||
644 | 660 | | |
645 | 661 | | |
646 | 662 | | |
647 | | - | |
| 663 | + | |
648 | 664 | | |
649 | | - | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
650 | 673 | | |
651 | 674 | | |
652 | 675 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
106 | 190 | | |
107 | 191 | | |
108 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
179 | 186 | | |
180 | 187 | | |
181 | 188 | | |
| |||
0 commit comments