fix/ADFA-3234 test harness for offline mode#1193
Conversation
📝 WalkthroughRelease Notes
|
| Cohort / File(s) | Summary |
|---|---|
Offline Mode Default preferences/src/main/java/com/itsaky/androidide/preferences/internal/BuildPreferences.kt |
Changed the default value of isOfflineEnabled getter from false to true when the preference key is not found. |
Estimated code review effort
🎯 1 (Trivial) | ⏱️ ~2 minutes
Possibly related PRs
- ADFA-2542 Change preference gradle offline default from true to false #877 — Modifies the same
BuildPreferences.isOfflineEnableddefault in the opposite direction; represents a direct conflict or reversal of this change.
Suggested reviewers
- Daniel-ADFA
Poem
🐰 A toggle flips from false to true,
Offline mode now defaults for you,
The rabbit hops through preferences deep,
Where offline wonders safely keep! ✨
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title 'fix/ADFA-3234 test harness for offline mode' is directly related to the changeset, which modifies the default value of isOfflineEnabled to true for testing offline mode functionality. |
| Description check | ✅ Passed | The description explains the purpose of testing offline mode functionality with the debug APK, which aligns with the code change that enables offline mode by default. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✏️ 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-3234-offline
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 @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@preferences/src/main/java/com/itsaky/androidide/preferences/internal/BuildPreferences.kt`:
- Line 70: The OFFLINE_MODE getter in BuildPreferences.kt currently uses
prefManager.getBoolean(OFFLINE_MODE, true) which silently flips the default to
true for all users; revert the production default to false or make it
debug-only: either change the fallback to prefManager.getBoolean(OFFLINE_MODE,
false) or conditionally use BuildConfig.DEBUG (e.g.,
prefManager.getBoolean(OFFLINE_MODE, BuildConfig.DEBUG)) so the true default
only applies in debug/test builds; update the OFFLINE_MODE usage in
GradleBuildService.kt as needed and mention the intended behavior in the commit
message.
🪄 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: b35c3672-f1db-4e6d-9a91-b7caf3c7958f
📒 Files selected for processing (1)
preferences/src/main/java/com/itsaky/androidide/preferences/internal/BuildPreferences.kt
| /** Switch for Gradle `--offline` option. */ | ||
| var isOfflineEnabled: Boolean | ||
| get() = prefManager.getBoolean(OFFLINE_MODE, false) | ||
| get() = prefManager.getBoolean(OFFLINE_MODE, true) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's examine the BuildPreferences.kt file to see the context around line 70
cat -n preferences/src/main/java/com/itsaky/androidide/preferences/internal/BuildPreferences.kt | head -80 | tail -20Repository: appdevforall/CodeOnTheGo
Length of output: 806
🏁 Script executed:
# Let's see more context around this change - look at the full OFFLINE_MODE property
rg "OFFLINE_MODE" preferences/src/main/java/com/itsaky/androidide/preferences/internal/BuildPreferences.kt -B5 -A5Repository: appdevforall/CodeOnTheGo
Length of output: 974
🏁 Script executed:
# Check if there's git history or metadata about what the previous default was
git log --oneline -20 -- preferences/src/main/java/com/itsaky/androidide/preferences/internal/BuildPreferences.ktRepository: appdevforall/CodeOnTheGo
Length of output: 102
🏁 Script executed:
# Look for GradleBuildService and how it uses OFFLINE_MODE
fd -t f "GradleBuildService"Repository: appdevforall/CodeOnTheGo
Length of output: 236
🏁 Script executed:
# Search for usage of OFFLINE_MODE across the codebase
rg "OFFLINE_MODE" --type java -A2 -B2Repository: appdevforall/CodeOnTheGo
Length of output: 50
🏁 Script executed:
# Check the PR description or branch information if available
git branch -a | head -20Repository: appdevforall/CodeOnTheGo
Length of output: 168
🏁 Script executed:
# Look at GradleBuildService directly for usage of isOfflineEnabled or OFFLINE_MODE
cat -n app/src/main/java/com/itsaky/androidide/services/builder/GradleBuildService.kt | grep -i "offline\|isoffline" -B3 -A3Repository: appdevforall/CodeOnTheGo
Length of output: 370
🏁 Script executed:
# Search for all usages of isOfflineEnabled across the codebase
rg "isOfflineEnabled" --type java -B2 -A2Repository: appdevforall/CodeOnTheGo
Length of output: 50
🏁 Script executed:
# Check the git commit to understand the context of this change
git show 02ca06cb --statRepository: appdevforall/CodeOnTheGo
Length of output: 50381
🏁 Script executed:
# Check if there's a PR or issue description that explains the intent
git log --format="%H %s %b" -1 02ca06cbRepository: appdevforall/CodeOnTheGo
Length of output: 135
🏁 Script executed:
# Look at what getGradleExtraArgs actually does
fd -t f "GradleBuildService.kt"Repository: appdevforall/CodeOnTheGo
Length of output: 146
🏁 Script executed:
# Get the actual file to see the implementation
cat app/src/main/java/com/itsaky/androidide/services/builder/GradleBuildService.kt | head -500 | tail -200Repository: appdevforall/CodeOnTheGo
Length of output: 5744
🏁 Script executed:
# Check PR description or commit body for intent
git log -1 --format="%B" 02ca06cb | head -50Repository: appdevforall/CodeOnTheGo
Length of output: 94
🏁 Script executed:
# Check if there's any test-only annotation or related changes in the same commit
git show 02ca06cb --name-only | grep -i test | head -20Repository: appdevforall/CodeOnTheGo
Length of output: 1645
Offline mode should not become the production default without clear intent.
This commit changes OFFLINE_MODE default from false to true and targets the stage branch. With this change, Gradle builds will append --offline by default for all users (see GradleBuildService.kt lines 479–480), which breaks dependency resolution for projects requiring remote artifacts.
Two specific concerns:
- Existing users who never toggled this setting will silently switch to offline mode on upgrade, since
SharedPreferences.getBooleanreturns the new default only when the key is missing. - The commit message ("make offline mode default") suggests this is intentional, but provides no context about whether this is a permanent production change or a temporary test harness.
Before merging to stage:
- Clarify whether this is meant to ship as the new default behavior or revert to
false. - If shipping, coordinate with docs/release notes to document this user-facing change.
- If this is test-only, use a debug-build-only override or separate experiment branch instead of changing the production default.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@preferences/src/main/java/com/itsaky/androidide/preferences/internal/BuildPreferences.kt`
at line 70, The OFFLINE_MODE getter in BuildPreferences.kt currently uses
prefManager.getBoolean(OFFLINE_MODE, true) which silently flips the default to
true for all users; revert the production default to false or make it
debug-only: either change the fallback to prefManager.getBoolean(OFFLINE_MODE,
false) or conditionally use BuildConfig.DEBUG (e.g.,
prefManager.getBoolean(OFFLINE_MODE, BuildConfig.DEBUG)) so the true default
only applies in debug/test builds; update the OFFLINE_MODE usage in
GradleBuildService.kt as needed and mention the intended behavior in the commit
message.
Testing debug apk with offline mode enabled by default for testing whether the 9 out of 10 templates (except plugin) build offline.