Backend for sphinx tribes and bounties. The bounty platform pays out in bitcoin. Sign up with Sphinx Chat, complete a bounty, and earn bitcoin! Go to our website for available bounties.
After receiving responses from Stakwork workflows, the system needs to execute different actions based on the workflow type and response. We need a flexible, maintainable system to map workflow responses to their corresponding handler functions.
Design
@tobi-bams can you map out a design for this.
e.g:
Action Registry - defines all actions strings that map to default to "log and exit"
Action Context - typed objects for
Action Handlers - e.g. update user stories, output ticket plan, log and exit
e.g. context
type ActionContext struct {
RequestUUID string // A unique ID for this request
WorkflowID string // Which workflow it came from
Source string // Where it came from
ActionString string // What needs to be done
ResponseData []byte // The actual data to process
}
Assignment Criteria
Strong understanding of Go interfaces and dependency injection
Experience with concurrent operations in Go
Connected on Sphinx V2
Acceptance Criteria
[ ] Implement ActionHandler interface
[ ] Create ActionRegistry with thread-safe operations
[ ] Implement example handlers for:
[ ] User story generation
[ ] Ticket planning
[ ] (Other workflow types as needed)
[ ] Add comprehensive unit tests for registry and handlers
[ ] Add integration tests for the complete workflow
[ ] Implement error handling and logging
[ ] Document handler registration process
[ ] Create examples for adding new handlers
Usage Example
To add a new workflow action:
Define a new handler:
type NewFeatureHandler struct {
db *sqlx.DB
logger *zap.Logger
}
Context
After receiving responses from Stakwork workflows, the system needs to execute different actions based on the workflow type and response. We need a flexible, maintainable system to map workflow responses to their corresponding handler functions.
Design
@tobi-bams can you map out a design for this.
e.g:
Action Registry - defines all actions strings that map to default to "log and exit" Action Context - typed objects for Action Handlers - e.g. update user stories, output ticket plan, log and exit
e.g. context
Assignment Criteria
Acceptance Criteria
Usage Example
To add a new workflow action:
func (h *NewFeatureHandler) Handle(ctx context.Context, actionCtx ActionContext) error { // Implementation return nil }
func (h *NewFeatureHandler) ValidateInput(actionCtx ActionContext) error { // Validation return nil }