Test_FFE_EVP_Flagevaluation_ObserveFullData_Absent_Hashed and
Test_FFE_EVP_Flagevaluation_ObserveFullData_False_Hashed flake on a
clock-driven schedule, independent of the library under test.
assert_no_raw_pii_in_event substring-scans the whole serialized event for
each forbidden value. PII_ATTRIBUTES["org_id"] is the int 1234, which
str()s to the 4-char "1234" and is matched against three 13-digit
millisecond fields (timestamp, first_evaluation, last_evaluation). "1234"
has 10 candidate offsets per field, so a clean event fails roughly 0.3% of
the time. Observed in dd-trace-go CI: the event carried no PII at all
(targeting_key correctly hashed, context correctly omitted) and still
failed, because timestamp was 1788901234711.
Exclude the SDK-generated numeric fields from the scan. They are clock and
counter values that cannot carry evaluation context, so dropping them
costs no coverage. PII_ATTRIBUTES is left untouched: the comment above it
marks it as a cross-SDK vector that other SDKs assert against, so the
fixture values must stay stable.
Verified the exact failing event from CI now passes, every raw-PII leak
shape (email, targeting key, org_id, plan, region, tier, and nested
values) is still detected, and 200,000 synthetic timestamps produce no
collisions.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Test_FFE_EVP_Flagevaluation_ObserveFullData_Absent_HashedandTest_FFE_EVP_Flagevaluation_ObserveFullData_False_Hashedflaked on aclock-driven schedule, independent of the library under test.
assert_no_raw_pii_in_eventpreviously converted the complete event to aserialized string and searched it for each forbidden value.
PII_ATTRIBUTES["org_id"]is the integer1234. Its string representationcan occur by chance inside 13-digit millisecond timestamps. This caused a
clean event with timestamp
1788901234711to fail even though the targetingkey was hashed and the evaluation context was omitted.
Replace the serialized substring scan with a type-aware recursive scan.
String values and dictionary keys still use substring matching. Numeric
values use equality matching against numeric PII. This prevents
1234frommatching part of a larger timestamp while preserving detection if an SDK
leaks
1234into any numeric field or converts it to a string.Keep
PII_ATTRIBUTESunchanged so the cross-SDK fixture remains stable. Adddeterministic tests for the original timestamp collision, every generated
numeric event field, string conversion, dictionary keys, nested dictionaries,
and lists.
Verified with 11 focused
TEST_THE_TESTcases, Ruff, formatting checks, andMypy.