Skip to content

refactor: replace bigSegmentStatus string with EvaluationReason::BigSegmentsStatus enum#549

Open
beekld wants to merge 5 commits into
mainfrom
beeklimt/SDK-2366
Open

refactor: replace bigSegmentStatus string with EvaluationReason::BigSegmentsStatus enum#549
beekld wants to merge 5 commits into
mainfrom
beeklimt/SDK-2366

Conversation

@beekld

@beekld beekld commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Replace bigSegmentStatus string with typed enum

Renames the (currently unused-but-public) EvaluationReason Big Segments field from singular bigSegmentStatus to spec-compliant plural bigSegmentsStatus, and introduces a typed enum to replace its std::optional<std::string> representation. No evaluator behavior change in this PR — the field still has no in-tree writer; that lands in SDK-2366-2.

What's in

  • New nested enum EvaluationReason::BigSegmentsStatus (kHealthy/kStale/kNotConfigured/kStoreError), mirroring Kind and ErrorKind.
  • friend std::ostream& operator<< for the enum.
  • tag_invoke pair in the JSON serializer (mirrors Kind and ErrorKind).

Breaking changes

  • EvaluationReason::BigSegmentStatus() renamed to BigSegmentsStatus() and now returns std::optional<EvaluationReason::BigSegmentsStatus> instead of std::optional<std::string>.
  • The 7-arg EvaluationReason constructor's last parameter changes type to match.
  • JSON field "bigSegmentStatus" renamed to "bigSegmentsStatus".

The field has never had an in-tree writer and only ever returned an empty optional / been absent from JSON, so no caller could have depended on a value.


Note

Medium Risk
Public API and JSON field renames are breaking for C++/serialization consumers, though the field was previously unused at runtime; enum stability matters for the C API.

Overview
Big Segments status on EvaluationReason is now a typed enum instead of an optional string, with the wire/API name aligned to spec as bigSegmentsStatus.

The PR adds EvaluationReason::BigSegmentsStatus (kNone, kHealthy, kStale, kNotConfigured, kStoreError) with C-API-stable numeric values, a primary BigSegmentsStatus() accessor, and ostream / JSON tag_invoke support (field bigSegmentsStatus on serialize/deserialize). Factories and equality/<< now use the enum; absent status is kNone and is omitted from JSON.

Breaking but transitional: the old BigSegmentStatus() string getter and string-typed constructor remain as deprecated shims. Call sites and tests are updated to pass BigSegmentsStatus::kNone where appropriate. No evaluator logic changes in this PR—the status still has no in-tree writer.

Reviewed by Cursor Bugbot for commit ae98702. Bugbot is set up for automated code reviews on this repo. Configure here.

@beekld beekld requested a review from a team as a code owner June 10, 2026 04:55

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c43f046. Configure here.

Comment thread libs/internal/src/serialization/json_evaluation_reason.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants