feat: add internal BigSegmentStoreWrapper with caching and status polling#543
Conversation
We'll want to determine if we should update the spec here or the implementations. It does sound reasonably though. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ 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 c13f1d8. Configure here.
…ring in-flight query
I've added it to the list of follow-ups where java and the spec aren't in alignment. |

Summary
Internal layer between the evaluator and a customer-provided
IBigSegmentStore: hashes context keys, caches membership lookups, polls thestore's metadata in the background to track availability/staleness, and
broadcasts status changes. No caller yet — the evaluator and the public status
provider come later in the stack.
Design notes
base64(sha256(key))using the standard base64alphabet (not the existing URL-safe
Base64UrlEncode), so the lookup keymatches what the Relay Proxy writes.
than each hitting the store.
async::Delay+CancellationSource.unavailable. The spec requires this; the Java and Go SDKs don't do it, so this
is a deliberate divergence.
StoreMetadata::last_up_to_datefrom a baremillisecondsto asystem_clock::time_point, so staleness math can't mix epochs. This touchesthe Redis and DynamoDB stores (one line each) and their metadata tests.
Test plan
Note
Medium Risk
Changes the public
IBigSegmentStorecontract (noexcept,StoreMetadatatype) and adds threaded/async polling plus store-error handling that affects how staleness and availability are reported; evaluator is not wired yet, limiting immediate eval impact.Overview
Adds
BigSegmentStoreWrapper, the internal layer in front ofIBigSegmentStore: hashes context keys asbase64(sha256(key))via newBase64Encode(RFC 4648, not URL-safe), uses an LRU/TTLMembershipCache, coalesces concurrent lookups for the same key, polls metadata on a timer for availability/staleness, and broadcasts status changes. Membership lookups returnBigSegmentsStatus(healthy/stale/store error); a failed lookup marks the store unavailable (per spec).StoreMetadata::last_up_to_dateis now asystem_clock::time_pointinstead of raw milliseconds; Redis and DynamoDB stores and their tests are updated accordingly.IBigSegmentStore::GetMembership/GetMetadataarenoexcept, with DynamoDB wrapping AWS calls in try/catch.Supporting pieces:
big_segments_status.hpp,#include <variant>inpromise.hpp, and unit tests for the wrapper, cache, and standard base64.Reviewed by Cursor Bugbot for commit 0b492dd. Bugbot is set up for automated code reviews on this repo. Configure here.