acoustic-carpenter-78188
05/15/2026, 4:50 AMCreateRun passes protobuf requests directly to the repository layer, violating separation of concerns. This creates tight coupling between the API and data layers, making testing harder and inconsistent with the pattern in task_service.go (PR #6813).
What changes were proposed in this pull request?
Refactored CreateRun to use the transformer pattern:
Before: Service → Repository (protobuf) → Database
After: Service → Transformer → Repository (domain model) → Database
New Files:
• runs/repository/transformers/run.go - Converts protobuf → domain model
• `CreateRunRequestToModel`: Transforms incoming request to domain model
• `RunModelToCreateRunResponse`: Builds complete API response with Action hierarchy (ID, Status, Metadata)
Modified Files:
• runs/service/create_run.go - Uses transformers instead of passing protobuf directly
• runs/repository/interfaces/action.go - Changed signature to accept *models.Run
• runs/repository/impl/action_repo.go - Accepts domain models, removed protobuf logic
• runs/service/run_service_test.go - Updated mocks and tests
• runs/repository/mocks/mock_ActionRepo.go - Regenerated mocks to match new interface signature
Key improvements:
• Repository layer no longer depends on protobuf definitions
• Clean separation between API and data layers
• Follows closely as pattern for task_service.go
• Completed RunModelToCreateRunResponse transformer to build full API response hierarchy (includes Action ID, Status with phase/timestamps, and Metadata with source)
How was this patch tested?
• Added unit tests for transformer functions
• Updated service and repository tests to use domain models
• Verified response structure matches expected hierarchy
• All tests pass locally: go test ./runs/... -v
Screenshots
Screenshot 2026-01-11 at 18 14 09 Screenshot 2026-01-12 at 18 13 30 Screenshot 2026-01-12 at 18 13 42
• main
• #6583
• [Refactor]: CreateRun add initial service and response structure 👈
flyteorg/flyteacoustic-carpenter-78188
05/15/2026, 4:50 AM