Skip to content

Number task loop iterations from one instead of zero - #74773

Merged
bbovenzi merged 1 commit into
apache:mainfrom
astronomer:dev/loop-task-iteration-start-one-370470
Oct 20, 2026
Merged

bbovenzi merged 1 commit into
apache:mainfrom
astronomer:dev/loop-task-iteration-start-one-370470

Conversation

@bbovenzi

@bbovenzi bbovenzi commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Task Loop Iterations were starting at 0 which was confusing in the UI. Instead of remembering a UI-only "+1" change that we could easily forget to add. This PR changes it so that all region_indexes that are for loop iterations start at 1.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)
    Claude Opus 5

Generated-by: Claude Opus 5 following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {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.

@boring-cyborg boring-cyborg Bot added area:API Airflow's REST/HTTP API area:task-sdk area:UI Related to UI/UX. For Frontend Developers. kind:documentation labels Oct 14, 2026
@bbovenzi bbovenzi added the backport-to-v3-4-test Backport to v3-4-test label Oct 15, 2026
@bbovenzi bbovenzi added this to the Airflow 3.4.0 milestone Oct 15, 2026
@bbovenzi
bbovenzi force-pushed the dev/loop-task-iteration-start-one-370470 branch 2 times, most recently from c56e618 to 59eae68 Compare October 16, 2026 14:45

@ashb ashb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM overall, small nits though

@bbovenzi
bbovenzi force-pushed the dev/loop-task-iteration-start-one-370470 branch from 888cf42 to c79cd1f Compare October 19, 2026 21:55
@bbovenzi
bbovenzi force-pushed the dev/loop-task-iteration-start-one-370470 branch from c79cd1f to 3258cc3 Compare October 20, 2026 03:50
A loop iteration is a number people read: it shows up in the loop filter,
on the Gantt tooltip, in the task instance list and in the `loop.index` a
Dag author branches on. Starting it at zero meant each of those readers had
to translate between the number Airflow stored and the number a person
would say, and that translation was easy to apply in one place and forget
in another.

Numbering from one in storage removes the translation instead of hiding it
behind a display-time adjustment, so the stored index, the API field and
the UI agree without anyone adding to it. Mapped expansion indexes share
the column and stay zero-based: a map index is a position, not a count, so
code reading the column has to know whether the region executes a loop or
an expansion.

Task loops have not shipped in a release, so no stored run and no client
depends on the old numbering, and the execution API version that
introduces the loop context is still unreleased.

Co-Authored-By: Claude <noreply@anthropic.com>
@bbovenzi
bbovenzi force-pushed the dev/loop-task-iteration-start-one-370470 branch from 3258cc3 to e9da72d Compare October 20, 2026 14:00
@bbovenzi
bbovenzi merged commit a8c55b7 into apache:main Oct 20, 2026
146 of 147 checks passed
@bbovenzi
bbovenzi deleted the dev/loop-task-iteration-start-one-370470 branch October 20, 2026 23:00
@github-actions

Copy link
Copy Markdown
Contributor

Backport failed to create: v3-4-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
❌ v3-4-test Commit Link

You can attempt to backport this manually by running:

cherry_picker a8c55b7 v3-4-test

This should apply the commit to the v3-4-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

ashb pushed a commit that referenced this pull request Oct 21, 2026
) (#75260)

A loop iteration is a number people read: it shows up in the loop filter,
on the Gantt tooltip, in the task instance list and in the `loop.index` a
Dag author branches on. Starting it at zero meant each of those readers had
to translate between the number Airflow stored and the number a person
would say, and that translation was easy to apply in one place and forget
in another.

Numbering from one in storage removes the translation instead of hiding it
behind a display-time adjustment, so the stored index, the API field and
the UI agree without anyone adding to it. Mapped expansion indexes share
the column and stay zero-based: a map index is a position, not a count, so
code reading the column has to know whether the region executes a loop or
an expansion.

Task loops have not shipped in a release, so no stored run and no client
depends on the old numbering, and the execution API version that
introduces the loop context is still unreleased.

(cherry picked form commit a8c55b7)

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:task-sdk area:UI Related to UI/UX. For Frontend Developers. backport-to-v3-4-test Backport to v3-4-test kind:documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants