Skip to content

Post-merge review fixes for Songs tab Compose migration#218

Merged
timusus merged 10 commits intomainfrom
review-fixes
Mar 28, 2026
Merged

Post-merge review fixes for Songs tab Compose migration#218
timusus merged 10 commits intomainfrom
review-fixes

Conversation

@timusus
Copy link
Copy Markdown
Owner

@timusus timusus commented Mar 28, 2026

Summary

Follow-up fixes from reviewing #208 (Songs tab Compose migration), applied after merge to avoid rewriting the contributor's branch.

  • Remove debug logging (Timber.d("foo:") and Timber.i("getAll()"))
  • Fix unsafe error as Error casts that would crash on non-Error Throwables
  • Fix copy-paste test tag (genres-list-lazy-columnsongs-list-lazy-column)
  • Remove duplicate .editorconfig entry
  • Change delete() to return Result instead of throwing; remove unused @OpenForTesting
  • Fix neverEmittingFlow to use MutableSharedFlow() (truly never emits)
  • Split SelectionState<T> from ComposeContextualToolbarHelper to prevent View reference leak when ViewModel outlives Fragment view lifecycle
  • Add @IoDispatcher qualifier to CoroutineModule and inject into ViewModel, enabling the previously @Ignored sort order test
  • Add missing tests for exclude and play failure paths
  • Replace hardcoded "no name" with R.string.unknown

Test plan

  • Verify song list loads and displays correctly
  • Verify multi-select (long press, add, remove, exit selection) works
  • Verify sort order changes persist across app restart
  • Verify shuffle, add to queue, play next actions work
  • Run unit tests: SongListViewModelTest

timusus added 10 commits March 28, 2026 17:42
Remove "foo: toggleSongSelection" debug log and info-level getAll() size
log that would run on every song query in production.
The Result.failure callback passes a Throwable, which may not be an
Error. Change showLoadError to accept Throwable and safely downcast,
avoiding a ClassCastException if the playback layer returns an Exception.
Change testTag from "genres-list-lazy-column" to "songs-list-lazy-column".
The same key appeared twice with different whitespace around '='.
Keep the no-space version consistent with the other new entries.
Aligns with how every other ViewModel method communicates errors
(via Result/callbacks). Removes the fragile try/catch pattern in
the Fragment caller. Also removes @OpenForTesting annotation which
has no effect without an allopen compiler plugin.
flowOf() immediately completes without emitting, which is different
from a flow that never emits and never completes. Use MutableSharedFlow()
which correctly models a flow that will never produce a value.
Extract generic SelectionState<T> (ViewModel-safe) from
ComposeContextualToolbarHelper (Fragment-scoped). This prevents
View reference leaks when the ViewModel outlives the Fragment's
view lifecycle (e.g. config changes). SelectionState is reusable
for future Compose tab migrations.
Add an @iodispatcher qualifier to CoroutineModule so ViewModels can
receive a testable CoroutineDispatcher instead of hardcoding
Dispatchers.IO. This pattern is reusable for future ViewModel
migrations. The previously @ignore'd setSortOrder test now passes
by injecting the StandardTestDispatcher.

Also adds missing tests for exclude and play failure paths.
Use the existing R.string.unknown resource, consistent with how
the subtitle line and other parts of the app handle missing names.
Documents build commands, architecture, testing strategy including
the robot/scenario pattern for Compose characterisation tests.
@timusus timusus merged commit e86fbbd into main Mar 28, 2026
1 check failed
@timusus timusus deleted the review-fixes branch March 28, 2026 06:44
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.

1 participant