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

   
   * related: https://github.com/apache/airflow/pull/66967
   
   ### Why
   
   The project convention is that any function decorated with 
`@provide_session` must declare `session` as keyword-only (after a bare `*`), 
so callers cannot pass it positionally by accident. Today this is only 
documented in 
`contributing-docs/05_pull_requests.rst#database-session-handling`, so 
regressions slip in during review.
   
   ### What
   
   - New prek hook `check-no-new-provide-session-positional` scans changed 
files (or `--all-files`) for `@provide_session` functions whose `session` 
parameter is still positional.
   - Existing offenders are recorded in 
`scripts/ci/prek/known_provide_session_positional.txt` as `path::N` entries 
(max count per file). The hook fails when a file exceeds its limit, and 
auto-tightens the entry when the count decreases so the allowlist only shrinks 
over time. (Following convention of 
https://github.com/apache/airflow/pull/55416 )
   - Supports `--all-files`, `--cleanup` (drop stale entries), and `--generate` 
(rebuild the allowlist from scratch).
   
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes, with help of Claude Code Opus 4.7 following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


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