Fix: Remove SSH key file existence validation from config parsing#341
Conversation
SSH key files are external resources that should be validated at runtime when actually needed (during provision/configure), not during configuration parsing or validation. This allows: - Configs to be validated on machines without SSH keys - SSH keys to be on different machines than where config is validated - More flexible deployment workflows Changes: - Removed file existence checks from TryFrom<SshCredentialsConfig> - Updated validate command to skip file existence validation - Marked 5 obsolete tests as #[ignore] with explanatory comments - SSH keys now validated when SSH connections are attempted (runtime) Error handling remains user-friendly - provision command will fail with clear message if SSH keys don't exist when actually needed. Fixes #340
The success() method automatically adds a checkmark emoji via the theme, so we shouldn't include it in the message text. This caused a duplicate '✅ ✅' to appear in the validate command success message. Output before: ✅ ✅ Configuration file 'x.json' is valid Output after: ✅ Configuration file 'x.json' is valid
|
ACK 5c873cd |
ℹ️ Test Failure NoticeThe What's FailingThe test This is a Docker BuildKit cache/tag conflict issue in GitHub Actions CI environments, not a failure caused by the changes in this PR. Tracking Issue🔗 Issue #342: Fix Docker BuildKit "image already exists" error in dependency-installer tests The fix will be implemented in a separate PR to maintain clean separation of concerns. Why Merge This PR
This PR can be safely merged as the changes are complete, tested, and do not introduce any regressions. |
Fixes #340
Problem
The
validatecommand was incorrectly checking whether SSH key files exist on the filesystem during configuration validation. This caused valid configurations with absolute paths to be rejected if the SSH key files weren't present at validation time.This was an architectural issue: file existence is a runtime concern that should be checked when SSH connections are actually attempted (during
provisionorconfigure), not during configuration parsing.Solution
Removed all file existence checks from the
TryFrom<SshCredentialsConfig>implementation:Changes
Core Fix
src/application/command_handlers/create/config/ssh_credentials_config.rs: Removed file existence validation fromTryFromimplementationsrc/application/command_handlers/validate/handler.rs: Updated comments to clarify validation scopeUI Polish
src/presentation/controllers/validate/handler.rs: Fixed duplicate ✅ emoji in success message (Theme already adds checkmark automatically)Tests
tests/e2e/validate_command.rs: Removed obsolete E2E test expecting file validation#[ignore]with explanatory comments (tests now check old behavior)Testing
✅ Bug fixed:
validatenow accepts absolute paths even if files don't exist✅ Path validation preserved: Relative paths still rejected with clear error
✅ Runtime errors user-friendly:
provisionshows clear error when SSH keys missing:✅ All tests passing: 425 passed, 54 ignored, 0 failed
Verification Commands