Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT]: Workflow Response: Routes, Handler & Processing Utils #1955

Conversation

MuhammadUmer44
Copy link
Contributor

@MuhammadUmer44 MuhammadUmer44 commented Nov 16, 2024

Describe the chnages:

  • Implement workflow responses functionality.

closes: #1941

closes: #1942

closes: #1943

Issue ticket number and link:

Evidence:

WorkflowResponseTest

Route-test

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested on Chrome
  • New feature (non-breaking change which adds functionality)
  • I have provided a screenshot of changes in my PR

@MuhammadUmer44
Copy link
Contributor Author

Hi @humansinstitute, Please review this PR.

@humansinstitute
Copy link
Contributor

Seems to me that we're missing the util functions here to follow the format in the design?

#1943

@MuhammadUmer44
Copy link
Contributor Author

MuhammadUmer44 commented Nov 20, 2024

Seems to me that we're missing the util functions here to follow the format in the design?

#1943

Seems to me that we're missing the util functions here to follow the format in the design?

#1943

Hi @humansinstitute, @tobi-bams, @elraphty,

The processing functionality is already implemented in our current codebase. In HandleWorkflowResponse, we

1- Look up processing requirements:

processingMap, err := wh.db.GetProcessingMapByKey(request.Source, request.Action)

2- Set status to PENDING if processing is required:

https://github.com/stakwork/sphinx-tribes/blob/6d75668bb2b040b1675f005106bf1172f2081e6f/handlers/workflow.go#L99C1-L103C3

All the required fields (Source, RequestID, Action, WorkflowID, RequestData, ResponseData) are already handled in our WfRequest struct.

The only difference is that instead of having this in a utils file, it's integrated into our handler. The functionality matches the design requirements, just with a different structure optimized for our async workflow.

  • Uses GetProcessingMapByKey to check processing requirements
  • Sets status to PENDING if processing needed
  • Stores response data for async processing

@tobi-bams, @elraphty, could you please review this PR?

@humansinstitute
Copy link
Contributor

@tobi-bams could you take a look at this and approve?

}

var response struct {
RequestID string `json:"request_id"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct should only be requestUUID and responseData.

return
}

switch response.Status {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this switch block

return
}

status := response.Status
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The status here should be completed automatically

@humansinstitute humansinstitute merged commit d95a2f1 into stakwork:master Nov 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Response Processing Utils Implement Response Handler Add Workflow Response Route
3 participants