Fix mapped tasks does not validate task_id#70135
Open
Andrushika wants to merge 1 commit into
Open
Conversation
A regular task validates its task_id in BaseOperator.__init__, but a mapped task is built through a different path that skips __init__, so its task_id was never checked. An invalid id such as "bad*id" passed silently in .partial().expand() and in the taskflow @task mapped form, only to fail later where the id is used. Validate the id in both mapped paths so it is rejected at parse time like a regular task.
Andrushika
force-pushed
the
validate-mapped-task-id
branch
from
July 20, 2026 14:46
d5ee49a to
581708c
Compare
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.
Validate task_id for mapped tasks
Why
A regular task validates its
task_idinBaseOperator.__init__. A mapped task is built on a path that skips__init__, so its id was never validated. A regular task and a mapped task then accept different sets of ids, breaking the invariant that everytask_idis validated:The taskflow
@taskmapped form had the same gap.What
Validate the id in both mapped paths, at the point where the final id is known (after the task-group prefix and unique-suffix), matching
BaseOperator.__init__. Valid ids are unaffected. Tests lock that the final id is validated, not the raw one.related: #69965, #69937
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code Opus 4.8 following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.