Skip to content

feat(ADFA-2994): Increase minimum storage needed for install#987

Open
dara-abijo-adfa wants to merge 1 commit intostagefrom
ADFA-2994-increase-minimum-storage
Open

feat(ADFA-2994): Increase minimum storage needed for install#987
dara-abijo-adfa wants to merge 1 commit intostagefrom
ADFA-2994-increase-minimum-storage

Conversation

@dara-abijo-adfa
Copy link
Contributor

Increase the minimum storage needed for installation so users with low storage will be notified.

@dara-abijo-adfa dara-abijo-adfa requested a review from a team February 17, 2026 11:06
@dara-abijo-adfa dara-abijo-adfa self-assigned this Feb 17, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

📝 Walkthrough

Release Notes - ADFA-2994: Increase Minimum Storage Needed for Install

Feature Changes

  • Increased minimum storage requirements for IDE installation to prevent installation failures on low-storage devices

    • Stable build: 4 GB (previously lower threshold)
    • Experimental build: 6 GB (higher threshold for experimental features)
  • Feature-flag controlled requirement: Storage threshold is now dynamically determined based on FeatureFlags.isExperimentsEnabled

  • Enhanced user notifications: Users with insufficient storage will receive a clearer error message indicating exactly how much additional storage is needed

Technical Changes

  • InstallationViewModel.kt:
    • Added MINIMUM_STORAGE_STABLE_GB (4L) and MINIMUM_STORAGE_EXPERIMENTAL_GB (6L) constants
    • Added computed minimumStorageNeeded property that selects threshold based on feature flag state
    • Updated getStorageInfo() to use the feature-flag dependent threshold
    • Added FeatureFlags import

Risks & Best Practices Violations

  • ⚠️ Runtime feature flag dependency: The storage threshold now varies at runtime based on feature flag state. This means:

    • Experimental users may fail installation where stable users succeed on the same device
    • Consider whether this behavioral difference is intentional and well-documented for support/troubleshooting
  • ⚠️ No explicit constant export: The storage requirement constants are private companion object members, making it difficult for other modules or documentation to reference the exact requirements without code inspection

  • ⚠️ Lack of logging: No debug/info logs indicating which threshold was selected (stable vs. experimental), which could complicate troubleshooting of storage-related installation failures

Impact

  • Low: Internal storage validation logic only; no public API changes
  • Users affected: Those with 4-6 GB available storage on experimental builds will be unable to install

Walkthrough

A feature-flag dependent storage requirement is introduced that replaces a fixed storage threshold with conditional logic. Two new constants define minimum storage for stable and experimental builds, with a computed property selecting between them based on feature flag status.

Changes

Cohort / File(s) Summary
Storage Requirement Logic
app/src/main/java/com/itsaky/androidide/viewmodel/InstallationViewModel.kt
Replaces single fixed storage threshold (LEAST_STORAGE_NEEDED_FOR_INSTALLATION) with two feature-flag-dependent constants (MINIMUM_STORAGE_STABLE_GB = 4L, MINIMUM_STORAGE_EXPERIMENTAL_GB = 6L). Adds computed minimumStorageNeeded property that conditionally selects threshold based on FeatureFlags.isExperimentsEnabled. Updates storage calculation to use new dynamic property. Adds FeatureFlags import.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A storage riddle, now with flags so bright,
Four gigs for stable, six for experimental might,
Feature-aware thresholds hop and dance,
Giving users choices at a glance! 🚀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: increasing the minimum storage requirement for installation, which directly aligns with the changeset that replaces fixed storage thresholds with feature-flag dependent constants.
Description check ✅ Passed The description is related to the changeset, explaining the purpose of increasing storage requirements so users with low storage are notified, which aligns with the implementation changes introducing feature-flag dependent storage thresholds.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ADFA-2994-increase-minimum-storage

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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
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 the current code and only fix it if needed.

Inline comments:
In `@app/src/main/java/com/itsaky/androidide/viewmodel/InstallationViewModel.kt`:
- Around line 42-47: The getter minimumStorageNeeded reads
FeatureFlags.isExperimentsEnabled which indirectly reads the shared flags field
without synchronization; to make it explicitly thread-safe, protect that read by
acquiring the same mutex used in initialize() (use mutex.withLock {
FeatureFlags.isExperimentsEnabled } or wrap the whole conditional in
mutex.withLock) so the computed property cannot observe intermediate flag state,
or alternatively mark the flags field `@Volatile` if you prefer lock-free
visibility—apply the chosen change to minimumStorageNeeded and keep initialize()
unchanged.

Comment on lines +42 to +47
private val minimumStorageNeeded: Long
get() = if (FeatureFlags.isExperimentsEnabled) {
MINIMUM_STORAGE_EXPERIMENTAL_GB
} else {
MINIMUM_STORAGE_STABLE_GB
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, find the FeatureFlags file
fd -t f 'FeatureFlags' --extension=kt

Repository: appdevforall/CodeOnTheGo

Length of output: 132


🏁 Script executed:

#!/bin/bash
# Search for isExperimentsEnabled definition and usage
rg -n 'isExperimentsEnabled' --type=kotlin -B 2 -A 5

Repository: appdevforall/CodeOnTheGo

Length of output: 9661


🏁 Script executed:

#!/bin/bash
# Check for the getStorageInfo method to understand threading context
rg -n 'getStorageInfo' --type=kotlin -B 2 -A 10

Repository: appdevforall/CodeOnTheGo

Length of output: 3223


🏁 Script executed:

#!/bin/bash
# Look for FeatureFlags object definition
rg -n 'object FeatureFlags' --type=kotlin -A 30

Repository: appdevforall/CodeOnTheGo

Length of output: 3096


🏁 Script executed:

#!/bin/bash
# Check how flags is accessed and if mutex is used
rg -n 'flags\.' common/src/main/java/com/itsaky/androidide/utils/FeatureFlags.kt -B 1 -A 1

Repository: appdevforall/CodeOnTheGo

Length of output: 769


🏁 Script executed:

#!/bin/bash
# Check for mutex usage in FeatureFlags
rg -n 'mutex' common/src/main/java/com/itsaky/androidide/utils/FeatureFlags.kt -B 2 -A 2

Repository: appdevforall/CodeOnTheGo

Length of output: 367


🏁 Script executed:

#!/bin/bash
# Check the full FeatureFlags file to understand the synchronization strategy
wc -l common/src/main/java/com/itsaky/androidide/utils/FeatureFlags.kt

Repository: appdevforall/CodeOnTheGo

Length of output: 136


🏁 Script executed:

#!/bin/bash
# Get the full FeatureFlags file
cat -n common/src/main/java/com/itsaky/androidide/utils/FeatureFlags.kt

Repository: appdevforall/CodeOnTheGo

Length of output: 3529


The getter should be protected by the mutex to ensure explicit thread-safety.

The computed property is correct and idiomatic. However, the thread-safety concern is valid: FeatureFlags.isExperimentsEnabled reads flags.experimentsEnabled without acquiring the Mutex, while the initialize() function safely updates flags using mutex.withLock(). This creates an unprotected read path that could see stale or intermediate values during flag updates.

While Boolean field access is atomic at the JVM level (mitigating practical risk), the code is not explicitly thread-safe by design. Either acquire the mutex in the getter or annotate the flags field with @Volatile for clarity and correctness.

🤖 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/viewmodel/InstallationViewModel.kt`
around lines 42 - 47, The getter minimumStorageNeeded reads
FeatureFlags.isExperimentsEnabled which indirectly reads the shared flags field
without synchronization; to make it explicitly thread-safe, protect that read by
acquiring the same mutex used in initialize() (use mutex.withLock {
FeatureFlags.isExperimentsEnabled } or wrap the whole conditional in
mutex.withLock) so the computed property cannot observe intermediate flag state,
or alternatively mark the flags field `@Volatile` if you prefer lock-free
visibility—apply the chosen change to minimumStorageNeeded and keep initialize()
unchanged.

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.

2 participants