Skip to content

Fix indexing mapped task results with a NumPy integer - #73400

Closed
Eason09053360 wants to merge 1 commit into
apache:mainfrom
Eason09053360:fix-lazy-xcom-sequence-index-coercion
Closed

Eason09053360 wants to merge 1 commit into
apache:mainfrom
Eason09053360:fix-lazy-xcom-sequence-index-coercion

Conversation

@Eason09053360

Copy link
Copy Markdown
Contributor

Why

LazyXComSequence.__getitem__ coerces index-like keys through __index__, but the raise TypeError sits outside the if, so it fires unconditionally and the coerced value is thrown away. Indexing a mapped task's results with a numpy.int64 (what argmax returns) therefore always fails, while the slice path has accepted the same keys since _coerce_slice_index landed in the same commit (#50117). key is also overwritten before the message is built, so an integer-like key is reported as ...not int.

What

  • lazy_sequence.py: raise only when __index__ is absent, and before key is reassigned.
  • test_lazy_sequence.py: test_getitem_index_like covers this branch, which had no coverage at all .
    That is why the dead coercion went unnoticed. test_getitem_rejects_non_index guards the reordered raise; it passes on main too.
  • LazySelectSequence in airflow-core/src/airflow/utils/db.py still rejects such keys, but is not on the Dag-authoring path. Happy to align it in a follow-up.

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

LazyXComSequence.__getitem__ converted index-like keys through __index__
but then raised TypeError unconditionally anyway, so the conversion was
dead code: objects such as numpy.int64 - routinely produced by argmax and
by pandas - could never index a mapped task's results, even though the
slice path has coerced them correctly since the same commit introduced
both. The message also read the type name after the key was overwritten,
so an integer-like key was reported as "not int", giving no clue what was
actually passed.
@eladkal
eladkal requested a review from uranusjr September 21, 2026 05:58
@eladkal eladkal added this to the Airflow 3.4.0 milestone Sep 21, 2026
@eladkal eladkal added the type:bug-fix Changelog: Bug Fixes label Sep 21, 2026
This was referenced Sep 25, 2026
@potiuk potiuk added the closed because of open PR limit Closed as a one-time step of introducing the open pull request limit label Sep 25, 2026
@potiuk

potiuk commented Sep 25, 2026

Copy link
Copy Markdown
Member

Hello @Eason09053360 - thank you for your contributions to Apache Airflow!

The Airflow community has introduced a limit of 5 open pull requests at a time for contributors without write access to the repository. You currently have 33 open pull requests, so - as a one-time step of introducing the limit - we closed the ones where maintainers have not engaged yet:

These pull requests stay open because maintainers are already engaged in them - they count towards your limit:

This is not a judgement of you or of your changes. We never told contributors before that opening many pull requests at once was a problem, so there is nothing to feel bad about - and nothing is lost: your branches, commits and the review history stay where they are.

What we ask you to do is to make your first prioritization decision: choose which of the pull requests above matter most to you, and reopen them (up to 5 open at a time, including the ones still open) with the "Reopen pull request" button or gh pr reopen <PR_NUMBER> --repo apache/airflow. Reopen the ones you are ready to follow through - keep them rebased, respond to review comments and fix failing checks.

While your pull requests are waiting for review, the most valuable thing you can do is help in other ways - reviewing other contributors' pull requests, helping with issues, and taking part in the discussions on the devlist and Slack.

Why we introduced the limit, what it means for you and how to reopen or restore a pull request is explained in https://github.com/apache/airflow/blob/main/contributing-docs/32_open_pull_request_limit.rst.


Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting

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

Labels

area:task-sdk closed because of open PR limit Closed as a one-time step of introducing the open pull request limit type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants