Skip to content

Fix missing task display name and map index in API audit logs - #73020

Closed
FrankYang0529 wants to merge 1 commit into
apache:mainfrom
FrankYang0529:airflow-audit-log-map-index
Closed

FrankYang0529 wants to merge 1 commit into
apache:mainfrom
FrankYang0529:airflow-audit-log-map-index

Conversation

@FrankYang0529

@FrankYang0529 FrankYang0529 commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Why

  • GET /api/v2/eventLogs returns task_display_name: null for REST API actions on a single task instance, such as marking it as success from the UI.
  • Fix log task instance join #59973 made Log.task_instance join on dag_id, task_id, run_id and map_index, but action_logging never stores map_index. These rows have a NULL map index and can never match a task instance.
  • The same rows show an empty Map Index column in the UI audit log, and filtering by map index does not find them.

How

  • action_logging records the map index from the request path, query or body. It commits the row before the endpoint validates the request, so it leaves out any value that is not an integer, is below -1, or does not fit the column.
  • Each audit row still matches at most one task instance, because (dag_id, task_id, run_id, map_index) is unique. This keeps the fix from Fix log task instance join #59973, which stopped one audit row from matching every task instance with the same task_id.

Verification

  • Unit test: uv run --frozen --project airflow-core pytest airflow-core/tests/unit/models/test_log.py airflow-core/tests/unit/api_fastapi/logging/test_decorators.py airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_event_logs.py airflow-core/tests/unit/api_fastapi/core_api/services/public/test_event_logs.py
  • Integration test:
  1. Add demo dag
mkdir -p files/dags
cat > files/dags/audit_log_map_index_demo.py <<'EOF'
from __future__ import annotations

from airflow.sdk import dag, task


@dag(schedule=None, tags=["audit-log-demo"])
def audit_log_map_index_demo():
    @task(task_display_name="Load orders")
    def load_orders():
        return "orders loaded"

    @task(task_display_name="Load shard")
    def load_shard(shard: int):
        return shard

    load_orders()
    load_shard.expand(shard=[0, 1, 2])


audit_log_map_index_demo()
EOF
  1. Start Airflow
breeze start-airflow --db-reset
  1. Trigger Dag and mark "Load shard" as failed.
  2. Check audit log.

On main branch, the Map Index column is empty although map_index is in Extra field. The API shows null for map_index and task_display_name fields.

Screenshot 2026-09-12 at 1 18 43 PM Screenshot 2026-09-12 at 1 19 11 PM

On this branch, we get expected values.
Screenshot 2026-09-12 at 1 21 41 PM
Screenshot 2026-09-12 at 1 21 53 PM


Was generative AI tooling used to co-author this PR?
  • Yes - Claude Code

  • 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 the area:API Airflow's REST/HTTP API label Sep 12, 2026
@FrankYang0529
FrankYang0529 force-pushed the airflow-audit-log-map-index branch from cac2615 to b7e5389 Compare September 12, 2026 04:49
@FrankYang0529
FrankYang0529 marked this pull request as ready for review September 12, 2026 06:25
@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 @FrankYang0529 - 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 30 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:API Airflow's REST/HTTP API closed because of open PR limit Closed as a one-time step of introducing the open pull request limit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants