-
Notifications
You must be signed in to change notification settings - Fork 15
feat: add whenUnmet and whenFailed condition modes to flow shapes #585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 01-08-implement_ifnot_negative_condition_pattern
Are you sure you want to change the base?
Conversation
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
View your CI Pipeline Execution ↗ for commit be73fb9
☁️ Nx Cloud last updated this comment at |
6824bcf to
919577f
Compare
| when_unmet => v_step->>'whenUnmet', | ||
| when_failed => v_step->>'whenFailed' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical NULL handling bug: When whenUnmet or whenFailed fields are missing from the JSON shape, v_step->>'whenUnmet' returns NULL. Explicitly passing NULL to add_step() will attempt to insert NULL into a NOT NULL column, causing a constraint violation.
-- Fix by using COALESCE to apply defaults:
when_unmet => COALESCE(v_step->>'whenUnmet', 'skip'),
when_failed => COALESCE(v_step->>'whenFailed', 'fail')This will fail when processing old shapes or malformed data that don't include these new fields. SQL function defaults only apply when parameters are omitted, not when NULL is explicitly passed.
| when_unmet => v_step->>'whenUnmet', | |
| when_failed => v_step->>'whenFailed' | |
| when_unmet => COALESCE(v_step->>'whenUnmet', 'skip'), | |
| when_failed => COALESCE(v_step->>'whenFailed', 'fail') |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
| when_unmet => v_step->>'whenUnmet', | ||
| when_failed => v_step->>'whenFailed' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical NULL handling bug: Same issue as in 0100_function_create_flow_from_shape.sql. When JSON fields are missing, v_step->>'whenUnmet' returns NULL. Explicitly passing NULL bypasses the parameter defaults and will violate the NOT NULL constraint on the when_unmet and when_failed columns.
-- Fix by using COALESCE:
when_unmet => COALESCE(v_step->>'whenUnmet', 'skip'),
when_failed => COALESCE(v_step->>'whenFailed', 'fail')This creates a production risk during deployment or when processing legacy shapes.
| when_unmet => v_step->>'whenUnmet', | |
| when_failed => v_step->>'whenFailed' | |
| when_unmet => COALESCE(v_step->>'whenUnmet', 'skip'), | |
| when_failed => COALESCE(v_step->>'whenFailed', 'fail') |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
919577f to
be73fb9
Compare
4354fcb to
3f4ff52
Compare

Add Support for Step Condition Modes in Flow Shape Comparison
This PR enhances the flow shape comparison functionality to include
whenUnmetandwhenFailedcondition modes. These condition modes are structural properties that affect DAG execution semantics and must match between worker and database definitions.Key changes:
_compare_flow_shapesfunction to detect differences inwhenUnmetandwhenFailedvalues_create_flow_from_shapeto properly handle condition modes when creating flows_get_flow_shapeto include condition modes in the returned shapeThese changes ensure that when a flow is deployed, the condition modes are properly compared and any differences are detected, preventing potential execution inconsistencies between the worker and database definitions.