Commit Graph
4079 Commits
Author SHA1 Message Date
zarzet e28fa2aeaa perf(bridge): avoid redundant download and small job codecs
Keep download snapshots as JSON across the Android channel and decode large progress payloads off the UI isolate while retaining event order and permissive empty-result behavior. Encode bounded small native data requests inline, with the existing pre-dispatch cancellation yield and background fallback for larger graphs.

Host tests verify zero encoder isolates for small requests, background decoding of large snapshots, cursor resets, stream cancellation, exact JSON and separate binary arguments. Restoring the old codec paths fails the corresponding isolate and event-loop probes.
2026-11-01 20:39:57 +07:00
zarzet d125c50fac perf(storage): move preference blobs to atomic files
Keep Explore payloads and timestamps, autoplay learning, and release bodies with their validators in application-support snapshots. Serialize migration, replacement, metadata updates and clear across store instances. Flush and rename before removing legacy keys, retain data on failure, and use a tombstone to prevent clear from reviving old preferences.

Preserve full payload content and unrelated settings. Explore reads are asynchronous and report actual file length; delayed release revalidation updates current metadata without overwriting a newer body.

The 261281-byte host preference fixture drops to 21 bytes after migration. Sixty subsequent blob saves make zero preference writes, with only three initial removals. Migration, corruption, failure/retry, ordering and all three consumer paths pass scoped host tests.
2026-11-01 20:30:50 +07:00
zarzet 8dccb0582d fix(library): unify Windows extended path identities 2026-11-01 20:21:44 +07:00
zarzet 90109f7e5f perf(covers): memoize reference keys and offload index warmup
Bound reference hash memoization to 4096 entries and run the complete stored-cover index walk in a worker isolate. Retain regular-file validation, duplicate selection, retry and durable filename behavior.

A 1001-file warmup fixture now performs no stat callbacks on the caller isolate while still rejecting FIFOs. Median time for 100000 repeated indexed lookups across 1000 keys fell from 141.858 ms to 45.262 ms in the host benchmark.
2026-11-01 20:20:43 +07:00
zarzet 959ef33525 fix(images): preserve extension icon crop resolution
Decode square-cropped extension icons from their intrinsic shorter edge, preserving proportions and retaining enough pixels for the crop without decoder upscaling. Keep source loading, fallbacks and layout unchanged, and key decoded images by source and physical extent.

Real file and HTTP bitmap tests cover wide, tall, square and small sources at all icon sizes and live density changes. The Store regression catches the old 100x25 decode where a 400x100 bitmap is required. All 68 scoped tests pass with clean lib/test analysis.
2026-11-01 20:17:07 +07:00
zarzet 2b8295a17d perf(images): bound landscape artwork and extension icon decodes
Use the short screen side for shared player artwork so rotation reuses the portrait decode. A DPR 3 400x900 test requests 1200 pixels in both orientations instead of 2700 in landscape.

Decode extension icons at their displayed width and density while retaining the source aspect ratio and existing fallback layout.
2026-11-01 20:17:07 +07:00
zarzet 4a53a24366 feat(lyrics): automatically embed online search results 2026-11-01 20:16:59 +07:00
zarzet 030d44bbd0 fix(android): avoid Sony snapshot crash when locking screen 2026-11-01 20:16:44 +07:00
zarzet d789c08630 perf(link): suppress idle state heartbeats and redundant pings
Send periodic player states only while connected and playing, keeping debounced changes and reconnect state delivery. Skip remote playback publication for download-only updates. Keep transport ping/pong liveness while paused and avoid a server ping after recent client traffic.

Negative controls observed four eliminated paused phone states per minute, three redundant download-driven playback events reduced to zero, and server ping suppression with client pings. All 104 scoped Dart tests and 114 Rust tests pass, with strict analysis, clippy and format checks.
2026-11-01 20:11:40 +07:00
zarzet 2771a8c902 fix(library): persist the selected song sort order
Restore the last Library sort across launches in both styles, including desktop column sorting. Keep the saved song order when Playlists temporarily falls back from file-size sorting, and tolerate missing or invalid saved values.

Validation: 56 tests passed; 11 focused sort tests passed after the final adjustment; focused analyzer and diff checks clean.

Fixes #776.
2026-11-01 20:10:35 +07:00
zarzet b847b12240 perf(player): bound Android session queue messages
Publish a stable window of at most 500 entries before converting MediaItems to platform messages. Recenter on index-only playback changes as well as queue changes while keeping the app queue and playback indices complete.

Use absolute native QueueItem IDs and map position-based edits through the published window, so pending sends do not change skip callback meaning. Preserve metadata, artwork, legacy payloads and other platforms.

The 20,000-song host fixture now reads 500 items and encodes 140223 bytes instead of 4686693 bytes. Scoped checks pass 249 Flutter tests and four JVM ID tests; native Java receiver compilation, analyzer and formatting checks pass with only an existing vendored compatibility lint.
2026-11-01 20:04:18 +07:00
zarzet 39c6a0bf7f perf(shell): defer idle preload and freeze hidden tab size
Avoid the scheduler idle-task retry loop during animations. Wait on existing frames before preloading Search, and retain the last visible MediaQuery size for hidden tabs while continuing accessibility updates.

Ten hidden resize updates now trigger zero size-dependent builds instead of ten. Host regressions verify retained scroll, focus, tickers, disposal and idle completion.
2026-11-01 19:47:45 +07:00
zarzet b221a73404 perf(library): measure uniform desktop song row extents
Use the measured first row for uniform desktop tables so long jumps avoid building every skipped row. Keep custom actions, album rows and large text on variable layout.

A jump across 5,000 songs builds fewer than 40 rows instead of about 4,980. Pixel comparisons match both styles at 100% and 200% text scaling.
2026-11-01 19:46:02 +07:00
zarzet ed6b0e7b63 perf(rewind): cache backdrop blur and cap story updates
Reuse quarter-resolution artwork blurs across zooms and swipes, and drive ambient motion and story progress from the shared 30 Hz clock. Keep the six-second deadline, holding and hidden-route catch-up with a separate timer and sampling stopwatch. Share captures retain full-resolution live blur.

Host tests bound live blur to at most 6 of 270 sampled frames and progress to 28-30 updates per simulated 120 Hz second, with no steady-state vsync ticker. All 32 scoped Rewind tests pass; share PNG pixels match the live full-resolution blur.
2026-11-01 19:44:38 +07:00
zarzet 22c4f92a82 perf(library): reduce schema writes and repeated path migration
Bump Library to v21 and History to v16, add album artist indexes, and remove six Library and three History indexes whose seeks are served by existing queue indexes. Keep the named file-path index for released readers and synchronize native schema checks.

Persist the iOS container migration marker in the database transaction, exclude current paths, and bound Library and CUE reads to 256 rows. Repeat opens read one marker row. Test rollback, path keys, bookmarked sources and downgrade/reupgrade compatibility.

Four alternating 15,000-row host write pairs reduced median batch time from 3364.773 ms to 2782.200 ms (17.3 percent). Native staging now takes the shared History schema version.
2026-11-01 19:41:07 +07:00
zarzet 9d11f9b883 perf(library): restrict filtered album aggregates
Aggregate only album keys that can survive the active filter while keeping full-album counts and sort dates. Preserve the established album page results across source, FTS, shadow, sort and cursor combinations.

With the supporting artist indexes, the 15,000-row host aggregate measured 6.190 ms before and 0.456 ms after. Pin the changed SQL shape and retain the old row-result digests.
2026-11-01 19:41:07 +07:00
zarzet b2626ac95e perf(library): reuse suggestion matching and playlist seeds
Keep normalized collection match keys and filtered suggestions across page rebuilds. Snapshot candidate identities and history membership so edits and in-place list changes invalidate derived results, and sort playlist seeds once per collection snapshot.

Host widget checks reduce match-field reads from 3000 to zero over five rebuilds of a 200-track collection. All 170 scoped tests pass, with clean lib/test analysis and formatting.
2026-11-01 19:34:32 +07:00
zarzet 0dd8750400 feat(lyrics): sync AI romanization to original word timing 2026-11-01 19:30:14 +07:00
zarzet dcae0064ed perf(home): share counts and reuse unchanged shelves
Share the unfiltered Library count across Home and badges. Read On Repeat candidates in bounded pages, cache unchanged Library matches, and traverse mix songs with keyset paging. Regression checks retain ordering and skip missing files beyond the first candidate page.
2026-11-01 19:22:31 +07:00
zarzet 32672e1c39 perf(network): keep one Subsonic metadata client per connection
Each Subsonic or Mornye Link metadata read (getSong, then the cover and
lyrics in parallel) built a new HttpClient and force closed it, so every
song start paid one or two fresh TLS handshakes while streaming already
used a pooled client.

NetworkMetadataService now keeps one SubsonicClient per connection id
and reuses its keep-alive connections across reads. The client is reused
only for the exact saved connection (its JSON, so address, credentials,
API key and certificate pin), so an edit opens a new client and retires
the old one once its last read ends. It also closes after 20 s without
reads, when the connection is removed, on cancelPending, and after a
transport failure (anything but a Subsonic error, an HTTP status or a
local cache file error). Requests, headers, timeouts, certificate
pinning and redirect rules are unchanged, since every request still goes
through NetworkStorageService._request.

Measured on a local HTTPS fixture with a pinned self-signed certificate,
six metadata reads in a row: 6 HttpClients and 7 TLS connections before,
1 HttpClient and 2 TLS connections after, same 13 requests.
2026-11-01 19:21:10 +07:00
zarzet 60cf750219 test(shell): allow idle preloads in rebuild checks
The Mornye rebuild fixture can spin indefinitely on an idle scheduler task while fake time holds an animation frame pending. Allow queued tasks during these tests and restore the original scheduling strategy afterwards. The focused file now completes all 18 checks in 8 seconds without changing app scheduling.
2026-11-01 19:19:10 +07:00
zarzet ff90324b5f perf(shell): keep the Store update count out of MainShell
MainShell still watched the extension update count for the Store
badge, so every change to it (an update check, an install or upgrade)
rebuilt every route of every tab, as the download count did before.
The navigation chrome now watches it next to the download count, on
desktop, phones and TV. Badge values are unchanged.

Measured in test/main_shell_rebuild_test.dart (desktop and phone, both
styles): two update count changes rebuilt a page pushed in the hidden
Library tab twice before and 0 times now, and the tab navigators,
Navigators and tab root pages keep their instances.
2026-11-01 19:19:10 +07:00
zarzet 2d9af84788 perf(desktop): rebuild only the arrows when a shelf is hovered
DesktopScrollArrows kept hover in setState, so each pointer enter and
exit called the builder again and rebuilt the shelf's ListView and every
visible card (Home shelves, artist discography, search shelves). Moving
the pointer down Home crossed each shelf twice.

Hover now lives in a ValueNotifier and only the arrow layer listens. When
not hovered it is a zero-size child, which paints and hits nothing, as
the missing child did before.

Measured in test/desktop_scroll_arrows_test.dart with six visible cards
that keep their own hover state: hovering one card rebuilt all six
before, and rebuilds only the hovered card now; the shelf builder runs
once across enter, move and exit.
2026-11-01 19:19:10 +07:00
zarzet e9d95d27fa perf(shell): keep the window size and download count out of MainShell
MainShell read MediaQuery.sizeOf and watched the queued download count
in its own build. Every rebuild creates new _TabNavigator widgets, and
Navigator.didUpdateWidget calls changedExternalState on every route, so
each resize frame (and each mini player animation frame on desktop) and
each download count change rebuilt every page of every tab, hidden tabs
and pushed album or playlist pages included. The count part also hit
phones on every queued or finished download.

The navigation chrome now reads both in a Consumer below the shell and
receives the same tab view instance each time, so only the chrome
rebuilds. The scroll listeners read the collapse condition without
depending on the window size. Layout, badges and the rail/bar swap are
unchanged.

