[airflow] Add AIR331 rule for airflow.traces module removed in Airflow 3.2#23914
[airflow] Add AIR331 rule for airflow.traces module removed in Airflow 3.2#23914dstandish wants to merge 1 commit into
AIR331 rule for airflow.traces module removed in Airflow 3.2#23914Conversation
…rflow 3.2 The `airflow.traces` module was removed in Airflow 3.2. Add a new lint rule to flag imports from this module so users can identify and remove them before upgrading. Made-with: Cursor
|
Thank you! I'm happy to give this a review, but I like to check in with @Lee-W first :) |
|
|
Sure, will do it early next week. We're establishing the process how we contribute to ruff from airflow community. But Daniel's PR is most likely correct haha. Will take a deeper look 👀 |
All credit goes to claude |
|
@Lee-W if we are also removing airflow.metrics and airflow.stats in 3.2, would it make sense to add these to the same ruff rule? |
yep, we group logics with the same purpose into one rule |
| /// from airflow.traces.tracer import Trace | ||
| /// ``` | ||
| #[derive(ViolationMetadata)] | ||
| #[violation_metadata(preview_since = "0.15.1")] |
There was a problem hiding this comment.
| #[violation_metadata(preview_since = "0.15.1")] | |
| #[violation_metadata(preview_since = "NEXT_RUFF_VERSION")] |
| } | ||
|
|
||
| impl Violation for Airflow32Removal { | ||
| const FIX_AVAILABILITY: FixAvailability = FixAvailability::None; |
There was a problem hiding this comment.
I think we should just fix it by removing these imports?
|
@dstandish do you think you'll have time in the near future to address the PR feedback? If not, that's completely fine, but I would then go ahead and close the PR. It makes it easier for us to track which work is currently in progress. |
|
Below is a review of adherence to the new-airflow-rule SKILL: Code Review: AIR331 —
|
| # | Severity | Issue |
|---|---|---|
| 1 | Bug | Missing is_guarded_by_try_except → false positives on conditional imports |
| 2 | Convention | preview_since should be "NEXT_RUFF_VERSION" |
| 3 | Minor | Dead fix_title code — remove or add symbols that use it |
| 4 | Minor | Wildcard match ["airflow", "traces", ..] is too broad; enumerate known symbols |
| 5 | Minor | Fixture missing try-except guarded test cases |
| 6 | Nit | Test case out of numerical order in mod.rs |
| 7 | Nit | Import ordering in removal_in_3_2.rs reversed vs. convention |
| 8 | Nit | Missing Use instead: doc section |
Items 1 and 4 are the most important to address before merge. The rest are style/convention fixes.
Hi -- I am an airflow contributor. A real human one.
I want to add this rule to help identify if an airflow user is importing from the traces package (which we are removing in 3.2).
Thanks for your review.
Summary
AIR331lint rule that flags imports from theairflow.tracesmodule, which was removed in Airflow 3.2airflow.traces.otel_tracer,airflow.traces.tracer,airflow.traces.utils, and all submodule membersTest plan
AIR331_names.pywith positive and negative cases