appstore: show the Play error line as produced, not re-mapped
- Commit
a51e87831ef17d9c64f6d8fb11d76ab277507300- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-21 11:49 UTC (15 days ago)
- Parents
4099bc3
The failing SearchScreenTest was right and the code was
wrong. Producers already compose playError as a finished
sentence ('Play Store results unavailable: Too many
requests...'), and the TV screen renders it verbatim - but the
phone screen ran it through friendlyErrorMessage a second
time, which matched no keyword and replaced the specific
429 guidance with 'Something went wrong'. The screen now
renders the state string as-is in both branches, like TV.
Raw exception text still cannot reach the UI: sanitising
happens once, at the producers.
Verified: the failing test passes untouched; full appstore
suite 489 + 186 quarantined-companion tests pass.Diff
appstore/src/main/java/com/vayunmathur/appstore/ui/SearchScreen.kt
diff --git a/appstore/src/main/java/com/vayunmathur/appstore/ui/SearchScreen.kt b/appstore/src/main/java/com/vayunmathur/appstore/ui/SearchScreen.ktindex 13ef7c2ad5..cd6d3bb2cb 100644--- a/appstore/src/main/java/com/vayunmathur/appstore/ui/SearchScreen.kt+++ b/appstore/src/main/java/com/vayunmathur/appstore/ui/SearchScreen.kt@@ -29,7 +29,6 @@ import com.vayunmathur.library.ui.CircularProgressIndicator import com.vayunmathur.library.ui.CommonSearchBar import com.vayunmathur.library.ui.EmptyState import com.vayunmathur.library.ui.ErrorState-import com.vayunmathur.library.ui.friendlyErrorMessage import com.vayunmathur.library.ui.FilterChip import com.vayunmathur.library.ui.IconSearch import com.vayunmathur.library.ui.LinearProgressIndicator@@ -86,20 +85,25 @@ fun SearchScreen( } // Play's half refused (429, issue #797): say so above the results rather than- // silently showing a list that is missing half its sources.+ // silently showing a list that is missing half its sources. The state line+ // is already display-ready: every producer builds it as+ // play_unavailable + friendlyErrorMessage(raw), so rendering it verbatim+ // (as TvStoreSearch does) can never surface raw exception text. Mapping it+ // again here would classify the finished sentence as an unknown failure+ // and replace the Play/429 specifics with the generic fallback. val playError = state.playError.takeIf { it.isNotBlank() } if (playError != null && state.results.isEmpty()) { ErrorState( title = stringResource(R.string.search_failed_title),- message = friendlyErrorMessage(playError),+ message = playError, retryLabel = stringResource(com.vayunmathur.library.ui.R.string.retry), onRetry = { actions.setSearch(state.query) }, ) } else if (playError != null) { // Partial failure: local results are on screen, so keep the- // notice as a banner above them (friendly text, not raw).+ // notice as a banner above them. Text(- friendlyErrorMessage(playError),+ playError, style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.error, modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp),