Skip to content

fix/ADFA-1123 Better error message for missing assets zip#1155

Open
jomen-adfa wants to merge 3 commits intostagefrom
fix/ADFA-1123-no-assets-zip
Open

fix/ADFA-1123 Better error message for missing assets zip#1155
jomen-adfa wants to merge 3 commits intostagefrom
fix/ADFA-1123-no-assets-zip

Conversation

@jomen-adfa
Copy link
Copy Markdown
Contributor

Show error message when assets zip is missing on install of debug APK and inform user where to get access to it

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 44b91bbb-9d20-42f9-8004-a3c8e0faa391

📥 Commits

Reviewing files that changed from the base of the PR and between 7e1a3db and 15f3c42.

📒 Files selected for processing (1)
  • app/src/main/java/com/itsaky/androidide/assets/AssetsInstallationHelper.kt
✅ Files skipped from review due to trivial changes (1)
  • app/src/main/java/com/itsaky/androidide/assets/AssetsInstallationHelper.kt

📝 Walkthrough
  • Overview: Improved error handling and user-facing messaging when the assets zip is missing during debug APK installation.
  • Changes:
    • AssetsInstallationHelper.doInstall(): on FileNotFoundException now calls flashError("File not found - ${e.message}") instead of signaling the condition via onProgress(Progress(...)), ensuring the missing-assets error is surfaced more prominently to users.
    • SplitAssetsInstaller.preInstall(): when Environment.SPLIT_ASSETS_ZIP does not exist, the thrown FileNotFoundException now includes actionable guidance: "Assets zip file not found at path: [path]. Please check Slack #qa-testing-builds channel for the latest version."
    • Logging: ZIP file-not-found errors remain logged (logger.error("ZIP file not found: {}", e.message)).
  • Example error message shown to users:
    • "Assets zip file not found at path: [path]. Please check Slack #qa-testing-builds channel for the latest version."
  • Risks & Best-practice considerations:
    • ⚠️ Error flow change: Switching from onProgress(...) to flashError(...) changes how missing-asset errors are presented and propagated. Verify the UI and installation workflow still handle the failure correctly (installation should stop and no further processing should occur).
    • ⚠️ Hardcoded external reference: The message points to a specific Slack channel (#qa-testing-builds). This couples code to a communication channel name and risks becoming stale. Consider making the guidance configurable or documented in runbooks.
    • Recommendation: Add tests and manual verification for the complete error path (preInstall failure → flashError display → installation abort) and consider centralizing user-facing guidance strings for easier updates.

Walkthrough

Replaces progress-based handling with a flashError call for FileNotFoundException in AssetsInstallationHelper.doInstall; also updates the FileNotFoundException message in SplitAssetsInstaller.preInstall to include additional guidance when Environment.SPLIT_ASSETS_ZIP is missing.

Changes

Cohort / File(s) Summary
AssetsInstallationHelper change
app/src/main/java/com/itsaky/androidide/assets/AssetsInstallationHelper.kt
Switched FileNotFoundException handling in doInstall from reporting progress (onProgress(Progress(...))) to invoking flashError(...), while still logging the error and returning false.
SplitAssetsInstaller message
app/src/main/java/com/itsaky/androidide/assets/SplitAssetsInstaller.kt
Augmented the FileNotFoundException message in preInstall to include extra guidance text when Environment.SPLIT_ASSETS_ZIP is not found (message text change only).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • itsaky-adfa

Poem

🐰
I hopped through code with eager paw,
Replaced a progress with a flaw-fix law.
Now when a ZIP is lost from sight,
I flash an error — crisp and bright. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Better error message for missing assets zip' accurately summarizes the main change: improving error messaging when assets zip files are missing during installation.
Description check ✅ Passed The description directly relates to the changeset, explaining the purpose: showing an error message when assets zip is missing during debug APK installation and informing users where to obtain the file.

✏️ 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/ADFA-1123-no-assets-zip

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

🧹 Nitpick comments (1)
app/src/main/java/com/itsaky/androidide/assets/SplitAssetsInstaller.kt (1)

40-41: Move this user-facing message to string resources.

Line 40-41 hardcodes UI-visible text in code. Since this string is flashed to users, keep it in strings.xml for localization and easier updates.

Proposed refactor
-				throw FileNotFoundException("Assets zip file not found at path: ${Environment.SPLIT_ASSETS_ZIP.path}." +
-                        " Please check Slack `#qa-testing-builds` channel for the latest version.")
+				throw FileNotFoundException(
+					context.getString(
+						R.string.err_split_assets_zip_missing_with_guidance,
+						Environment.SPLIT_ASSETS_ZIP.path
+					)
+				)
<!-- res/values/strings.xml -->
<string name="err_split_assets_zip_missing_with_guidance">
    Assets zip file not found at path: %1$s. Please check Slack `#qa-testing-builds` channel for the latest version.
</string>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/src/main/java/com/itsaky/androidide/assets/SplitAssetsInstaller.kt`
around lines 40 - 41, The hardcoded user-facing message thrown in
SplitAssetsInstaller (the FileNotFoundException creation) should be moved to
strings.xml and loaded via resources; add a new string resource like
err_split_assets_zip_missing_with_guidance with a %1$s placeholder for the path,
then replace the literal in the throw inside SplitAssetsInstaller (where
FileNotFoundException("Assets zip file not found at path:
${Environment.SPLIT_ASSETS_ZIP.path}...")) with a call that formats the resource
(e.g., context.getString(R.string.err_split_assets_zip_missing_with_guidance,
Environment.SPLIT_ASSETS_ZIP.path) or use Resources.getString) so the exception
message is localized and not hardcoded.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/src/main/java/com/itsaky/androidide/assets/AssetsInstallationHelper.kt`:
- Line 135: In AssetsInstallationHelper.kt the call to
flashError("${e.message}") can display the literal "null" when e.message is
null; change the argument to use a safe fallback (e.g. use e.message ?:
e.toString() ?: "Unknown error" or e.localizedMessage ?:
e::class.java.simpleName) so flashError receives a meaningful string instead of
"null" (update the flashError call where the exception `e` is handled).

---

Nitpick comments:
In `@app/src/main/java/com/itsaky/androidide/assets/SplitAssetsInstaller.kt`:
- Around line 40-41: The hardcoded user-facing message thrown in
SplitAssetsInstaller (the FileNotFoundException creation) should be moved to
strings.xml and loaded via resources; add a new string resource like
err_split_assets_zip_missing_with_guidance with a %1$s placeholder for the path,
then replace the literal in the throw inside SplitAssetsInstaller (where
FileNotFoundException("Assets zip file not found at path:
${Environment.SPLIT_ASSETS_ZIP.path}...")) with a call that formats the resource
(e.g., context.getString(R.string.err_split_assets_zip_missing_with_guidance,
Environment.SPLIT_ASSETS_ZIP.path) or use Resources.getString) so the exception
message is localized and not hardcoded.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5fb23c53-f08c-4758-806c-377432e0eacb

📥 Commits

Reviewing files that changed from the base of the PR and between c85bf67 and 7e1a3db.

📒 Files selected for processing (2)
  • app/src/main/java/com/itsaky/androidide/assets/AssetsInstallationHelper.kt
  • app/src/main/java/com/itsaky/androidide/assets/SplitAssetsInstaller.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