Skip to content

[v3-4-test] Number task loop iterations from one instead of zero (#74773) - #75260

Merged
ashb merged 1 commit into
apache:v3-4-testfrom
astronomer:backport-loop-iter-one-v3-4-test
Oct 21, 2026
Merged

ashb merged 1 commit into
apache:v3-4-testfrom
astronomer:backport-loop-iter-one-v3-4-test

Conversation

@bbovenzi

Copy link
Copy Markdown
Contributor

Backport of #74773 to v3-4-test, so 3.4.0 ships loop iterations numbered from one.

Task loops are new in 3.4 and have not shipped in a release, so no stored run and no client depends on the old zero-based numbering. Leaving v3-4-test on zero would release the confusing numbering that #74773 removes, and force a breaking change later.

Merge after #74773 lands on main. The cherry-pick trailer is intentionally omitted: the squash-merge commit does not exist yet, and a trailer naming the branch commit would be a dead reference in the permanent history. It can be added when #74773 merges.

Differences from the commit on main

One hunk was dropped. airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_xcoms.py on main contains test_parsing_attempt_id_does_not_select_a_loop_iteration, which comes from an unrelated PR that is not on v3-4-test. The two steps[0] → steps[1] edits inside it are therefore absent here. Nothing else differs: the changed-file set is identical, and a diff of the two commits' diffs shows only those two lines.

Verification

  • All six generators re-run on this branch with zero drift — generate-openapi-spec, generate-supervisor-schemas-snapshot, generate-tasksdk-datamodels, generate-airflowctl-datamodels, sync-ts-sdk-schemas, sync-go-sdk-schemas — confirming the vendored artifacts match what v3-4-test produces rather than what main produces.
  • validate_loop_decision applies cleanly to the stop: bool | None signature already on v3-4-test.

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

…che#74773)

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>
@ashb
ashb merged commit 352cbf6 into apache:v3-4-test Oct 21, 2026
126 checks passed
@ashb
ashb deleted the backport-loop-iter-one-v3-4-test branch October 21, 2026 12:40
@github-actions github-actions Bot added this to the Airflow 3.4.1 milestone Oct 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.4.1 based on: merged to version branch
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants