Post-merge review fixes for Songs tab Compose migration#218
Merged
Conversation
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.
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
Follow-up fixes from reviewing #208 (Songs tab Compose migration), applied after merge to avoid rewriting the contributor's branch.
Timber.d("foo:")andTimber.i("getAll()"))error as Errorcasts that would crash on non-Error Throwablesgenres-list-lazy-column→songs-list-lazy-column).editorconfigentrydelete()to returnResultinstead of throwing; remove unused@OpenForTestingneverEmittingFlowto useMutableSharedFlow()(truly never emits)SelectionState<T>fromComposeContextualToolbarHelperto prevent View reference leak when ViewModel outlives Fragment view lifecycle@IoDispatcherqualifier toCoroutineModuleand inject into ViewModel, enabling the previously@Ignored sort order test"no name"withR.string.unknownTest plan
SongListViewModelTest