@@ -542,9 +542,10 @@ def _ctx_identity_without(field: str) -> TranslateContext:
542542 )
543543
544544
545- def test_translate_segment__percentage_split_implicit_key_no_identity__compiles_to_false () -> None :
546- # Given a PERCENTAGE_SPLIT with no property (implicit `$.identity.key`) and an eval
547- # context with no identity
545+ def test_translate_segment__percentage_split_implicit_key_no_identity__inlines_md5 () -> None :
546+ # Given a PERCENTAGE_SPLIT with no property (implicit `$.identity.key`) and an
547+ # eval context with no identity — the row-oriented case (e.g. segment-membership
548+ # counting over the whole IDENTITIES table)
548549 seg : SegmentContext = {
549550 "key" : "ps2" ,
550551 "name" : "s" ,
@@ -556,12 +557,12 @@ def test_translate_segment__percentage_split_implicit_key_no_identity__compiles_
556557 ],
557558 }
558559
559- # When / Then the predicate collapses to FALSE — engine returns False without identity
560- assert translate_segment (seg , _ctx_no_identity ()) = = "((FALSE))"
560+ # When / Then it hashes the per-row identity key rather than folding to FALSE
561+ assert translate_segment (seg , _ctx_no_identity ()) ! = "((FALSE))"
561562
562563
563- def test_translate_segment__percentage_split_identity_key_missing__compiles_to_false () -> None :
564- # Given the eval context's identity has no `key`
564+ def test_translate_segment__percentage_split_key_no_context_identity__inlines_md5 () -> None :
565+ # Given a PERCENTAGE_SPLIT on `$. identity.key` and a context identity without `key`
565566 seg : SegmentContext = {
566567 "key" : "ps3" ,
567568 "name" : "s" ,
@@ -575,14 +576,13 @@ def test_translate_segment__percentage_split_identity_key_missing__compiles_to_f
575576 ],
576577 }
577578
578- # When / Then the predicate collapses to FALSE
579- assert translate_segment (seg , _ctx_identity_without ("key" )) = = "((FALSE))"
579+ # When / Then it still hashes the per-row identity key rather than folding to FALSE
580+ assert translate_segment (seg , _ctx_identity_without ("key" )) ! = "((FALSE))"
580581
581582
582- def test_translate_segment__percentage_split_identity_identifier_missing__compiles_to_false () -> (
583- None
584- ):
585- # Given the eval context's identity has no `identifier`
583+ def test_translate_segment__percentage_split_identifier_no_context_identity__inlines_md5 () -> None :
584+ # Given a PERCENTAGE_SPLIT on `$.identity.identifier` and a context identity
585+ # without `identifier`
586586 seg : SegmentContext = {
587587 "key" : "ps4" ,
588588 "name" : "s" ,
@@ -600,8 +600,8 @@ def test_translate_segment__percentage_split_identity_identifier_missing__compil
600600 ],
601601 }
602602
603- # When / Then the predicate collapses to FALSE
604- assert translate_segment (seg , _ctx_identity_without ("identifier" )) = = "((FALSE))"
603+ # When / Then it still hashes the per-row identifier rather than folding to FALSE
604+ assert translate_segment (seg , _ctx_identity_without ("identifier" )) ! = "((FALSE))"
605605
606606
607607def test_translate_segment__percentage_split_unknown_jsonpath__returns_none () -> None :
0 commit comments