Skip to content

Fix SMB playback and library scan reliability - #361

Merged
ultraelectronica merged 5 commits into
moss-apps:versionFfrom
adithya-s-119:fix/smb-playback-reliability
Nov 6, 2026
Merged

ultraelectronica merged 5 commits into
moss-apps:versionFfrom
adithya-s-119:fix/smb-playback-reliability

Conversation

@adithya-s-119

Copy link
Copy Markdown
Contributor

Summary

Fixes several SMB playback and library-sync failure modes, with the unreachable/unreadable child-directory scan bug as the main one.

  • Sync no longer aborts on one unreadable folder. Windows shares commonly contain entries such as System Volume Information that even a valid account cannot list. The BFS previously failed the entire scan there, which could leave a fresh SMB library empty and make playback look broken. Child directories that are denied, missing, or unsupported are now skipped; failure to list the configured root still fails loudly. Directory paths are de-duplicated and recursion depth is capped to stop junction/DFS loops.
  • Cover art uses the pipelined SMB reader. read_file is a single READ and fails with FileTooLargeForSingleRead above the server's MaxReadSize (as small as 64 KiB on some NAS firmware). Folder art now loads on those servers.
  • Shared downloads are isolated from UI callbacks. A throwing progress listener can no longer fail or cancel a transfer other callers are waiting on. The coalescing entry is released when the transfer itself finishes, not when the first waiter leaves, so a late call cannot start a duplicate download.
  • Cache handling is more forgiving. A failed eviction pass no longer discards an already-completed download, a cache file that disappears during the LRU touch is treated as a miss, and a resync invalidates cached bytes when the listed file size changes. Cache extensions are normalized/derived from the remote name so callers that pass FLAC, flac, or no hint share one file.
  • Gapless/prefetch failures are caught. A failed SMB download while preparing the next track now reports through the normal SMB failure path instead of throwing from an unawaited task.
  • Connection resilience. SMB clients now use ClientConfig with auto-reconnect and a 15-second initial connect timeout instead of the 5-second, no-reconnect shorthand.

Related issue

Refs #291 (SMB playback). Does not claim to close it until the reporter can retest on the original Windows share.

Testing

  • flutter analyze --no-fatal-infos: no errors or warnings (28 pre-existing infos, unchanged from main).
  • flutter test test/services/smb_service_parse_test.dart test/services/smb_service_download_test.dart test/services/network_cache_service_test.dart test/services/remote_metadata_backfill_test.dart: 38 passed, including new coverage for throwing progress callbacks, extension normalization/derivation, and cache invalidation.
  • Rust: the full cargo test --lib cannot run on this Windows host because the existing soundtouch-sys C++ build fails under the local GNU toolchain. I compiled the exact smb_api.rs in an isolated crate against smb2 0.27.2 and ran its tests: 7 passed (including the new child-directory/root distinction and client-config tests). CI's Linux cargo test --lib remains the authoritative full run.
  • Full flutter test on this Windows host has pre-existing failures (layout overflows and platform-specific HTTP/cache tests). I confirmed the same failures on a clean main checkout; the SMB suite passes.

Checklist

  • flutter analyze passes
  • flutter test passes (SMB/network suites pass; full Windows run has pre-existing failures)
  • Rust changes: cargo test --manifest-path rust/Cargo.toml passes (SMB module tests pass in isolation; full run blocked by existing soundtouch build issue on this host)
  • Built and ran the app if the change touches a playback path (not run; no Android device/SMB share available here)
  • Generated code regenerated and committed if bridge/drift/freezed models changed (none required)
  • CHANGELOG.md updated for user-facing changes
  • No secrets, keys, tokens, or machine-local files committed
  • One change per PR; no unrelated reformatting in the same diff
  • Hardware tested if the Rust audio engine or USB/DAC output changed (SMB module only; no audio-engine change)

Harden USB DAC volume safety and add ISO completion diagnostics
Complete SMB playback hardening with atomic cache handling and safe failure reporting
Add adaptive landscape layouts, playback customization, SAF metadata writes, and DSP telemetry
- Skip unreadable or vanished child directories during the SMB walk instead of aborting the whole sync; de-duplicate paths and cap recursion depth.
- Read cover art with the pipelined SMB reader so images above the server's single-READ limit load.
- Enable SMB auto-reconnect and allow a longer initial connect timeout.
- Isolate progress callbacks from the shared transfer, release the coalescing entry when the transfer finishes, and treat a vanished cache file as a miss.
- Invalidate cached bytes when a resync sees a changed file size.
- Normalize or derive the cache extension, and catch failed next-track preparation instead of letting an unawaited task throw.
@ultraelectronica

Copy link
Copy Markdown
Member

Will be reviewed @adithya-s-119, thanks a lot for contributing!

@ultraelectronica
ultraelectronica changed the base branch from main to versionF November 6, 2026 05:59

@ultraelectronica ultraelectronica left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after local verification on Linux: flutter analyze --no-fatal-infos (28 pre-existing infos, no errors/warnings), targeted SMB/network tests (38 passed), full cargo test --lib (368 passed), and build_runner generated no stale outputs. The full Flutter suite has two unrelated pre-existing/local failures (webdav_sync_integration_test Isar Core version mismatch and a flaky Apple Music run). Changes match the existing SMB failure-handling and cache patterns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants