Skip to content

feat(analyze): fix bugs in analyze mode - detect OrbStack, Gradle and Python caches#20

Merged
Sstark97 merged 11 commits intomainfrom
feature/issue-6-analyze-mode
Jan 30, 2026
Merged

feat(analyze): fix bugs in analyze mode - detect OrbStack, Gradle and Python caches#20
Sstark97 merged 11 commits intomainfrom
feature/issue-6-analyze-mode

Conversation

@Sstark97
Copy link
Owner

🐛 Bug Fixes in Analyze Mode

Fixes #6

Problem

Demo revealed that analyze mode was missing ~9.3GB of cleanable caches:

  • ❌ OrbStack cache: 4.9GB (early return bug in docker.sh)
  • ❌ Gradle caches: 1.5GB (no ANALYZE_MODE support)
  • ❌ pip cache: 500M (asked for confirmation instead of registering)

Solution

Created register_if_analyzing() helper function and fixed all 3 modules to properly detect caches in analyze mode.

Changes Made

1. Helper Function (src/utils/common.sh)

  • Added register_if_analyzing() - encapsulates analyze-first pattern
  • Automatically gets size if path exists
  • Returns 0 if analyzing (caller should return), 1 otherwise

2. OrbStack Fix (src/modules/docker.sh)

  • Moved OrbStack detection before early return in docker_clean()
  • Now properly registers OrbStack cache (~4.9GB) in analyze mode

3. Gradle Fix (src/modules/devtools.sh)

  • Added ANALYZE_MODE support in remove_outdated_gradle_caches()
  • Registers each outdated Gradle version cache before cleanup

4. Python/pip Fix (src/modules/devtools.sh)

  • Moved cache detection before confirm_action() in clear_python_package_caches()
  • Registers pip and poetry caches without asking for confirmation in analyze mode

5. Tests

  • Added focused unit tests in docker_test.sh and devtools_test.sh
  • All 115 tests passing ✅

6. Demo & Documentation

  • Updated demo.tape to show analyze detecting ~14GB
  • Updated README.md with demo GIF and analyze mode documentation
  • Updated setup-demo.sh to clarify 18GB created → 14GB cleanable

Results

Before:

Total estimated space to free: 8GB

After:

╠════════════════════════════════════════════════════╣
║  JetBrains:                                          ║
║      • 5 old versions (2.5GB)                      ║
║                                                    ║
║  Dev Tools:                                          ║
║      • Maven cache (3.9G)                       ║
║      • Node.js caches (1.5GB)                   ║
║      • pip cache (500M)                         ║
║                                                    ║
║  Homebrew:                                          ║
║      • 89 outdated packages (4.4GB)             ║
║      • Download cache (2.0G)                    ║
║                                                    ║
║  Docker:                                          ║
║      • OrbStack cache (4.9G)                    ║
║                                                    ║
╠════════════════════════════════════════════════════╣
║  Total estimated space to free: 13GB           ║
╚════════════════════════════════════════════════════╝

+5GB detected (13GB vs 8GB before) ✨

Testing

$ make test
Tests:      115 passed, 115 total
Assertions: 153 passed, 153 total
 All tests passed 
Time taken: 12.80s

Checklist

  • Bug fixes implemented with clean, semantic code
  • Helper function for DRY principle
  • Unit tests added (3 new tests)
  • All existing tests passing
  • Demo updated with real workflow
  • README documentation updated
  • Smoke test E2E validation passing

- Updated cleanup_test.sh to reduce test file sizes for faster execution.
- Removed interactive_menu_test.sh as it was redundant and covered by smoke tests.
- Added smoke_test.sh for critical end-to-end validations of CLI and interactive menu.
- Enhanced analyze_mode_test.sh to streamline setup and teardown processes.
- Optimized devtools_test.sh by removing placeholder tests and focusing on essential functionality.
- Improved jetbrains_test.sh by reducing the number of mock installations for efficiency.
- Added analyze mode detection tests in docker_test.sh and other relevant test files.
@Sstark97
Copy link
Owner Author

It resolver issue #6

@Sstark97 Sstark97 merged commit c9ccaf6 into main Jan 30, 2026
2 checks passed
@Sstark97 Sstark97 deleted the feature/issue-6-analyze-mode branch January 30, 2026 22:56
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.

UX-004: Adopt standard CLI pattern for confirmations

1 participant