The GitHub Actions job "Tests" on airflow.git/iss has failed.
Run started by GitHub user SakshamSinghal20 (triggered by SakshamSinghal20).

Head commit for run:
77b6af2e2f524c3b3cce5ca3cef7f5305ec776c7 / username 
<[email protected]>
fix: backfill dag_version_id for legacy tasks to avoid Pydantic ValidationError

The Pydantic TaskInstance datamodel requires dag_version_id to be a
strict uuid.UUID (not None). After removing the old 'skip when
dag_version is None' guard, legacy tasks migrated from Airflow 2
triggered a ValidationError when constructing TaskCallbackRequest.

Fix:
  Add _ensure_ti_has_dag_version_id() helper that:
  1. Returns True immediately if dag_version_id is already set
  2. Backfills from DagVersion.get_latest_version() when missing
  3. Returns False (skip with warning) only when no DagVersion
     exists at all for the dag_id

This helper is called at all 4 callback creation sites, right before
constructing TaskCallbackRequest / EmailRequest. It ensures:
  - Callbacks are sent whenever possible (backfill succeeds)
  - Clean skip with warning only in edge case (no DagVersion at all)
  - Pydantic validation never sees None for dag_version_id

Updated test_purge_without_heartbeat_skips_when_missing_dag_version
to verify the new backfill behavior: since dag_maker creates a
DagVersion, the backfill succeeds and the callback IS sent.

Report URL: https://github.com/apache/airflow/actions/runs/22321833029

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to