Skip to content

fix: Android Auto browse/search could hang forever on error responses#867

Open
sinful1992 wants to merge 2 commits into
eddyizm:developmentfrom
sinful1992:fix/aa-unresolved-futures
Open

fix: Android Auto browse/search could hang forever on error responses#867
sinful1992 wants to merge 2 commits into
eddyizm:developmentfrom
sinful1992:fix/aa-unresolved-futures

Conversation

@sinful1992

@sinful1992 sinful1992 commented Jul 12, 2026

Copy link
Copy Markdown

What

getIndexes, getDirectories, getArtistAlbum, getPlaylistSongs and search in AutomotiveRepository only resolved their futures on a fully successful response. Any HTTP error or unexpected body left the future unresolved forever, so opening an artist, a playlist, a music folder, or searching in Android Auto during a flaky server moment showed an infinite loading spinner until the app was killed.

This resolves those futures with an error result in the failure cases, matching the pattern the other 16 repository methods already use (LibraryResult.ofError), so the car UI shows its error state and stays usable.

10 lines, no behaviour change on the happy path.

Testing

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of invalid or incomplete API responses.
    • Requests now return a clear error when expected response data is missing, instead of potentially staying pending indefinitely.

getIndexes, getDirectories, getArtistAlbum, getPlaylistSongs and search
only resolved their futures on a fully successful response. Any HTTP
error or unexpected body left the future unresolved forever, so the
Android Auto browse or search screen showed an infinite loading spinner
until the app was killed. Resolve with an error result in those cases,
matching the pattern the other repository methods already use.
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

AutomotiveRepository adds defensive response parsing and completes futures with SessionError.ERROR_BAD_VALUE when required API payloads are missing across five repository flows.

Changes

Automotive response handling

Layer / File(s) Summary
Defensive response parsing
app/src/tempus/java/com/cappielloantonio/tempo/repository/AutomotiveRepository.java
Adds a helper that safely retrieves SubsonicResponse, returning null when payload access throws.
Complete futures for invalid responses
app/src/tempus/java/com/cappielloantonio/tempo/repository/AutomotiveRepository.java
Updates getIndexes, getDirectories, getArtistAlbum, getPlaylistSongs, and search to validate required payloads and complete invalid responses with SessionError.ERROR_BAD_VALUE.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing Android Auto browse/search requests that could hang on error responses.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@app/src/tempus/java/com/cappielloantonio/tempo/repository/AutomotiveRepository.java`:
- Around line 600-601: Guard getSubsonicResponse() before any dereference in all
five changed branches, including the branch containing the
LibraryResult.ofError(SessionError.ERROR_BAD_VALUE) fallback. Handle a missing
subsonic-response by completing the corresponding future with the appropriate
error instead of allowing the lateinit access to throw; alternatively, make
ApiResponse.subsonicResponse nullable and update these checks accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 452c2d8f-0cee-4536-9413-343b1dae9451

📥 Commits

Reviewing files that changed from the base of the PR and between 3fe7074 and ed44cae.

📒 Files selected for processing (1)
  • app/src/tempus/java/com/cappielloantonio/tempo/repository/AutomotiveRepository.java

@eddyizm eddyizm changed the base branch from main to development July 12, 2026 14:40
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