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

   ## What is wrong
   
   `scripts/in_container/run_template_fields_check.py` turns each changed file 
path
   into a module name so it can decide whether to validate it:
   
   ```python
   if (module_name := pyfile.rstrip(".py").replace("/", ".")) in 
provider_modules
   ```
   
   `str.rstrip` takes a **set of characters**, not a suffix, so after removing
   `.py` it keeps going as long as the next character is `.`, `p` or `y`:
   
   | file | `rstrip(".py")` | correct |
   |---|---|---|
   | `base.py` | `base` | `base` |
   | `registry.py` | **`registr`** | `registry` |
   | `entry.py` | **`entr`** | `entry` |
   | `proxy.py` | **`prox`** | `proxy` |
   | `copy.py` | **`co`** | `copy` |
   | `factory.py` | **`factor`** | `factory` |
   
   A truncated name never matches an entry in `provider_modules`, so the file 
falls
   out of `modules_to_validate`. Nothing is raised and nothing is logged — the
   check just silently does not run for that file.
   
   **87 of the 2179 provider source files end in `p.py` or `y.py`** and are 
skipped
   this way, including operator modules such as
   `providers/openlineage/src/airflow/providers/openlineage/operators/empty.py`.
   Any invalid `template_fields` entry added to one of those has been passing 
CI.
   
   ## Fix
   
   `removesuffix(".py")`, which is what the line was written to mean. One
   character-for-character change, no behaviour change for any file that was
   already being validated.
   
   ## Verification
   
   ```pycon
   >>> "registry.py".rstrip(".py"), "registry.py".removesuffix(".py")
   ('registr', 'registry')
   ```
   
   `ruff check` and `ruff format --check` clean on the touched file.
   


-- 
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