bujjibabukatta opened a new pull request, #70656:
URL: https://github.com/apache/airflow/pull/70656
## Summary
Part of the burn-down tracked in #70296.
`PsrpOperator.__init__` validated
`command`/`powershell`/`cmdlet`/`arguments`/`parameters`
using truthiness checks instead of `is not None` checks. Per the guidance in
#70296,
"was this provided" checks are allowed to stay in `__init__`, but must use
`is not None`
polarity rather than truthiness — so this is a fix in place, not a move to
`execute()`.
## What was wrong
- `command`/`powershell`/`cmdlet` were collected into a `set` before being
passed to
`exactly_one()`. If two of them happened to render to the same string, the
set would
collapse them and validation would incorrectly pass.
- `if arguments and ...`, `if parameters and ...`, `if cmdlet:` treated an
explicitly
provided empty list/dict/string as "not provided", silently skipping
validation.
## Fix
Replaced truthiness checks with `is not None` checks, and pass fields to
`exactly_one()`
directly instead of via a `set`. `__init__` is now limited to this provision
check plus
plain `self.field = field` assignments.
## Testing
Added three regression tests in `test_psrp.py` covering: two duplicate field
values,
an empty `arguments` list, and an empty `parameters` dict — all now
correctly raise
`ValueError`.
Related: #70296
Was generative AI tooling used to co-author this PR?
- [X] Yes - Claude
Generated-by: Claude 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]