Skip to content

fix/ADFA-3234 test harness for offline mode#1193

Closed
jomen-adfa wants to merge 1 commit into
stagefrom
fix/ADFA-3234-offline
Closed

fix/ADFA-3234 test harness for offline mode#1193
jomen-adfa wants to merge 1 commit into
stagefrom
fix/ADFA-3234-offline

Conversation

@jomen-adfa

Copy link
Copy Markdown
Contributor

Testing debug apk with offline mode enabled by default for testing whether the 9 out of 10 templates (except plugin) build offline.

@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Release Notes

  • Offline mode enabled by default: Modified BuildPreferences.isOfflineEnabled to default to true (Gradle --offline option) to support testing of project templates in offline-first scenarios
  • Testing scope: Enables validation that 9 of 10 project templates (excluding the plugin template) build successfully without internet connectivity

⚠️ Risks and Best Practices Violations

  • Breaking behavior change: Enabling offline mode by default is a significant functional change that will affect all builds. This could cause build failures for projects with undeclared online dependencies or remote repository requirements, and the root cause may not be immediately obvious to users.
  • Test harness bleeding into production: This change appears to be for testing purposes, but modifying the default behavior in a core preferences file risks propagating this test-only configuration to production builds if not properly scoped to debug/test variants only.
  • Incomplete validation: The plugin template is explicitly excluded from testing. This creates a gap in validation coverage and should either be tested or the reason for exclusion should be clearly documented.

Walkthrough

The BuildPreferences.isOfflineEnabled property default value is changed from false to true when the OFFLINE_MODE preference is missing. This affects the initial offline mode state in the application preferences system.

Changes

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

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8c1620d and 02ca06c.

📒 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)

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.

⚠️ Potential issue | 🟠 Major

🧩 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 -20

Repository: 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 -A5

Repository: 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.kt

Repository: 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 -B2

Repository: appdevforall/CodeOnTheGo

Length of output: 50


🏁 Script executed:

# Check the PR description or branch information if available
git branch -a | head -20

Repository: 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 -A3

Repository: appdevforall/CodeOnTheGo

Length of output: 370


🏁 Script executed:

# Search for all usages of isOfflineEnabled across the codebase
rg "isOfflineEnabled" --type java -B2 -A2

Repository: appdevforall/CodeOnTheGo

Length of output: 50


🏁 Script executed:

# Check the git commit to understand the context of this change
git show 02ca06cb --stat

Repository: 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 02ca06cb

Repository: 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 -200

Repository: appdevforall/CodeOnTheGo

Length of output: 5744


🏁 Script executed:

# Check PR description or commit body for intent
git log -1 --format="%B" 02ca06cb | head -50

Repository: 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 -20

Repository: 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.getBoolean returns 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.

@jomen-adfa jomen-adfa closed this Apr 17, 2026
@jomen-adfa jomen-adfa deleted the fix/ADFA-3234-offline branch April 17, 2026 02:04
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