FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix AIR004* in multiple example DAGs by Dev-iL · Pull Request #62529 · apache/airflow · GitHub

/ airflow Public

Fix AIR004* in multiple example DAGs - #62529

Merged
uranusjr merged 1 commit into
apache:mainfrom
Dev-iL:2602/fix_AIR004
Mar 13, 2026
Merged

Fix AIR004* in multiple example DAGs#62529
uranusjr merged 1 commit into
apache:mainfrom
Dev-iL:2602/fix_AIR004

Conversation

Dev-iL commented Feb 26, 2026

Copy link
Copy Markdown
Collaborator

This PR addresses violations detected by the ruff-ecosystem CI check in the context of a newly proposed ruff rule (currently known as "AIR004").

Related: astral-sh/ruff#23583, #43176


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

Generated-by: Claude Code Opus 4.6 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 or {issue_number}.significant.rst, in airflow-core/newsfragments.

boring-cyborg Bot added area:providers provider:amazon AWS/Amazon - related issues provider:databricks provider:google Google (including GCP) related issues labels Feb 26, 2026
Dev-iL force-pushed the 2602/fix_AIR004 branch 2 times, most recently from 9b456ab to 13deee0 Compare February 26, 2026 20:18

o-nikolas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The updates to the example dags look good. But I didn't expect to see source code changes here (and those are failing some mypy checks)

Dev-iL commented Feb 27, 2026

Copy link
Copy Markdown
Collaborator Author

I didn't expect to see source code changes here

Please elaborate. This new ruff inspection I'm working on is a "best practices" change.

those are failing some mypy checks

I'll address those as soon as I can

Copy link
Copy Markdown
Contributor

I didn't expect to see source code changes here

Please elaborate. This new ruff inspection I'm working on is a "best practices" change.

Yes the best practice ruff change looks great :) I just expected updates to Dags only (to fix cases the new rule would have caught). I'm not sure why any changes happened to actual src code (in this case the normalise_json_content code). Is that because that function is called downstream inside the operator in the databricks Dag you updated?

those are failing some mypy checks

I'll address those as soon as I can

Sounds good! 😄

Dev-iL commented Feb 27, 2026

Copy link
Copy Markdown
Collaborator Author

I'm not sure why any changes happened to actual src code (in this case the normalise_json_content code). Is that because that function is called downstream inside the operator in the databricks Dag you updated?

This is because a certain unit test was asserting an implementation detail:

    File "/opt/airflow/providers/databricks/tests/system/databricks/example_databricks.py", line 118, in <module>                                                                                             
      run_now = DatabricksRunNowOperator(                                                                                                                                                                     
    File "/opt/airflow/task-sdk/src/airflow/sdk/bases/operator.py", line 548, in apply_defaults                                                                                                               
      result = func(self, **kwargs, default_args=default_args)                                                                                                                                                
    File "/opt/airflow/providers/databricks/src/airflow/providers/databricks/operators/databricks.py", line 897, in __init__                                                                                  
      self.json = normalise_json_content(self.json)                                                                                                                                                           
    File "/opt/airflow/providers/databricks/src/airflow/providers/databricks/utils/databricks.py", line 45, in normalise_json_content                                                                         
      return {k: normalise(v, f"{json_path}[{k}]") for k, v in content.items()}                                                                                                                               
    File "/opt/airflow/providers/databricks/src/airflow/providers/databricks/utils/databricks.py", line 45, in <dictcomp>                                                                                     
      return {k: normalise(v, f"{json_path}[{k}]") for k, v in content.items()}                                                                                                                               
    File "/opt/airflow/providers/databricks/src/airflow/providers/databricks/utils/databricks.py", line 48, in normalise_json_content                                                                         
      raise AirflowException(msg)                                                                                                                                                                             
  airflow.sdk.exceptions.AirflowException: Type <class 'airflow.sdk.definitions.xcom_arg.PlainXComArg'> used for parameter json[job_id] is not a number or a string     

And Claude's analysis of this was:

The AIR004 fix changed job_id from a Jinja template string to jobs_create_named.output (a PlainXComArg). But the operator's __init__ calls normalise_json_content(self.json) at parse time,
  which doesn't handle XComArg objects — it only accepts strings, numbers, booleans, lists, and dicts.

Copy link
Copy Markdown
Contributor

I'm not sure why any changes happened to actual src code (in this case the normalise_json_content code). Is that because that function is called downstream inside the operator in the databricks Dag you updated?

This is because a certain unit test was asserting an implementation detail:

    File "/opt/airflow/providers/databricks/tests/system/databricks/example_databricks.py", line 118, in <module>                                                                                             
      run_now = DatabricksRunNowOperator(                                                                                                                                                                     
    File "/opt/airflow/task-sdk/src/airflow/sdk/bases/operator.py", line 548, in apply_defaults                                                                                                               
      result = func(self, **kwargs, default_args=default_args)                                                                                                                                                
    File "/opt/airflow/providers/databricks/src/airflow/providers/databricks/operators/databricks.py", line 897, in __init__                                                                                  
      self.json = normalise_json_content(self.json)                                                                                                                                                           
    File "/opt/airflow/providers/databricks/src/airflow/providers/databricks/utils/databricks.py", line 45, in normalise_json_content                                                                         
      return {k: normalise(v, f"{json_path}[{k}]") for k, v in content.items()}                                                                                                                               
    File "/opt/airflow/providers/databricks/src/airflow/providers/databricks/utils/databricks.py", line 45, in <dictcomp>                                                                                     
      return {k: normalise(v, f"{json_path}[{k}]") for k, v in content.items()}                                                                                                                               
    File "/opt/airflow/providers/databricks/src/airflow/providers/databricks/utils/databricks.py", line 48, in normalise_json_content                                                                         
      raise AirflowException(msg)                                                                                                                                                                             
  airflow.sdk.exceptions.AirflowException: Type <class 'airflow.sdk.definitions.xcom_arg.PlainXComArg'> used for parameter json[job_id] is not a number or a string     

And Claude's analysis of this was:

The AIR004 fix changed job_id from a Jinja template string to jobs_create_named.output (a PlainXComArg). But the operator's __init__ calls normalise_json_content(self.json) at parse time,
  which doesn't handle XComArg objects — it only accepts strings, numbers, booleans, lists, and dicts.

Thanks for the context and details :)

uranusjr merged commit d1455c8 into apache:main Mar 13, 2026
90 checks passed
Dev-iL deleted the 2602/fix_AIR004 branch March 14, 2026 00:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues provider:databricks provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL