Skip to content

Remove incorrect start_date template variable from documentation, TypedDict, and template context validation#62505

Open
Ajay9704 wants to merge 5 commits intoapache:mainfrom
Ajay9704:template_variable_start_date_doesnt_exist
Open

Remove incorrect start_date template variable from documentation, TypedDict, and template context validation#62505
Ajay9704 wants to merge 5 commits intoapache:mainfrom
Ajay9704:template_variable_start_date_doesnt_exist

Conversation

@Ajay9704
Copy link
Contributor

Description

This pull request removes the start_date template variable from all locations where it was still referenced even though it was intentionally removed from the runtime template context in commit 518287c (“Runtime context shouldn't have start_date as a key (#46961)”).

Background

Although the runtime context produced by get_template_context() no longer includes the start_date field, the following components continued to reference it:

airflow-core/docs/templates-ref.rst

task-sdk/src/airflow/sdk/definitions/context.py (Context TypedDict)

scripts/ci/prek/check_template_context_variable_in_sync.py

Because of this mismatch, users following the documentation and using {{ start_date }} encounter a KeyError at runtime. This issue was reported in Issue #62457, and after discussion in the thread, consensus was reached on resolving the problem by removing the variable across all remaining references.

Summary of Changes

This pull request implements Option A from the issue discussion by ensuring all components reflect the correct behavior:

Removed {{ start_date }} from the template reference documentation.

Removed the start_date entry from the Context TypedDict.

Removed start_date from the template context validation logic.

These changes ensure that documentation, type definitions, and validation checks now match the actual runtime context.

Verification

Documentation was rebuilt locally to ensure the following:

Prior to the fix, the template reference displayed start_date.

After applying this change set, the rebuilt documentation correctly excludes the variable.

This confirms the consistency of documentation with the current runtime behavior.

Related Issue

Closes: #62457

Was generative AI tooling used to co-author this PR?

NO(please specify the tool below)

@Ajay9704 Ajay9704 marked this pull request as draft February 26, 2026 08:00
@Ajay9704 Ajay9704 marked this pull request as ready for review February 26, 2026 09:10
@Ajay9704
Copy link
Contributor Author

after fix
before fix

@Ajay9704
Copy link
Contributor Author

Ajay9704 commented Mar 1, 2026

@kaxil, @jscheffl, @jason810496, @potiuk — whenever you get some time, please review my PR and let me know if anything is pending from my end.

Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK for me but request another pair of eyes before merge.

@jscheffl jscheffl added this to the Airflow 3.1.8 milestone Mar 1, 2026

# Airflow 3 added:
retn_keys.update(("start_date", "task_reschedule_count"))
retn_keys.add("task_reschedule_count")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what't the difference between add and update?

Copy link
Contributor

@obarisk obarisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools area:task-sdk backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch kind:documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

template variable start_date doesn't exist

4 participants