Skip to content

Add test to verify parameters match between operator and decorator #48448

Open

Description

@eladkal

Body

We shouldn't have notes like:

# !!! Changes in KubernetesPodOperator's arguments should be also reflected in !!!
# - airflow-core/src/airflow/decorators/__init__.pyi (by a separate PR)

this is very easy to miss both by PR author and the reviewer

The task:
Add tests to all existed decorators to make sure the parameter list they accept match to the operator.

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.

Activity

  1. gomtangman commented on Mar 27, 2025

    @gomtangman
    Contributor

    Hi!
    Can I take this issue and work on it?

  2. Shweta-281 commented on Mar 29, 2025

    @Shweta-281

    Hi [@gomtangman], I noticed you’re assigned to this issue. I’d love to contribute here too—are you open to collaboration? I’m happy to pair-program, tackle a subtask, or review your work. Let me know how I can assist!

  3. gomtangman commented on Mar 29, 2025

    @gomtangman
    Contributor

    @Shweta-281 Thank you for your suggestion
    I am writing a test now. So can you review it when I make a pull request?

  4. gomtangman commented on Apr 3, 2025

    @gomtangman
    Contributor

    Hi @Shweta-281
    I became busy doing my work to keep up with this issue.
    So if you are still interested in this issue, can you work on it instead of me?
    I thought it would be good to test whether the test is covering all the decorators.
    So, I searched for a way to retrieve all the decorators but I failed to find one.
    If you can find a way to ensure all the decorators are tested, I think that'll increase the quality of tests.

  5. Debasishpradhan28 commented on Apr 8, 2025

    @Debasishpradhan28

    I want to take this issue and work on it. can I ?

  6. gomtangman commented on Apr 8, 2025

    @gomtangman
    Contributor

    @Debasishpradhan28
    Yes, please take it

  7. amoghrajesh commented on Jun 13, 2025

    @amoghrajesh
    Contributor

    Looks like @Bowrna is already on it. Assigning to her.

  8. isharghura commented on Nov 12, 2025

    @isharghura

    Hi can I take this issue?

  9. Bowrna commented on Nov 13, 2025

    @Bowrna
    Contributor

    @amoghrajesh @isharghura the work is done and it was failing in static checks when i raised PR alone. #51048
    may be i can try running it again and verify it before next wednesday.

  10. Stuaarts commented on Aug 31, 2026

    @Stuaarts

    Hi, I'd like to work on this issue as my first contribution to Airflow. Is it still available ?

  11. wfatih commented on Sep 20, 2026

    @wfatih

    I would like to take this one, and I measured the drift first so the scope is based on numbers rather than guesses.

    A static scan — ast only, nothing imported — of task-sdk/src/airflow/sdk/definitions/decorators/__init__.pyi against the operator behind each task-decorators entry registered in provider.yaml finds:

    • 11 registered decorators with no stub entry at all: agent, analytics, llm, llm_branch, llm_file_analysis, llm_schema_compare, llm_sql, sftp_sensor, snowpark, sql, stub. @task.llm(...) and friends fall back to __getattr__ today, so they get no parameter checking at all.
    • Parameter drift in 7 of the 13 decorators that do have a stub. A few examples: python is missing templates_exts, which PythonOperator.__init__ accepts; virtualenv and external_python are missing string_args, templates_exts and expect_airflow; kubernetes and kubernetes_cmd are each missing around thirteen KubernetesPodOperator parameters, including cmds, callbacks, logging_interval and runtime_class_name.

    Not every difference is drift. use_dill, serializer and python_command exist only on the decorator side, and bash_command, command and arguments are deliberately supplied by the decorated function rather than the caller, so the check needs an explicit exemption list instead of a strict equality assertion.

    On where the check should live: the earlier attempt in #51048 needed Airflow importable to compare signatures, which pushed it into an in-container script and is where it got stuck. Comparing the stub against the operator __init__ can be done entirely statically, so it fits a plain scripts/ci/prek/ hook with no Airflow dependency and no container, runnable on a clean checkout. I have a working prototype of that comparison, which is where the numbers above come from.

    Three questions before I write the real thing:

    1. Is a static prek hook the shape you want, or would you still rather have this in the test suite?
    2. Are the 11 missing decorators in scope here, or a follow-up? Adding them means writing stubs for provider decorators that never had one.
    3. For the drift the check finds, should the same PR fix the stubs — the kubernetes ones are the bulk of it — or should the check land with those exempted and the fixes follow per provider?

    Drafted-by: Claude Opus 5 (1M context); reviewed by @wfatih before posting

  12. sjyangkevin commented on Oct 14, 2026

    @sjyangkevin
    Contributor

    I would like to take this one and I've opened a draft PR. I did a check but not yet find an active development. Would appreciate any review feedback. Thanks!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions