@@ -47,14 +47,14 @@ BEGIN
4747 -- ==========================================
4848 -- Find first step (by topological order) with unmet condition and 'fail' mode.
4949 -- Condition is unmet when:
50- -- (condition_pattern is set AND input does NOT contain it) OR
51- -- (condition_not_pattern is set AND input DOES contain it)
50+ -- (required_input_pattern is set AND input does NOT contain it) OR
51+ -- (forbidden_input_pattern is set AND input DOES contain it)
5252 WITH steps_with_conditions AS (
5353 SELECT
5454 step_state .flow_slug ,
5555 step_state .step_slug ,
56- step .condition_pattern ,
57- step .condition_not_pattern ,
56+ step .required_input_pattern ,
57+ step .forbidden_input_pattern ,
5858 step .when_unmet ,
5959 step .deps_count ,
6060 step .step_index
6565 WHERE step_state .run_id = cascade_resolve_conditions .run_id
6666 AND step_state .status = ' created'
6767 AND step_state .remaining_deps = 0
68- AND (step .condition_pattern IS NOT NULL OR step .condition_not_pattern IS NOT NULL )
68+ AND (step .required_input_pattern IS NOT NULL OR step .forbidden_input_pattern IS NOT NULL )
6969 ),
7070 step_deps_output AS (
7171 SELECT
@@ -84,16 +84,16 @@ BEGIN
8484 SELECT
8585 swc.* ,
8686 -- condition_met = (if IS NULL OR input @> if) AND (ifNot IS NULL OR NOT(input @> ifNot))
87- (swc .condition_pattern IS NULL OR
88- CASE WHEN swc .deps_count = 0 THEN v_run_input ELSE COALESCE(sdo .deps_output , ' {}' ::jsonb) END @> swc .condition_pattern )
87+ (swc .required_input_pattern IS NULL OR
88+ CASE WHEN swc .deps_count = 0 THEN v_run_input ELSE COALESCE(sdo .deps_output , ' {}' ::jsonb) END @> swc .required_input_pattern )
8989 AND
90- (swc .condition_not_pattern IS NULL OR
91- NOT (CASE WHEN swc .deps_count = 0 THEN v_run_input ELSE COALESCE(sdo .deps_output , ' {}' ::jsonb) END @> swc .condition_not_pattern ))
90+ (swc .forbidden_input_pattern IS NULL OR
91+ NOT (CASE WHEN swc .deps_count = 0 THEN v_run_input ELSE COALESCE(sdo .deps_output , ' {}' ::jsonb) END @> swc .forbidden_input_pattern ))
9292 AS condition_met
9393 FROM steps_with_conditions swc
9494 LEFT JOIN step_deps_output sdo ON sdo .step_slug = swc .step_slug
9595 )
96- SELECT flow_slug, step_slug, condition_pattern, condition_not_pattern
96+ SELECT flow_slug, step_slug, required_input_pattern, forbidden_input_pattern
9797 INTO v_first_fail
9898 FROM condition_evaluations
9999 WHERE NOT condition_met AND when_unmet = ' fail'
@@ -128,8 +128,8 @@ BEGIN
128128 SELECT
129129 step_state .flow_slug ,
130130 step_state .step_slug ,
131- step .condition_pattern ,
132- step .condition_not_pattern ,
131+ step .required_input_pattern ,
132+ step .forbidden_input_pattern ,
133133 step .when_unmet ,
134134 step .deps_count ,
135135 step .step_index
@@ -140,7 +140,7 @@ BEGIN
140140 WHERE step_state .run_id = cascade_resolve_conditions .run_id
141141 AND step_state .status = ' created'
142142 AND step_state .remaining_deps = 0
143- AND (step .condition_pattern IS NOT NULL OR step .condition_not_pattern IS NOT NULL )
143+ AND (step .required_input_pattern IS NOT NULL OR step .forbidden_input_pattern IS NOT NULL )
144144 ),
145145 step_deps_output AS (
146146 SELECT
@@ -159,11 +159,11 @@ BEGIN
159159 SELECT
160160 swc.* ,
161161 -- condition_met = (if IS NULL OR input @> if) AND (ifNot IS NULL OR NOT(input @> ifNot))
162- (swc .condition_pattern IS NULL OR
163- CASE WHEN swc .deps_count = 0 THEN v_run_input ELSE COALESCE(sdo .deps_output , ' {}' ::jsonb) END @> swc .condition_pattern )
162+ (swc .required_input_pattern IS NULL OR
163+ CASE WHEN swc .deps_count = 0 THEN v_run_input ELSE COALESCE(sdo .deps_output , ' {}' ::jsonb) END @> swc .required_input_pattern )
164164 AND
165- (swc .condition_not_pattern IS NULL OR
166- NOT (CASE WHEN swc .deps_count = 0 THEN v_run_input ELSE COALESCE(sdo .deps_output , ' {}' ::jsonb) END @> swc .condition_not_pattern ))
165+ (swc .forbidden_input_pattern IS NULL OR
166+ NOT (CASE WHEN swc .deps_count = 0 THEN v_run_input ELSE COALESCE(sdo .deps_output , ' {}' ::jsonb) END @> swc .forbidden_input_pattern ))
167167 AS condition_met
168168 FROM steps_with_conditions swc
169169 LEFT JOIN step_deps_output sdo ON sdo .step_slug = swc .step_slug
@@ -244,15 +244,15 @@ BEGIN
244244 WHERE ready_step .run_id = cascade_resolve_conditions .run_id
245245 AND ready_step .status = ' created'
246246 AND ready_step .remaining_deps = 0
247- AND (step .condition_pattern IS NOT NULL OR step .condition_not_pattern IS NOT NULL )
247+ AND (step .required_input_pattern IS NOT NULL OR step .forbidden_input_pattern IS NOT NULL )
248248 AND step .when_unmet = ' skip-cascade'
249249 -- Condition is NOT met when: (if fails) OR (ifNot fails)
250250 AND NOT (
251- (step .condition_pattern IS NULL OR
252- CASE WHEN step .deps_count = 0 THEN v_run_input ELSE COALESCE(agg_deps .deps_output , ' {}' ::jsonb) END @> step .condition_pattern )
251+ (step .required_input_pattern IS NULL OR
252+ CASE WHEN step .deps_count = 0 THEN v_run_input ELSE COALESCE(agg_deps .deps_output , ' {}' ::jsonb) END @> step .required_input_pattern )
253253 AND
254- (step .condition_not_pattern IS NULL OR
255- NOT (CASE WHEN step .deps_count = 0 THEN v_run_input ELSE COALESCE(agg_deps .deps_output , ' {}' ::jsonb) END @> step .condition_not_pattern ))
254+ (step .forbidden_input_pattern IS NULL OR
255+ NOT (CASE WHEN step .deps_count = 0 THEN v_run_input ELSE COALESCE(agg_deps .deps_output , ' {}' ::jsonb) END @> step .forbidden_input_pattern ))
256256 )
257257 ORDER BY step .step_index ;
258258
0 commit comments