Measured with a page that reads neither value, pushed in the hidden
Library tab (test/main_shell_rebuild_test.dart, desktop and phone, both
styles): 10 resize frames rebuilt it 10 times before and 0 times now;
two download count changes rebuilt it twice before and 0 times now. The
tab navigators, Navigators and tab root pages keep their instances.
2026-11-01 19:19:10 +07:00
zarzet 67bd523704 test(player): cover AutoMix lead duration and cancellation
Verify reported duration changes move the 150 s preparation window and its planned handoff. Exercise pause, stop, and queue replacement while a start timer is pending so cancelled mixes cannot resume an old deck.
2026-11-01 19:15:49 +07:00
zarzet 836f0645a3 perf(player): set the AutoMix start timer again only when the start moves
While a mix waited, every 200 ms position tick cancelled the start timer
and created a new one: about 275 timers for the 55 s a one-minute song
waits, and up to about 725 for the 145 s a longer song now waits after
its lead. Positions follow the clock, so a tick almost always computes
the same moment. The timer is now set again only when the moment
computed from a new position moves by more than 20 ms, or when the
timer is no longer pending. A position that jumps or stalls still moves
the timer on the next tick, and the start itself re-checks the position
as before.

Host test (virtual time, the position following the clock): the start
timer is created 275 times for one song on the old code and once now;
the mix starts at 55000 ms in both.
2026-11-01 19:15:49 +07:00
zarzet be3b178c20 perf(player): prepare AutoMix only in the last 150 s of a song
AutoMix opened a second deck on the next song and decoded two analysis
windows (plus the native beat job) on the first tick of every song, so
each skipped song cost a full preparation that was thrown away, and the
prepared deck held an open decoder for the rest of the song. The owner
approved preparing only once 150 s remain. A plan starts within the last
minute (the longest fade), so preparation still has at least 90 s, and
a song of 150 s or less still prepares in its first seconds.

The plan does not depend on where preparation starts, so every mix
starts at the same moment with the same cue and rate. A seek already
cancels a prepared mix: a seek into the last 150 s prepares on the next
tick as before, and a seek back out now leaves no deck open until the
song returns to its last 150 s. A queue edit before then costs nothing.
The position predicate asks for the tick that crosses the lead.

Song analysis kept off the first 20 s of each song because AutoMix
prepared there. AutoMix now reports while it prepares, and both the
Library sweep and the playing song's analysis wait for it. The sweep
still avoids the first 20 s, where covers, lyrics and haptics load and
the playing song's own analysis follows.

Host tests (fake decks, virtual time): a session of four 4 min songs
skipped at 10 s and 60 s made 6 window decodes and 3 mix decks before
the third song reached its end; now none until its last 150 s, then 2
decodes and 1 deck. Mix start positions match the old code within 1 ms
(195000 vs 195001, 195670 vs 195671, 235000 both). Engine reads for a
200 s song: 827 instead of 990.
2026-11-01 19:15:49 +07:00
zarzet af8f222971 fix(covers): preserve fresh thumbnail permissions when linking
Compare link candidates with the permissions of a normally created stage so a changed cached file cannot alter a new song cover's mode. Keep the copy fallback when they differ.

The new regression fails before this fix (0604 instead of 0644) and passes afterward. All three affected Rust crate tests, clippy, formatting, and diff checks pass.
2026-11-01 19:13:11 +07:00
zarzet 0f6436b907 perf(library): move the incremental scan delta instead of copying it
json! turns every value into to_value(&value), so building the delta
with json!({"scanned": tracks, ...}) serialized every scanned row into
a second copy (wrapping the rows in Value::Array inside json! copies
them too). The object is now built as a Map that takes the rows and the
deleted paths by value, in the same key order, so the JSON is
byte-identical.

Measured with a standalone serde_json 1.0.154 program (release, 20,000
rows shaped like scan rows, 15.2 MB of JSON): 35 to 37 ms and 62 MB of
extra peak memory -> under 0.1 ms and 0.1 MB, same output hash.
2026-11-01 19:13:11 +07:00
zarzet bb7a8cee99 perf(network): keep NAS tag covers the cache already holds
Every NAS tag read that found a picture rewrote the content-addressed
network_cover_<sha256>.image through write_atomic (sync_all, which is
F_FULLFSYNC on Apple), then listed and trimmed the folder, even when
the same file was already there, as it is for every further song of an
album. A file that still holds exactly the same bytes is now kept and
its mtime renewed, as the rewrite did, so the 32-file trim keeps it
among the newest; nothing is added, so the trim is skipped. A damaged
file under the name, or one a concurrent trim removed, is still
rewritten.

