-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix(framework): bug with duplicate step names #5921
fix(framework): bug with duplicate step names #5921
Conversation
denis-kralj-novu
commented
Jul 2, 2024
- Move error detection to action endpoints
- Remove throwing on ID collision, log error instead
- Add tests
b5b0a6e
to
3b964d6
Compare
❌ Deploy Preview for novu-design failed. Why did it fail? →
|
✅ Deploy Preview for dev-web-novu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
106f168
to
522c4e7
Compare
Move error detection to action endpoints Remove throwing on ID collision, log error instead Add tests
Lint adjustments
Lint adjustments
522c4e7
to
ce786e8
Compare
[PostActionEnum.EXECUTE]: async () => { | ||
const errors = this.client.getErrors(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ question: what is the usecase for execute? I'm not sure how it gets used in the studio and the bridge api client doesn't seem to use the action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @rifont ☝️
|
||
return this.createResponse(HttpStatusEnum.OK, result); | ||
}, | ||
[GetActionEnum.CODE]: async () => { | ||
const result = await this.client.getCode(workflowId, stepId); | ||
const errors = this.client.getErrors(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ question: same as execute, what is the usecase for code? I'm not sure how it gets used in the studio and the bridge api client doesn't seem to use the action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @rifont ☝️
Place errors in a dedicated property in response object
|
||
const workflowIds = this.discoveredWorkflows.map((discoveredWorkflow) => discoveredWorkflow.workflowId); | ||
|
||
const workflowOccuranceMap = this.getOccuranceMap(workflowIds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: We can do this check in a single pass with an assert function that will throw an error in the first duplicate detection using a reduce function. The accumulator is the occuranceMap.
[PostActionEnum.EXECUTE]: async () => { | ||
const errors = this.client.getErrors(); | ||
|
||
if (errors.length !== 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's generalize error handling across all action types to make the code dryer. Every byte counts in the framework SDK.
|
||
return this.createResponse(HttpStatusEnum.OK, result); | ||
}, | ||
[GetActionEnum.CODE]: async () => { | ||
const result = await this.client.getCode(workflowId, stepId); | ||
const errors = this.client.getErrors(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @rifont ☝️
[PostActionEnum.EXECUTE]: async () => { | ||
const errors = this.client.getErrors(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @rifont ☝️