-
Notifications
You must be signed in to change notification settings - Fork 6
Fix false 'directory not empty' warning during init #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix false 'directory not empty' warning during init #22
Conversation
Modified the directory emptiness check to filter out CLI-managed files (.workatoenv, .gitignore, .workato-ignore) before determining if a directory contains user files. This prevents false warnings when the CLI creates these files during initialization. The check now distinguishes between: - CLI-managed files (should be ignored) - User files (should trigger warning) This enables: - Clean initialization without false warnings - Idempotent re-initialization support - Recovery from partial initialization Added 4 comprehensive tests covering: - Interactive mode with CLI-managed files only - Non-interactive mode with CLI-managed files only - User files mixed with CLI-managed files (warning still triggered) - Most common case (only .workatoenv present) All 21 init tests passing, 100% coverage of changed code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a false "directory not empty" warning that incorrectly appears when running workato init in a directory containing only CLI-managed configuration files. The issue occurred because the emptiness check didn't distinguish between files created by the CLI itself (like .workatoenv) and actual user files.
Key Changes:
- Modified the directory emptiness check to filter out CLI-managed files (
.workatoenv,.gitignore,.workato-ignore) - Added logic to only warn users when actual user files are present in the directory
- Added comprehensive test coverage for various initialization scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/workato_platform/cli/commands/init.py |
Updated emptiness check to exclude CLI-managed files from consideration |
tests/unit/commands/test_init.py |
Added 4 new test cases covering CLI file handling and fixed lambda signatures in existing tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Applied some Copilot suggested fixes, you'll need to review and merge. @hovu96
…new-project-directory-is-not-empty-after-init
Summary
Fixes false "directory not empty" warning that appears when running
workato initin a newly created directory.Problem
When initializing a project with
workato init, the CLI shows an incorrect warning:This warning appears even though the directory was just created by the CLI itself. The issue occurs because:
ConfigManager.initialize()creates the project directory and.workatoenvfile.workatoenvSolution
Modified the directory emptiness check in
init.pyto filter out CLI-managed files before determining if a directory contains user files.CLI-managed files (now ignored):
.workatoenv- Configuration file.gitignore- Git ignore patterns.workato-ignore- Workato ignore patternsChanges:
cli_managed_filesset to define files that should be ignoredany(project_dir.iterdir())to checking only non-CLI-managed filesBenefits
✅ No false warnings during clean initialization
✅ Legitimate warnings still work for user files
✅ Supports idempotent re-initialization
✅ Enables recovery from partial initialization
✅ No breaking changes
Test Plan
Added 4 comprehensive unit tests:
test_init_cli_managed_files_ignored_interactive- Verifies CLI files ignored in interactive modetest_init_cli_managed_files_ignored_non_interactive- Verifies CLI files ignored in non-interactive modetest_init_user_files_with_cli_files_triggers_warning- Ensures user files still trigger warningstest_init_only_workatoenv_file_ignored- Tests most common case (only .workatoenv present)Coverage: 100% of changed code
Results: All 21 init tests passing
Files Changed
src/workato_platform/cli/commands/init.py- 11 lines modifiedtests/unit/commands/test_init.py- 246 lines added (4 new tests)Manual Testing
Manually tested the following scenarios:
workato initwith new directory - No false warningworkato initwith existing empty directory - No warningworkato initwith existing non-empty directory - Appropriate warning shownworkato initre-run in same directory - No false warning for CLI-managed files🤖 Generated with Claude Code