-
Notifications
You must be signed in to change notification settings - Fork 5
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
FF-1939 Update to UFC #41
Conversation
Instead of copying just selected files/directories, have the full repository available to tests.
|
||
// Find matching rule | ||
rule, err := findMatchingRule(subjectAttributes, config.Rules) | ||
err = flag.verifyType(variationType) |
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.
In swift (and android and python) we had to also handle when the variation type did not match the desired kind. specifically the invalid-value-flag
test where an INTEGER
variation type is desired but a double is received. does that get handled for you in a way i'm not seeing? maybe valueToAssignmentValue
is handling that
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.
Yes. That's handled in valueToAssignmentValue
: https://github.com/Eppo-exp/golang-sdk/pull/41/files/80ac9ea3cf91ce0e12a64b97526135d674f4b16d#diff-05660c7f68f1998db7bb1977133831b136836ad85000bedcf3bd0917aee448f6R89
We can't handle this verification here yet as it depends on which variant is selected
return defaultValue, err | ||
} | ||
result, _ := variation.(bool) | ||
return result, err |
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 (vaguely) know that this is a common Go pattern, but given that we return the default value when an error occurs, do we need to return the error here? Is the user ever going to care about what err
is?
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.
Mostly for debugging. The error might be helpful to understand why default value is returned
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.
Yes in theory we can:
return result, nil
That would show "us" that everything is fine at this point. In practice err
should be nil
since we handled both causes of non-nil on line 29 and 33
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.
changes look great; thank you for making improvements to the code like the change to Duration
type and others.
Please consider removing the default TotalShards
of 10k before merging if doing so keeps the tests passing.
if !ok { | ||
return expConfig, errors.New("configuration not found in configuration store") | ||
return flag, errors.New("configuration not found in configuration store") |
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.
Is flag
nil
in this case?
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.
No, it's "empty"—all fields are set to default values. (Can't return nil
from here as the return type is flagConfiguration
not *flagConfiguration
.)
Test case is failing because |
return defaultValue, err | ||
} | ||
result, _ := variation.(bool) | ||
return result, err |
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.
Yes in theory we can:
return result, nil
That would show "us" that everything is fine at this point. In practice err
should be nil
since we handled both causes of non-nil on line 29 and 33
No description provided.