Skip to content

fix(updates): scope auto-pick by tracked package flavor#570

Merged
rainxchzed merged 4 commits into
mainfrom
fix/flavor-mismatch-on-autopick
May 11, 2026
Merged

fix(updates): scope auto-pick by tracked package flavor#570
rainxchzed merged 4 commits into
mainfrom
fix/flavor-mismatch-on-autopick

Conversation

@rainxchzed
Copy link
Copy Markdown
Member

@rainxchzed rainxchzed commented May 11, 2026

Auto-update picker could swap a tracked stock package for an .fdroid sibling APK that lives in the same release. System then installed <base>.fdroid as a new parallel app while the tracked row still pointed at the original — Apps screen snackbar said "updated" but the original package never moved.

Fix: new AssetVariant.filterByPackageFlavor(assets, trackedPackageName) helper. The update-check resolver narrows the auto-pick pool to assets whose filename flavor tokens match the tracked package's flavor segments (com.foo.bar → drop fdroid/foss/play assets; com.foo.bar.fdroid → keep them). Empty-filter guard returns the original set so we never lose the prompt.

Pinned variants (token / glob / position) are untouched — they ran against the full installable set above the auto-pick. Other resolver behavior unchanged.

What's-new bullet × 13 locales.

Summary by CodeRabbit

  • Bug Fixes

    • Auto-update now selects the correct APK when a release includes both standard and F‑Droid variants, preventing accidental installation of a different app package
    • Improved reliability when updating multiple apps consecutively (serialized installs and correct UI version refresh)
  • Localization

    • Updated What’s New / release notes in 13 languages

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 11, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 79a66ba6-bad6-4474-976f-b8f0eb6f9b7d

📥 Commits

Reviewing files that changed from the base of the PR and between 24776be and 299d11d.

📒 Files selected for processing (1)
  • core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/util/AssetVariant.kt

Walkthrough

This PR scopes the resolver's platform auto-pick fallback by the tracked app's package flavor so the final fallback selection prefers assets matching the app's inferred flavor; a new flavor-filter helper performs token normalization and filtering, and localized release notes were updated.

Changes

Package Flavor-Scoped Asset Auto-Pick

Layer / File(s) Summary
Asset Flavor Filter Helper
core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/util/AssetVariant.kt
New filterByPackageFlavor and private canonicalFlavorToken normalize flavor tokens and narrow GithubAsset candidates by package-flavor membership, returning the original list if filtering would be empty.
Resolver Signature and Fallback Logic
core/data/src/commonMain/kotlin/zed/rainxch/core/data/repository/InstalledAppsRepositoryImpl.kt
resolveTrackedRelease accepts trackedPackageName; when fingerprint/same-position matching fail, the platform auto-pick fallback chooses from a flavor-scoped autoPickPool produced by filterByPackageFlavor, while other matching steps still run against the full platform-filtered installable set.
Update Check Call Site
core/data/src/commonMain/kotlin/zed/rainxch/core/data/repository/InstalledAppsRepositoryImpl.kt
checkForUpdates now passes trackedPackageName = app.packageName into resolveTrackedRelease.
Localized Release Notes
core/presentation/src/commonMain/composeResources/files/whatsnew/17.json, .../ar/17.json, .../bn/17.json, .../es/17.json, .../fr/17.json, .../hi/17.json, .../it/17.json, .../ja/17.json, .../ko/17.json, .../pl/17.json, .../ru/17.json, .../tr/17.json, .../zh-CN/17.json
Updated FIXED bullets in version 17 localized JSON files to document that auto-updates now select the correct APK when both standard and F‑Droid variants exist for the same release.

Sequence Diagram(s)

(omitted — change is a focused resolver/data-model tweak with no expanded multi-component runtime sequence beyond existing client/resolver/storage interactions)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰
I sniff the flavor track,
Hop to the right APK pack —
No sibling takes its place,
Auto-updates find their grace.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(updates): scope auto-pick by tracked package flavor' directly and concisely summarizes the main change: scoping the auto-pick asset selection by package flavor to prevent installing mismatched-flavor sibling APKs.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/flavor-mismatch-on-autopick

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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
`@core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/util/AssetVariant.kt`:
- Around line 489-495: package flavor tokens are taken verbatim from
packageSegments and compared against raw asset tokens, so alias forms (e.g.
"f-droid") are missed; change the packageFlavorTokens creation to
normalize/expand aliases before comparison (e.g., replace the current val
packageFlavorTokens = packageSegments.filter { it in FLAVOR_TOKENS }.toSet()
with logic that maps each matching package segment through the same
tokenization/normalization used by extractTokens and collects the resulting
tokens into a set), then keep the existing assets.filter { asset ->
extractTokens(asset.name).any { it in packageFlavorTokens } } check so
comparisons occur between normalized tokens.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 059cabb5-b3b1-41ce-af94-c497d51d7526

📥 Commits

Reviewing files that changed from the base of the PR and between 2203ab1 and 24776be.

📒 Files selected for processing (15)
  • core/data/src/commonMain/kotlin/zed/rainxch/core/data/repository/InstalledAppsRepositoryImpl.kt
  • core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/util/AssetVariant.kt
  • core/presentation/src/commonMain/composeResources/files/whatsnew/17.json
  • core/presentation/src/commonMain/composeResources/files/whatsnew/ar/17.json
  • core/presentation/src/commonMain/composeResources/files/whatsnew/bn/17.json
  • core/presentation/src/commonMain/composeResources/files/whatsnew/es/17.json
  • core/presentation/src/commonMain/composeResources/files/whatsnew/fr/17.json
  • core/presentation/src/commonMain/composeResources/files/whatsnew/hi/17.json
  • core/presentation/src/commonMain/composeResources/files/whatsnew/it/17.json
  • core/presentation/src/commonMain/composeResources/files/whatsnew/ja/17.json
  • core/presentation/src/commonMain/composeResources/files/whatsnew/ko/17.json
  • core/presentation/src/commonMain/composeResources/files/whatsnew/pl/17.json
  • core/presentation/src/commonMain/composeResources/files/whatsnew/ru/17.json
  • core/presentation/src/commonMain/composeResources/files/whatsnew/tr/17.json
  • core/presentation/src/commonMain/composeResources/files/whatsnew/zh-CN/17.json

Comment thread core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/util/AssetVariant.kt Outdated
@rainxchzed rainxchzed merged commit fec4cb8 into main May 11, 2026
1 check was pending
@rainxchzed rainxchzed deleted the fix/flavor-mismatch-on-autopick branch May 11, 2026 09:15
This was referenced May 11, 2026
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