We need to orchestrate these services into a seamless workflow.
Input
# the starting point is a GeneratedApp that is created based on the UI
# for the duration of this implementation, just create it from the Rails console
GeneratedApp.create!(name: '...', user_id: trinitytakei, ...)
# name has been validated by GithubRepositoryNameValidator
# ensuring the repository name is available on Github
Workflow Steps
Create Github repository
Input: generated_app.name
Service: GithubRepositoryService
Output: generated_app updated with Github repository details
Generate Rails application
Input: Rails new command and generated_app
Service: CommandExecutionService
Output: Generated app directory path
Push to Github
Input: generated_app and directory path from the previous step
Service: GithubCodePushService
Output: Pushed repository details
Technical Requirements
Create Orchestrator Service
class RailsAppGenerationOrchestrator
def initialize(generated_app)
@generated_app = generated_app
end
# Orchestration logic here
# for now sequential and synchronous;
# once it's ready and testes, some steps can be parallel
# and in each case they will run in a background job
# use the acidic_job gem https://github.com/fractaledmind/acidic_job
end
Error Handling
Rely on Acidic job's error handling
Logging
Log progress of each step (use AppGeneration::Logger)
Track timing information
Record any warnings or issues
Acceptance Criteria
[x] Successfully creates Github repository
[x] Generates Rails application with correct name
[x] Pushes code to Github repository
[x] Handles errors gracefully with proper cleanup
[x] Provides detailed logging of the process
[x] Implements proper rollback on failures
[x] Returns success/failure status with relevant details
Test Requirements
[x] Unit tests for orchestrator logic
[x] Integration tests for full workflow
[x] Error scenario tests
[x] Rollback scenario tests
[x] Mock external service calls in tests
Implementation Notes
• Add monitoring hooks for observability
• Consider adding progress callbacks for UI updates
Objective
Create an orchestration service that coordinates the end-to-end process of generating a Rails application and pushing it to a new Github repository.
Background
We have three existing services that handle individual parts of the workflow:
GithubRepositoryService
: Creates Github repositoriesCommandExecutionService
: Executes Rails commands securelyGithubCodePushService
: Pushes code to GithubWe need to orchestrate these services into a seamless workflow.
Input
Workflow Steps
Create Github repository
generated_app.name
GithubRepositoryService
generated_app
updated with Github repository detailsGenerate Rails application
generated_app
Push to Github
generated_app
and directory path from the previous stepGithubCodePushService
Technical Requirements
Error Handling
Logging
Acceptance Criteria
Test Requirements
Implementation Notes
Dependencies
Out of Scope