Measured on this Mac (release, 350 KB cover, 32 cached files): a repeat
call 4.9 to 8.9 ms -> 0.23 to 0.39 ms, most of it the SHA-256 that
names the file.
2026-11-01 19:13:11 +07:00
zarzet a934bd1b00 perf(covers): link identical Library thumbnails on desktop and iOS
Every song got its own thumbnail file even when an album's songs embed
the same picture, so a scan wrote and kept one 150 to 430 KB copy per
song. The in-memory thumbnail cache, which already reuses the resize by
content, now also records the file that holds the bytes. The next song
with the same picture hard-links that file into its own name (link a
stage name, then rename), but only while the file still holds exactly
those bytes, is current for the regenerate marker and has the expected
permissions; otherwise, or when linking fails, it writes the bytes as
before. Every name, its bytes and every stored coverPath stay the same.
Songs of one album hold the record until the first file is published,
so concurrent scan workers link instead of writing copies.

A new name keeps its inode's old mtime, so the Library cover prune now
counts a multi-link file from the newer of mtime and ctime (link(2)
updates ctime): the one-minute guard for background producers still
holds. Files with one name, which is every file on Android and Windows,
keep the mtime rule. Deleting a name never touches the others.

Android keeps one file per song (content-addressed names there are a
later unit) and Windows keeps copies too.

Measured (release, scan_timing_with_many_thumbnails, 1,000 songs over
100 pictures): 1,000 names on 113 to 120 files, 341 MB -> 38 to 40 MB
on disk; the scan time is unchanged (5.5 s). The extra files come from
the 8 MB in-memory cache evicting a picture before a lagging worker
reaches it.
2026-11-01 19:13:11 +07:00
zarzet b427049a8a perf(covers): flush scan thumbnails once per scan on Apple
Rust's sync_all is F_FULLFSYNC on Apple targets, a drive cache flush
that every Library thumbnail paid twice (file and folder), and the
device-wide flush does not overlap across scan workers. Scan workers
now publish thumbnails with a plain fsync(2), which still hands the
whole file to the drive before the rename gives it its final name, and
the scan flushes the thumbnail folder once with sync_all when its
workers finish (a drop guard covers failure and cancellation).

Only scan workers use the batch. Single reads, CUE sheets, cover exports
and downloads keep the full sync, and other platforms keep the current
publication. A power loss inside the scan window can at worst leave an
empty thumbnail, which is now treated as missing and extracted again.

