fix(beam): guard jinja_variable_flags collision with pipeline options - #39888
Open
shoemoney wants to merge 1 commit into
Open
fix(beam): guard jinja_variable_flags collision with pipeline options#39888shoemoney wants to merge 1 commit into
shoemoney wants to merge 1 commit into
Conversation
Contributor
|
Assigning reviewers: R: @jrmccluskey for label python. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
Fix verified RED->GREEN. Yaml jinja variable exact-name collision steals pipeline option at main.py:64
shoemoney
force-pushed
the
fix/beam-jinja-collision
branch
from
August 25, 2026 22:13
0d6c016 to
85b432e
Compare
Collaborator
|
The fix seems good, but can you add a test case to cover this fix. Thanks |
Collaborator
|
R: @Abacn since you opened the initial issue. Thanks |
Contributor
|
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
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.
Fixes Yaml jinja variable exact-name collision stealing pipeline option at sdks/python/apache_beam/yaml/main.py:64.
#37475
Bug: _preparse_jinja_flags adds every jinja_variable_flags entry as an argparse flag without checking against known pipeline options. A jinja variable named runner, project, temp_location, etc. captures the pipeline flag and converts it into jinja_variables, removing it from pipeline_args.
Fix: Guard the loop by checking flag_name against PipelineOptions.get_all_options(). If the name collides (dash normalized to underscore), skip adding it to the jinja parser and require the variable via --jinja_variables JSON instead.
Evidence: RED->GREEN verified with mocked PipelineOptions. Before fix, --jinja_variable_flags=runner --runner=DirectRunner produces --jinja_variables={"runner": "DirectRunner"} and loses the pipeline flag. After fix, runner stays in pipeline_args and only non-colliding vars are promoted. Dash variant temp-location also guarded. Existing behavior for non-colliding vars unchanged.