-
Notifications
You must be signed in to change notification settings - Fork 48
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 propositions return value #1082
Conversation
…at-ing the arrays together
…erience edge have changed.
@@ -70,6 +70,9 @@ describe("mergeLifecycleResponses", () => { | |||
] | |||
} | |||
] | |||
}, | |||
{ | |||
propositions: [] |
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.
A unit test that coves the "merge two arrays" code path would be good.
...lifecycleOnResponseReturnValues, | ||
...consumerOnResponseReturnValues, | ||
...lifecycleOnBeforeRequestReturnValues | ||
); | ||
].reduce((accumulator, currentValue) => { |
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.
This is the defect I was going to tell you about in our meeting the other day. much improved 🏆
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.
i would really like this accumulation
of results to be available as the lifecycle progresses. I know we discussed it possibly being less performant, but might it be worth trying it out? Changing from promise.all
to a sequential evaluation where the responses are accumulated. that still seems like an ideal solution for the decisioning engine propositions to be added.
...lifecycleOnResponseReturnValues, | ||
...consumerOnResponseReturnValues, | ||
...lifecycleOnBeforeRequestReturnValues | ||
); | ||
].reduce((accumulator, currentValue) => { |
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.
Would it help to extract this code into a separate util and unit test that alone?
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.
Love the fix, and all the test updates!
… can be easily tested
@@ -0,0 +1,26 @@ | |||
import assign from "./assign"; |
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.
Look at that beauty :)
@@ -0,0 +1,65 @@ | |||
import assignConcatArrayValues from "../../../../src/utils/assignConcatArrayValues"; |
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.
More beauty!!!
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.
Looks great @jonsnyder ! I think @jasonwaters 's comment is worth discussing, but it can be after the release.
Description
While writing documentation wiki pages for the apply propositions, I noticed that the send event call was not returning anything in propositions. It was always an empty array. After investigation, I found that this was caused by the DecisioningEngine also returning propositions from its onBeforeEvent lifecycle method. This PR changes how the lifecycle return values are merged together. If the merged values are arrays, then the arrays are concat'ed together instead of overwritten.
Additionally, I found a few more tests failing because experience edge is now returning default-content-items when before it wasn't. I've updated the tests to be more lenient on their expectations regarding the number of propositions returned.
Lastly, there are two tests for applyResponse that I skipped because I noticed there are a bunch of new propositions returned from experience edge that are messing up the expectations. See https://jira.corp.adobe.com/browse/PDCL-11302
Related Issue
Motivation and Context
Screenshots (if appropriate):
Types of changes
Checklist: