Skip to content

Commit ff80d7d

Browse files
committed
refactor: prepare commands for Phase 5 state management integration
This commit completes Subtask 1 of Phase 5: Preparatory Refactoring. Changes: - Refactor ProvisionCommand structure: * Extract 5 helper methods from execute() for better clarity * Organize methods: public interface first, then private helpers * Remove confusing 'Phase' terminology from comments * Methods: render_opentofu_templates, create_instance, get_instance_info, render_ansible_templates, wait_for_readiness - Remove redundant SshCredentials field: * Pass ssh_credentials as parameter to execute() instead * Update all callers (E2E tests) - Add error context extraction helpers: * extract_failed_step() to identify which step failed * extract_opentofu_step() for OpenTofu-specific error context * Add 6 unit tests for error extraction - Add Phase 5 integration markers: * TODO(Phase 5) comments in ProvisionCommand and ConfigureCommand * Document where state transitions will be integrated - Setup repository infrastructure: * Create RepositoryFactory for environment-specific repository creation * Add repository_factory field to Services container * Extract REPOSITORY_LOCK_TIMEOUT_SECS constant (30 seconds) * Add 5 tests for RepositoryFactory (4 unit + 1 integration) - Code quality improvements: * Add 'clonable' to project-words.txt * Add missing backticks in documentation * Run rustfmt for consistent formatting All 703 tests passing, all linters passing. Ready for Phase 5 Subtasks 2-4.
1 parent 8d8ef9a commit ff80d7d

File tree

7 files changed

+538
-39
lines changed

7 files changed

+538
-39
lines changed

project-words.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ buildx
77
chdir
88
childlogdir
99
clippy
10+
clonable
1011
cloneable
1112
cloudinit
1213
connrefused

src/application/commands/configure.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,19 @@ pub enum ConfigureCommandError {
2020
/// This command handles all steps required to configure infrastructure:
2121
/// 1. Install Docker
2222
/// 2. Install Docker Compose
23+
///
24+
/// # TODO(Phase 5): State Management Integration
25+
///
26+
/// When implementing state management in Phase 5:
27+
/// 1. Add `repository: Arc<dyn EnvironmentRepository>` field
28+
/// 2. Update `new()` to accept repository parameter
29+
/// 3. Change `execute()` to accept `Environment<Provisioned>` instead of no parameters
30+
/// 4. Return `Environment<Configured>` instead of `()`
31+
/// 5. Add state transitions and persistence calls at marked points in `execute()`
2332
pub struct ConfigureCommand {
2433
ansible_client: Arc<AnsibleClient>,
34+
// TODO(Phase 5): Add repository field here
35+
// repository: Arc<dyn EnvironmentRepository>,
2536
}
2637

2738
impl ConfigureCommand {
@@ -49,10 +60,19 @@ impl ConfigureCommand {
4960
"Starting complete infrastructure configuration workflow"
5061
);
5162

63+
// TODO(Phase 5): Transition to Configuring state and persist
64+
// let environment = environment.start_configuring();
65+
// self.persist_state(&environment)?;
66+
5267
InstallDockerStep::new(Arc::clone(&self.ansible_client)).execute()?;
5368

5469
InstallDockerComposeStep::new(Arc::clone(&self.ansible_client)).execute()?;
5570

71+
// TODO(Phase 5): Transition to Configured state and persist
72+
// let configured_env = environment.complete_configuring();
73+
// self.persist_state(&configured_env)?;
74+
// return Ok(configured_env);
75+
5676
info!(
5777
command = "configure",
5878
"Infrastructure configuration completed successfully"

0 commit comments

Comments
 (0)