Repository navigation
Fail Core.Case on expression evaluation errors under expression v3 - #354
Open
raquelgraca wants to merge 1 commit into
Open
raquelgraca wants to merge 1 commit into
raquelgraca wants to merge 1 commit into
Conversation
A `variable = expression` assignment compiles to a Core.Case block whose exit name is the expression. When that expression parsed but failed while evaluating (e.g. comparing a never-written contact field against a date), the block stored the exit name, so the journey carried on holding the expression's own source text as the value. Under expression v3 semantics the evaluation error is now raised, so the journey fails visibly. Parse errors still fall back to the exit name, because routing exits are named with plain labels that don't parse, and v2 journeys keep today's behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A
variable = expressionassignment in a journey compiles to aCore.Caseblock whose exit name is the expression. When the expression parses but fails while evaluating,Case.evaluate_outgoing/5stores the exit name, so the journey silently continues with the expression's source text as the value.A customer hit this reading a contact field that was never written for the contact:
contact.program_quit_at > now()attribute is not found: program_quit_at"contact.program_quit_at > now()"datetime_add(contact.program_quit_at, 2, "W") <= now()expression is not a number: nilif(is_nil_or_empty(contact.program_quit_at), false, contact.program_quit_at > now())attribute is not found: program_quit_atA field written as null evaluates to
falseas expected; only never-written fields hit this.What changes
flowchart TD A[evaluate exit name] --> B{result} B -- ":parse error" --> C[store exit name<br/>routing labels, unchanged] B -- "other error" --> D{expression_mode} D -- ":v3" --> E[raise Expression.Error] D -- ":v2 / nil" --> C B -- nil --> C B -- value --> F[store value]whenrouting exits are plain labels ("Exit for CheckYes") that don't parse, and rely on this.Expression.Erroras non-retryable.Follow-up
mix.exs+ README, currently 6.15.3) and release are still needed.Testing
Four new
BlockTestcases (v2 stores the source text, v3 raises, a null field still evaluates on v3, a routing label is still stored on v3).mix test: 212 tests, 0 failures.🤖 Generated with Claude Code