Skip to content

Fix Steam collections failing to load#1726

Merged
utkarshdalal merged 2 commits into
utkarshdalal:masterfrom
VinceBT:fix/steam-collections-loading
Jul 16, 2026
Merged

Fix Steam collections failing to load#1726
utkarshdalal merged 2 commits into
utkarshdalal:masterfrom
VinceBT:fix/steam-collections-loading

Conversation

@VinceBT

@VinceBT VinceBT commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Some users reported their Steam collections never loading (or sitting on the loading state indefinitely). Two separate causes.

1. Release builds stripped a reflection-only constructor

SteamUnifiedMessages.createService instantiates CloudConfigStoreService reflectively. R8 can't see that call, so in minified builds it dropped the (SteamUnifiedMessages) constructor — createService then threw NoSuchMethodException and the fetch bailed straight to the cached snapshot. Debug builds aren't minified, which is why it never showed up in testing.

Fix: keep the constructor for UnifiedService subclasses (the existing in.dragonbra.javasteam.** rule covers JavaSteam's own generated services, but not app-side stubs like this one).

2. The fetch was one-shot with no retry

Collections are fetched once, at login, right as the whole-library PICS burst goes out. If that reply is starved or dropped, nothing recovered it until the next login — so collections stayed empty/stuck.

Fix: retry with backoff (3s / 8s / 20s, 30s per attempt) and bail cleanly if the account changes mid-flight.

#1 is release-only; #2 can bite any build under load. Verified on a release build — collections populate after login.


Summary by cubic

Fixes Steam collections getting stuck on loading by preserving reflective service constructors in release builds and adding a backoff-based retry that respects cancellation after login.

  • Bug Fixes
    • Keep constructors for classes extending in.dragonbra.javasteam.steam.handlers.steamunifiedmessages.UnifiedService so SteamUnifiedMessages.createService(CloudConfigStoreService) works in minified builds.
    • Retry the collections download with backoff (3s, 8s, 20s; 30s timeout/attempt), rethrow CancellationException, and drop results if the account/session changes mid-flight.

Written for commit 4f38210. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when loading Steam collections during slow or failed network requests.
    • Prevented outdated collection data from replacing current data after logout or account switching by ensuring updates only apply to the active session.
    • Added automatic retries with increasing delays for temporary service failures.
    • Preserved cached collections when refreshed data can’t be retrieved.
  • Chores
    • Improved release-build compatibility by preserving dynamically created Steam message services from being removed or obfuscated.

Two issues stopped collections from loading:

- Release builds (R8) stripped the reflection-only CloudConfigStoreService
  constructor, so createService threw and the fetch never ran. Added a keep
  rule for UnifiedService subclasses.
- The fetch ran once at login into the post-login PICS burst with no retry, so
  a starved or dropped reply left collections stuck until the next login. It
  now retries with backoff and bails cleanly if the account changes.
@VinceBT
VinceBT requested a review from utkarshdalal as a code owner July 16, 2026 14:43
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

fetchSteamCollections() now prevents stale cross-session updates, retries CloudConfigStore downloads with backoff, preserves cached data on failure, and uses a shorter timeout. ProGuard also keeps reflection-created UnifiedService subclasses and their members.

Changes

Steam collections and unified service runtime

Layer / File(s) Summary
Unified service reflection retention
app/proguard-rules.pro
Adds a ProGuard rule preserving UnifiedService subclasses and their members for reflective instantiation.
Session-safe collection retrieval
app/src/main/java/app/gamenative/service/SteamService.kt
Adds session validation, service availability checks, retry backoff, a 30-second timeout, and conditional repository updates for collection downloads.

Estimated code review effort: 3 (Moderate) | ~15 minutes

Possibly related PRs

Suggested reviewers: utkarshdalal

Sequence Diagram(s)

sequenceDiagram
  participant SteamService
  participant SteamUnifiedMessages
  participant CloudConfigStore
  participant SteamCollectionRepository
  SteamService->>SteamUnifiedMessages: Resolve handler
  SteamService->>CloudConfigStore: Request collection download
  CloudConfigStore-->>SteamService: Return response or failure
  SteamService->>SteamService: Retry and verify session
  SteamService->>SteamCollectionRepository: Store parsed collections
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR explains the fix, but it omits required template sections like Recording, Type of Change, and the checklist. Add the missing template sections: Recording, Type of Change, and the checklist items, or state why each is unavailable.
✅ Passed checks (4 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.
Title check ✅ Passed The title clearly describes the main fix: Steam collections failing to load.
✨ 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.

🧹 Nitpick comments (1)
app/src/main/java/app/gamenative/service/SteamService.kt (1)

4126-4134: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Explicitly rethrow CancellationException.

Catching Throwable will also catch CancellationException, which is used by Kotlin coroutines for cancellation. Although the current logic gracefully exits (because delay rethrows the exception or sameSession() evaluates to false on logout), catching it logs a confusing failure message and violates general coroutine best practices.

Consider adding an explicit catch block to rethrow CancellationException, consistent with other areas in this file.

♻️ Proposed refactor
-            } catch (t: Throwable) {
+            } catch (e: CancellationException) {
+                throw e
+            } catch (t: Throwable) {
                 val lastAttempt = attempt == maxAttempts - 1
                 Timber.tag("SteamCollections").w(
🤖 Prompt for 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.

In `@app/src/main/java/app/gamenative/service/SteamService.kt` around lines 4126 -
4134, Update the exception handling around the Steam collections fetch retry
loop to catch and immediately rethrow CancellationException before the broad
Throwable handler. Keep the existing retry, logging, and cached-snapshot
behavior unchanged for non-cancellation failures.
🤖 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.

Nitpick comments:
In `@app/src/main/java/app/gamenative/service/SteamService.kt`:
- Around line 4126-4134: Update the exception handling around the Steam
collections fetch retry loop to catch and immediately rethrow
CancellationException before the broad Throwable handler. Keep the existing
retry, logging, and cached-snapshot behavior unchanged for non-cancellation
failures.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3449c7f1-c629-47b4-be3b-52035725e0f1

📥 Commits

Reviewing files that changed from the base of the PR and between 23f61c3 and 0c86136.

📒 Files selected for processing (2)
  • app/proguard-rules.pro
  • app/src/main/java/app/gamenative/service/SteamService.kt

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/src/main/java/app/gamenative/service/SteamService.kt
@utkarshdalal
utkarshdalal merged commit 15441fb into utkarshdalal:master Jul 16, 2026
3 checks passed
@VinceBT
VinceBT deleted the fix/steam-collections-loading branch July 17, 2026 08:36
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