potiuk opened a new pull request, #73046:
URL: https://github.com/apache/airflow/pull/73046

   Static checks have been red on this branch since #73042 upgraded the CI 
environment. That bump brought
   ruff 0.15.17 → 0.16.6 and zizmor → 1.30.0, but not the changes `main` made 
alongside those upgrades, so
   every `prek --all-files` run since fails. It surfaces on the release sync PR 
(#72946), whose "CI image
   checks / Static checks" job runs `prek --all-files`:
   
   | Hook | CI result |
   | --- | --- |
   | `ruff` | 6278 errors (915 fixed, 5363 remaining) |
   | `ruff-format` | 103 files reformatted |
   | `mypy-devel-common` | 14 errors |
   | `mypy-shared-plugins_manager` | 1 error |
   | `zizmor` | exit 12 |
   
   Four of those five have a single cause.
   
   ##### Ruff's default rule set
   
   Ruff 0.16 widened its default rule set from roughly 250 to 510 rules. #70725 
pinned the base set on `main`
   precisely so that a tooling bump cannot quietly enable rules nobody opted 
into, and was never backported
   here. Without the pin ruff reports 6278 violations, and two other hooks fail 
as a consequence rather than
   on their own merits:
   
   * `ruff --fix` rewrites `setattr(module, "attr", value)` to `module.attr = 
value` under B010. That is what
     `mypy-devel-common`'s 14 `Module has no attribute` errors are - mypy is 
reading code ruff rewrote
     moments earlier, not code in the repository.
   * Reformatting those 915 rewrites is what makes `ruff-format` report 103 
files. With the rule set pinned,
     ruff changes nothing and one genuine file remains, fixed here by taking 
`main`'s rewrite of the snippet
     in `schema/AGENTS.md` - a bare `Version(...),` is a tuple to the 0.16 
formatter, which parenthesises it.
   
   ##### Zizmor 1.30 audits
   
   * `self-repository` wants every `uses: ./...` rewritten to `uses: $/...`. 
`main` disables it with a
     documented rationale: `$/` makes the runner fetch the repository as an 
action and that download cannot
     materialise this repository's committed symlinks, and ASF infrastructure's 
allowlist check does not
     recognise the syntax. The config block is copied verbatim.
   * `unsound-ternary` points at a real bug rather than a style preference: `x 
== 'All' && '' || y` never
     evaluates to the empty string, because `''` is falsy and the expression 
falls through to `y`. `main`
     already rewrote these three sites with `case()`, which is what this 
backports.
   
   ##### The one genuine type error
   
   `shared/plugins_manager`'s `plugin_obj.validate()` fails because 
`inspect.isclass` narrows only to
   `type[object]`. `main` carries the `cast` and the comment explaining why the 
preceding MRO check makes it
   sound; that is backported unchanged.
   
   ##### Verification
   
   All five hooks pass locally after the change, and nothing else is modified 
by running them:
   
   ```
   Run 'ruff' for extremely fast Python 
linting..............................Passed
   Run 'ruff 
format'.........................................................Passed
   Run zizmor to check for github workflow syntax 
errors.....................Passed
   Run mypy for 
devel-common.................................................Passed
   Run mypy for 
shared-plugins_manager.......................................Passed
   ```
   
   Note the two mypy hooks run against the CI image in CI and a local 
virtualenv outside it, so their local
   pass is weaker evidence than the other three. The `shared-plugins_manager` 
fix is a `cast`, which does not
   depend on the environment, and `devel-common` was only ever failing on 
ruff-rewritten code.
   
   ##### Follow-up
   
   `main` and `v3-3-test` having drifted on lint configuration is what let this 
through: the version bumper
   upgraded the tools on both branches, but the accompanying fixes only ever 
landed on one. Worth considering
   whether those bumps should be blocked on an `--all-files` run of the branch 
they target.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5)
   
   Generated-by: Claude Code (Opus 5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01DcRW9x8n7Jor7ftsKFxQHD
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to