fix: parse identifiers with leading underscores - #371
Merged
Conversation
Journey expressions could not traverse webhook vendor keys that start with an underscore: @event.message._vnd.v1.chat rendered the inspected message map followed by ._vnd.v1.chat as literal text, because the atom combinator required identifiers to start with a letter or digit. The _vnd namespace is added by the platform's own webhook enrichment, so flow authors cannot rename it, and the only workaround was bracket syntax (event.message["_vnd"]["v1"]["chat"]). An atom still needs at least one letter or digit, so a bare _ keeps failing to parse and @(_) remains literal text. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
smn
approved these changes
Sep 2, 2026
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.
Problem
Some payloads may have keys that start with an underscore, such as
_vnd. Expressions traversing them stop parsing at the underscore:The
atomcombinator inExpression.Parserrequires the first character of an identifier to be a letter or digit, so._vndfails the attribute parse, and the expression is truncated afterevent.message.Fix
Allow leading underscores in the atom grammar while still requiring at least one letter or digit, so a bare
_keeps failing to parse.Behavior changes
@event.message._vnd.v1.chatevent.message, tail rendered as literal text@_missing(not in context)_missing— the@was silently swallowed by an empty expression match@_missing, the documented round-trip for unresolved variables@(_)The
@(_)row matters: keeping themin: 1letter-or-digit requirement is what stops a bare underscore becoming an identifier, so the existing guard test stays green and Elixir's "underscore means unused" convention doesn't bleed into map keys.This supersedes #369, which was closed unmerged while still a draft.