@@ -2789,13 +2789,27 @@ defmodule Electric.Plug.RouterTest do
27892789 task = live_shape_req ( req , ctx . opts )
27902790 Postgrex . query! ( ctx . db_conn , "UPDATE parent SET other_value = 10 WHERE id = 2" )
27912791
2792- tag =
2792+ # With DNF, WHERE clause `subquery AND field_condition` creates one disjunct with two positions:
2793+ # - Position 0: value IN (SELECT ...) - references `value` column
2794+ # - Position 1: other_value >= $1 - references `other_value` column
2795+ # Tags include both positions concatenated with `/`.
2796+ # Row id=3 has value=20, other_value=20
2797+ tag_value =
2798+ :crypto . hash ( :md5 , ctx . stack_id <> req . handle <> "v:20" )
2799+ |> Base . encode16 ( case: :lower )
2800+
2801+ tag_other_value =
27932802 :crypto . hash ( :md5 , ctx . stack_id <> req . handle <> "v:20" )
27942803 |> Base . encode16 ( case: :lower )
27952804
2805+ tag = tag_value <> "/" <> tag_other_value
2806+
27962807 assert { _ , 200 ,
27972808 [
2798- % { "headers" => % { "tags" => [ ^ tag ] } , "value" => % { "id" => "3" } } ,
2809+ % {
2810+ "headers" => % { "tags" => [ ^ tag ] , "active_conditions" => [ true , true ] } ,
2811+ "value" => % { "id" => "3" }
2812+ } ,
27992813 % { "headers" => % { "control" => "snapshot-end" } } ,
28002814 up_to_date_ctl ( )
28012815 ] } =
@@ -2820,11 +2834,24 @@ defmodule Electric.Plug.RouterTest do
28202834 # Should contain the data record and the snapshot-end control message
28212835 assert length ( response ) == 2
28222836
2823- tag = :crypto . hash ( :md5 , ctx . stack_id <> req . handle <> "v:1" ) |> Base . encode16 ( case: :lower )
2837+ # With DNF, WHERE clause `subquery AND field_condition` creates one disjunct with two positions:
2838+ # - Position 0: "parentId" IN (SELECT ...) - references `parentId` column
2839+ # - Position 1: "Value" >= $1 - references `Value` column
2840+ # Tags include both positions concatenated with `/`.
2841+ # Row id=1 has parentId=1, Value=10
2842+ tag_parent_id =
2843+ :crypto . hash ( :md5 , ctx . stack_id <> req . handle <> "v:1" )
2844+ |> Base . encode16 ( case: :lower )
2845+
2846+ tag_value =
2847+ :crypto . hash ( :md5 , ctx . stack_id <> req . handle <> "v:10" )
2848+ |> Base . encode16 ( case: :lower )
2849+
2850+ tag = tag_parent_id <> "/" <> tag_value
28242851
28252852 assert % {
28262853 "value" => % { "id" => "1" , "parentId" => "1" , "Value" => "10" } ,
2827- "headers" => % { "tags" => [ ^ tag ] }
2854+ "headers" => % { "tags" => [ ^ tag ] , "active_conditions" => [ true , true ] }
28282855 } =
28292856 Enum . find ( response , & Map . has_key? ( & 1 , "key" ) )
28302857
0 commit comments