-
Notifications
You must be signed in to change notification settings - Fork 0
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
Selki/ff 3514 bandit parameters polling only when needed #131
base: main
Are you sure you want to change the base?
Selki/ff 3514 bandit parameters polling only when needed #131
Conversation
2 unit tests are failing due to changes in test json file that happened before I even forked the repo. I've fixed them already though! But in this PR so we can ignore those here. :)) |
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.
looking great and definitely on the right track!
Just some comments I hope may make your testing easier.
Thanks for the lift in this SDK!
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 looking good! Only request is a more beefed up test for this!
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 beefed up the tests! But I've never done this kind of fetch mocking shenanigans before in js, so I'm not 100% confident in the approach I took: passing mock response generator function to fetchSpy initializer and the updateUFC flag which serves as a semi global variable - I hate using this but nothing better comes to my mind tbh.
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.
Just about there!
Can't agree with you more about the awkwardness and repetition encountered when testing bandits.
Ides for how to refactor are most welcome!
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.
Thanks for iterating!
Approving, but before merging you'll want to do three things:
- Rebase on latest main and ensure
package.json
is just a patch (last number) bump - Install this locally and put together a corresponding change and PR for the node SDK to make sure it works upstream as intended
- Get the sign off from @typotter who requested changes
src/configuration-requestor.spec.ts
Outdated
expect(fetchSpy).toHaveBeenCalledTimes(3); // Once just for UFC, bandits should be skipped | ||
}); | ||
|
||
const warmStartBanditReference = { |
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.
these will be hoised to the top-level describe. Consider putting them in either in it's new nested describe()
block along with the three tests that use it.
src/configuration-requestor.spec.ts
Outdated
* 1. initial call - 1 fetch for ufc 1 for bandits | ||
* 2. 2nd call - 1 fetch for ufc only; bandits unchanged | ||
* 3. 3rd call - new bandit ref injected to UFC; 2 fetches, because new bandit appeared | ||
* 4. 4th call - we remove a bandit from ufc; 1 fetch because there is no need to update. | ||
* The bandit removed from UFC should still be in memory. |
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 comment!
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.
👍 agreed - super handy. It's easy to get lost when a test has to do multiple rounds of Arrange-Act-Assert to fully test functionality.
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.
🙌
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.
Great stuff. Going to see some solid improvement on our fastly request volumes with this.
LGTM, pending the version change and other comments from @aarsilv
490336d
to
31cde96
Compare
labels: mergeable
Fixes: #issue
Motivation and Context
//: # Requesting bandits only when needed (when modelVersions differ) saves bandwidth! :)
Description
//: # Before requesting new bandits I do a simple comparison of loaded model version vs the newest model version contained in UFC
How has this been tested?