fix(apps): show actually-installed tag instead of latest after older-version install#554
Conversation
…iver post-install update
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe ChangesPending Install Version Tag Logic
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Field-reported bug: install an older release of an app via the Details screen version picker → the system reports the correct (lower) version, but GHS Apps + Details screens keep showing the latest tag instead of the one the user picked.
Root cause
`PackageEventReceiver.onPackageInstalled` post-install update was pulling the displayed `installedVersion` from `app.latestVersion` — that field is GHS's cached "what GitHub says is the latest tag", not what the user just installed. So an explicit older-version install would land the correct APK in the OS but render the latest tag in our UI.
The `if (wasActuallyUpdated)` happy path used `app.latestVersion ?: systemInfo.versionName` for `newTag` (correct under the assumption the user always installs the latest — broken by the version picker). The else-branch added in PR #541 used the same wrong source.
Fix
Both branches now read the parked tag from `app.pendingInstallVersion` first — that field is set by `DefaultDownloadOrchestrator.parkForUser` to the exact `releaseTag` the user requested via the Details version picker. Falls back to `app.latestVersion` then `systemInfo.versionName` if the parked tag was somehow not persisted.
```kotlin
val installedTag =
app.pendingInstallVersion
?: app.latestVersion
?: systemInfo.versionName
```
Used in:
Happy-path behaviour is unchanged for normal latest-version updates: `pendingInstallVersion` equals `latestVersion` in that case.
Test plan
Summary by CodeRabbit