Skip to content

Commit ae98702

Browse files
committed
chore: migrate in-tree callers off deprecated bigSegmentStatus APIs
1 parent d76992d commit ae98702

4 files changed

Lines changed: 29 additions & 10 deletions

File tree

libs/common/include/launchdarkly/data/evaluation_reason.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ class EvaluationReason {
190190
friend std::ostream& operator<<(std::ostream& out,
191191
EvaluationReason const& reason);
192192

193+
friend bool operator==(EvaluationReason const& lhs,
194+
EvaluationReason const& rhs);
195+
193196
private:
194197
enum Kind kind_;
195198
std::optional<enum ErrorKind> error_kind_;

libs/common/src/data/evaluation_reason.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ bool operator==(EvaluationReason const& lhs, EvaluationReason const& rhs) {
164164
return lhs.Kind() == rhs.Kind() && lhs.ErrorKind() == rhs.ErrorKind() &&
165165
lhs.InExperiment() == rhs.InExperiment() &&
166166
lhs.BigSegmentsStatus() == rhs.BigSegmentsStatus() &&
167-
lhs.BigSegmentStatus() == rhs.BigSegmentStatus() &&
167+
lhs.big_segment_status_ == rhs.big_segment_status_ &&
168168
lhs.PrerequisiteKey() == rhs.PrerequisiteKey() &&
169169
lhs.RuleId() == rhs.RuleId() && lhs.RuleIndex() == rhs.RuleIndex();
170170
}

libs/common/tests/bindings/evaluation_detail_test.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ TEST(EvaluationDetailBindings, EvaluationReasonError) {
2222

2323
TEST(EvaluationDetailBindings, EvaluationReasonFallthrough) {
2424
auto reason = EvaluationReason(EvaluationReason::Kind::kFallthrough,
25-
std::nullopt, std::nullopt, std::nullopt,
26-
std::nullopt, true, std::nullopt);
25+
/* error_kind= */ std::nullopt,
26+
/* rule_index= */ std::nullopt,
27+
/* rule_id= */ std::nullopt,
28+
/* prerequisite_key= */ std::nullopt,
29+
/* in_experiment= */ true,
30+
EvaluationReason::BigSegmentsStatus::kNone);
2731
auto ld_reason = reinterpret_cast<LDEvalReason>(&reason);
2832

2933
ASSERT_EQ(LDEvalReason_Kind(ld_reason), LD_EVALREASON_FALLTHROUGH);
@@ -52,9 +56,13 @@ TEST(EvaluationDetailBindings, EvaluationDetailError) {
5256
TEST(EvaluationDetailBindings, EvaluationDetailSuccess) {
5357
auto detail = CEvaluationDetail(EvaluationDetail<bool>(
5458
true, 42,
55-
EvaluationReason(EvaluationReason::Kind::kFallthrough, std::nullopt,
56-
std::nullopt, std::nullopt, std::nullopt, true,
57-
std::nullopt)));
59+
EvaluationReason(EvaluationReason::Kind::kFallthrough,
60+
/* error_kind= */ std::nullopt,
61+
/* rule_index= */ std::nullopt,
62+
/* rule_id= */ std::nullopt,
63+
/* prerequisite_key= */ std::nullopt,
64+
/* in_experiment= */ true,
65+
EvaluationReason::BigSegmentsStatus::kNone)));
5866

5967
auto ld_detail = reinterpret_cast<LDEvalDetail>(&detail);
6068

libs/internal/tests/event_summarizer_test.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,13 @@ static FeatureEventParams FeatureEventFromParams(EvaluationParams params,
124124
params.feature_version,
125125
params.feature_variation,
126126
launchdarkly::EvaluationReason(
127-
launchdarkly::EvaluationReason::Kind::kFallthrough, std::nullopt,
128-
std::nullopt, std::nullopt, std::nullopt, false, std::nullopt),
127+
launchdarkly::EvaluationReason::Kind::kFallthrough,
128+
/* error_kind= */ std::nullopt,
129+
/* rule_index= */ std::nullopt,
130+
/* rule_id= */ std::nullopt,
131+
/* prerequisite_key= */ std::nullopt,
132+
/* in_experiment= */ false,
133+
launchdarkly::EvaluationReason::BigSegmentsStatus::kNone),
129134
false,
130135
std::nullopt,
131136
};
@@ -356,8 +361,11 @@ TEST(SummarizerTests, MissingFlagCreatesCounterUsingDefaultValue) {
356361

357362
EvaluationReason(EvaluationReason::Kind::kError,
358363
EvaluationReason::ErrorKind::kFlagNotFound,
359-
std::nullopt, std::nullopt, std::nullopt, false,
360-
std::nullopt),
364+
/* rule_index= */ std::nullopt,
365+
/* rule_id= */ std::nullopt,
366+
/* prerequisite_key= */ std::nullopt,
367+
/* in_experiment= */ false,
368+
EvaluationReason::BigSegmentsStatus::kNone),
361369

362370
false,
363371
std::nullopt,

0 commit comments

Comments
 (0)