Measured on this Mac (release, ignored test
scan_timing_with_many_thumbnails, 348 KB thumbnails): 1,000 songs over
100 album pictures 9.3 s -> 5.5 s; 1,000 distinct pictures 42.4 s ->
41.0 s, where the serialized resizes dominate.
2026-11-01 19:13:11 +07:00
zarzet b1fd43ff0e test(perf): measure private native application pipelines
Add isolated library, download, playback, lyric, and log fixtures with durable-state and idle-work assertions. Native macOS suites pass; measurements exclude occluded-window samples and do not claim Android or iOS runtime performance.
2026-11-01 19:11:45 +07:00
zarzet 3151cc12a3 fix(cache): finish decoding invalid analysis artwork
Await image codec creation and dispose the codec even when decoding fails, avoiding a callback that never completes for corrupt artwork. Targeted cache regressions pass.
2026-11-01 19:11:45 +07:00
zarzet d7009e9c41 fix(apple): guard seek callbacks and scan progress
Ignore obsolete seek completions, avoid duplicate platform-error replies, and coalesce scan progress by generation. Native source lifecycle and accurate seek harnesses pass.
2026-11-01 19:11:45 +07:00
zarzet 0bfbf21f64 fix(android): cancel blocked SAF worker waits
Poll cancellation while waiting for a SAF worker and cancel outstanding tasks. Preserve thread interruption and reject results returned after cancellation. Three focused JVM tests pass.
2026-11-01 19:11:45 +07:00
zarzet 5d58a20e4a fix(extensions): enforce deadlines while waiting for the VM
Bound queue waits and retain operation ownership through VM cleanup. Abandoned queued operations never execute. The short-deadline regression previously waited longer than one second; Rust workspace tests and strict clippy pass.
2026-11-01 19:11:44 +07:00
zarzet b52196410b fix(network): preserve edits and close late requests
Check the backup still matches the original before replacing a network file. Abort upload requests that open after timeout and prevent disposed sessions from recreating their HTTP client. Focused conflict and lifecycle regressions pass.
2026-11-01 19:11:44 +07:00
zarzet 820e089a27 perf(ui): lazily build large logs and review lists
Coalesce log bursts to one frame and cancel pending callbacks on disposal. A 500-entry log initially mounts only visible rows; large metadata reviews avoid shrink-wrapping every row.
2026-11-01 19:11:44 +07:00
zarzet c685372e79 fix(lyrics): preserve motion across interrupted scrolls
Carry unfinished row displacement into the next stagger and active-row transition. Regressions reproduce a 33.60 px jump on the old code. Keep the intended upward animation in both Material and Mornye.
2026-11-01 19:11:44 +07:00
zarzet 2bfc143d8d perf(library): batch retained-page refreshes
Refresh 1000 retained rows with five aligned reads instead of 25 while keeping initial and next-page sizes unchanged. Private native ingest-to-refresh sample improved from 375 ms to 210 ms. Cancel maintenance work after provider disposal.
2026-11-01 19:11:43 +07:00
zarzet 6fa3b127a1 fix(download): cancel old attempts before retrying
Wait for cancellation before retrying and interrupt rate-limit waits on cancellation. The previous 300-second backoff failed a 3-second cancellation regression; the private native fixture now releases it in under 1 ms. Keep completed conversion destinations intact.
2026-11-01 19:11:43 +07:00
zarzet 18c95e8239 fix(player): preserve transport intent across asynchronous work
Bound position polling to one in-flight request and discard stale seek completions. Serialize exclusive-output changes without losing newer pause, stop, or dispose intent. Targeted playback and USB regressions pass.
2026-11-01 19:11:43 +07:00
zarzet 1d7c852648 feat(lyrics): sync translated phrases to original word timing 2026-11-01 19:00:38 +07:00
zarzet e0f8ee6117 feat(network): edit metadata and lyrics on SMB and WebDAV
Enable the shared metadata, lyrics and cover editor for writable NAS songs on mobile and desktop. Stage complete files locally, preserve the original during publication, and reconcile failed or lost rename replies.

Refresh Library rows and player metadata after successful saves, retain artwork in the Library cache, and keep HTTP and generic Subsonic sources read-only.

Validation: 248 related tests passed, plus 31 UI regressions after the final mounted-state guard. Scoped analysis, formatting and git diff checks are clean.
2026-11-01 17:35:49 +07:00
zarzet d602f0f180 fix(link): refresh phone library on reconnect
Rescan persisted phone catalogs when a phone reconnects so stale Library entries can recover even when catalog hashes match.

Validate online and offline deletions, persisted catalog replacement, and reconnect recovery. All 121 related tests pass; scoped analysis and formatting checks are clean.
2026-11-01 16:53:32 +07:00
zarzet f19a86e8d8 feat(desktop): dismiss paused playback from the player bar 2026-11-01 16:40:48 +07:00
zarzet 1e26dc26ca fix(network): handle HTTP redirects and clarify connection errors
Accept HTTP 303 redirects to canonical directory paths for GET and HEAD requests. Distinguish unreadable directory listings from local connection-save failures and add diagnostics without URLs or credentials.

Validation: 46 host tests passed, 2 SMB environment tests skipped; 3 Android integration scenarios passed; focused analyzer clean.
2026-11-01 16:38:13 +07:00
zarzet 7db0fc76f6 chore: merge upstream AltStore source update 2026-11-01 16:27:02 +07:00
zarzet 78d5e5b0af fix(metadata): preserve extension URL fetch errors
Keep native metadata failures distinct from unsupported links so a failed large playlist import reports a fetch error and can be retried.
2026-11-01 16:26:50 +07:00