Skip to content

Add depot fetching progress indicator - #1775

Open
jamierajewski wants to merge 5 commits into
utkarshdalal:masterfrom
jamierajewski:add-depot-progress-indicator
Open

Add depot fetching progress indicator#1775
jamierajewski wants to merge 5 commits into
utkarshdalal:masterfrom
jamierajewski:add-depot-progress-indicator

Conversation

@jamierajewski

@jamierajewski jamierajewski commented Jul 28, 2026

Copy link
Copy Markdown

Description

I had attempted to download Borderlands 2 across multiple app versions but it always appeared stuck at 0% so I decided to investigate. When debugging, I found that this game has 61 depots which is significantly more than most games (which have 1-3 according to Google).

I revised the progress indicator to show progress when fetching depots now to avoid this situation and prevent false reports of games not downloading - some may truly just have dozens like this one.

Recording

Before

before.mp4

After

after.mp4

Type of Change

  • Bug fix
  • Performance / stability improvement
  • Compatibility improvements
  • Other (requires prior approval)

Checklist

  • If I have access to #code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.
  • This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
  • I have attached a recording of the change.
  • I have read and agree to the contribution guidelines in CONTRIBUTING.md.

Summary by cubic

Show progress while fetching depot keys before downloads start, fixing the “stuck at 0%” state for games with many depots (e.g., Borderlands 2). The UI now shows “Preparing download…” and “Preparing depots (X/Y)” until data begins downloading.

  • Bug Fixes
    • Subscribed to DepotKeyCallback, seeded a prep message, and tracked per-app depot-key progress as keys resolve.
    • Cleared the prep message when the first chunk arrives or when a download is removed.
    • Guarded updates with a lock and tied progress to the current DownloadInfo so late callbacks can’t re-post or overwrite.
    • Added new strings for the preparing states.

Written for commit 6d997da. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added a “preparing” download status while depot keys are being resolved.
    • Download progress now displays resolved depots versus total depots.
  • Bug Fixes

    • Cleared preparation status when downloads start or are removed.
    • Prevented outdated download attempts from changing current preparation progress.
    • Ensured preparation status ends when the associated download begins receiving data.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

SteamService tracks depot-key preparation for each download attempt, updates status as keys resolve, rejects stale callbacks, and clears preparation when chunks begin or jobs are removed. Two localized strings describe preparation progress.

Changes

Depot key preparation flow

Layer / File(s) Summary
Preparation state tracking
app/src/main/java/app/gamenative/service/SteamService.kt
Adds attempt-owned depot mappings, atomic counters, synchronized updates, and stale-callback checks.
Download startup and callback wiring
app/src/main/java/app/gamenative/service/SteamService.kt, app/src/main/res/values/strings.xml
Initializes preparation before downloader launch, subscribes depot-key callbacks, and adds preparation status strings.
Preparation completion and cleanup
app/src/main/java/app/gamenative/service/SteamService.kt
Ends preparation on the first chunk for the owning attempt and clears state when a job is removed.

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

Sequence Diagram(s)

sequenceDiagram
  participant downloadApp
  participant SteamService
  participant DepotKeyCallback
  participant DownloadInfo
  downloadApp->>SteamService: initialize depot-key preparation
  DepotKeyCallback->>SteamService: report resolved depot
  SteamService->>DownloadInfo: update preparation status
  DownloadInfo->>SteamService: report first chunk
  SteamService->>DownloadInfo: clear preparation status
Loading

Possibly related PRs

Suggested reviewers: utkarshdalal

🚥 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.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a progress indicator while fetching depots.
Description check ✅ Passed The description explains the problem and solution, includes recordings, selects a change type, and completes every checklist item.
✨ 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.

@jamierajewski

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 2

🤖 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/main/java/app/gamenative/service/SteamService.kt`:
- Around line 376-395: The depot preparation status update in
noteDepotKeyResolved can race with clearDepotKeyPrep and restore a stale message
after cleanup. Synchronize noteDepotKeyResolved and clearDepotKeyPrep using the
same lock, and before writing the status re-check that depotKeyPrep[appId] still
references the captured active DepotKeyPrep; only update when it remains active,
while preserving cleanup’s status clear.
- Line 407: Update the job-removal flow in SteamService to call
clearDepotKeyPrep(appId) instead of forgetDepotKeyPrep(appId), ensuring
DownloadInfo.statusMessage is cleared before the job is removed. Preserve the
surrounding cancellation, failure, and completion behavior.
🪄 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: ebad5087-cf5b-4178-bfbf-cd3fa8d35c58

📥 Commits

Reviewing files that changed from the base of the PR and between d853582 and 547c8ea.

📒 Files selected for processing (2)
  • app/src/main/java/app/gamenative/service/SteamService.kt
  • app/src/main/res/values/strings.xml

Comment thread app/src/main/java/app/gamenative/service/SteamService.kt
Comment thread app/src/main/java/app/gamenative/service/SteamService.kt Outdated
@jamierajewski
jamierajewski marked this pull request as ready for review July 29, 2026 22:01

@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 Outdated

@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 1 file (changes from recent commits).

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

Re-trigger cubic

Comment thread app/src/main/java/app/gamenative/service/SteamService.kt
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