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

fix(framework): bug with duplicate step names #5921

Closed

Conversation

denis-kralj-novu
Copy link
Contributor

  • Move error detection to action endpoints
  • Remove throwing on ID collision, log error instead
  • Add tests

Copy link

linear bot commented Jul 2, 2024

Copy link

netlify bot commented Jul 2, 2024

Deploy Preview for novu-design failed. Why did it fail? →

Name Link
🔨 Latest commit 0463a87
🔍 Latest deploy log https://app.netlify.com/sites/novu-design/deploys/6683f8944d51f60008d8d772

Copy link

netlify bot commented Jul 2, 2024

Deploy Preview for dev-web-novu ready!

Name Link
🔨 Latest commit 0463a87
🔍 Latest deploy log https://app.netlify.com/sites/dev-web-novu/deploys/6683f894e770270008f39c48
😎 Deploy Preview https://deploy-preview-5921--dev-web-novu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Move error detection to action endpoints
Remove throwing on ID collision, log error instead
Add tests
[PostActionEnum.EXECUTE]: async () => {
const errors = this.client.getErrors();
Copy link
Contributor Author

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.

Copy link
Contributor

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();
Copy link
Contributor Author

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.

Copy link
Contributor

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);
Copy link
Contributor

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) {
Copy link
Contributor

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();
Copy link
Contributor

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();
Copy link
Contributor

Choose a reason for hiding this comment

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

cc: @rifont ☝️

@denis-kralj-novu denis-kralj-novu self-assigned this Jul 3, 2024
@denis-kralj-novu denis-kralj-novu marked this pull request as draft July 3, 2024 11:06
@rifont rifont deleted the nv-4067-bug-with-duplicate-step-names-in-workflow branch November 7, 2024 18:31
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.

2 participants