Skip to content

Commit

Permalink
Switch to longs for hash values for percent condition evaluation (#2507)
Browse files Browse the repository at this point in the history
* Get And condition passing

* Support and.or condition

* Support true condition

* Support false condition, and fix tests

* Use or.and, not the other way around

* Integrate conditional values into evaluate method

* Test handling for multiple conditions

* Clean up logs

* Extract condition evaluation to class for testing

* Namespace condition names

* Iterate over ordered condition list

* Test condition ordering

* Differentiate named conditions

* Document condition types

* Generalize condition eval test and fix styling

* Replace log statement with todo

* Implement evaluate percent condition for RC server-side

* Apply lint fixes

* Add context param to evaluate method

* Add tests for percent condition eval

* Update evaluator tests to use context

* Increase threshold to +/- 500 for percent condition eval tests
to prevent some flaky tests.

* Clean up percentCondition tests a bit and add note on the tolerance used

* Apply suggestions from code review

Co-authored-by: jen_h <harveyjen@google.com>

* Update copyright date and remove stray log statement

* Mock farmhash in tests

* Add Math.abs for farmhash - to be consistent with the internal implementation

* Regenerate package-lock to fix Node 14 CI error re busboy

* Fix lint errors

* Rename "id" to "randomizationId" per discussion

* Extract API

* Only return false in cases of uknown template evaluation

* Remove product prefix from type names

* Remove product prefix from exported types

* Remove unused "expression" field from server condition

* Extract API

* Remove prefix from impl classes, for consistency

* Remove prefix from new internal classes

* Remove "server" prefix

* Remove prefix from NamedCondition

* Rename "or" and "and" fields to match API

* Rename "operator" field to "percentOperator" to match API

* Extract API after "and" and "or" rename

* use longjs library for hash

* re-run npm install

* re-attempt

* use node 14, re-attempt

* remove file

* Add comment, switch from lte to lt

---------

Co-authored-by: Erik Eldridge <erikeldridge@google.com>
Co-authored-by: Xin Wei <xinwei@google.com>
Co-authored-by: jen_h <harveyjen@google.com>
  • Loading branch information
4 people authored Apr 4, 2024
1 parent 69c1262 commit 36db280
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 209 deletions.
Loading

0 comments on commit 36db280

Please # to comment.