noron12234 commented on PR #71386:
URL: https://github.com/apache/airflow/pull/71386#issuecomment-5442573986
@potiuk Went with option 1. Retitled to **Fix template fields check never
running against provider modules**, and the commit message matches so the
squash lands clean.
Repairing the glob turned out to be necessary but not sufficient — two more
things sat between the script and any actual work:
**The argv -> module mapping never resolves.** Even with `removesuffix`,
`replace("/", ".")` on a repo path gives
`providers.ftp.src.airflow.providers.ftp.operators.ftp`, and `provider.yaml`
registers `airflow.providers.ftp.operators.ftp`. Nothing can match. Added a
`path_to_module()` that drops everything up to and including `src`, which
covers both `providers/<name>/src/...` and `airflow-core/src/...`.
**The prek hook's `files:` pattern matches 3 files in the whole repo**, all
`__init__.py`:
```yaml
files: ^(providers/.*/)?airflow-core/.*/(sensors|operators)/.*\.py$
```
No provider operator lives under `airflow-core/`. So with only the glob
fixed, prek would still never hand the script a provider file.
Numbers, from running the patched script's own `get_providers_modules()` and
`path_to_module()` against the tree:
```
provider.yaml found by the glob 0 -> 107
registered operator/sensor modules 338
files the prek hook would pass 3 -> 343
modules selected for validation 0 -> 265
```
The 78 matched-but-not-selected are `__init__.py` and unregistered helpers,
correctly dropped by the existing `in provider_modules` guard.
Two things for you:
1. The third fix is a one-line change in `.pre-commit-config.yaml`, not the
script. If you would rather this PR stay single-file, I will move it to a
follow-up — just say which.
2. Rebased onto current `main` (was 357 behind). The earlier red `K8S
Lang-SDK` job failed on `./main.go:50:48: undefined: v1.BundleInfo` during the
Go bundle build, unrelated to this change; the rebase should clear it.
Standing by on the `backport-to-v3-3-test` branch until this one settles, so
we are not fixing the same thing twice in parallel.
--
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]