baha-bouali opened a new pull request, #70628:
URL: https://github.com/apache/airflow/pull/70628
Restores two `__init__` argument-provision checks that moved to `execute()`
under the
old `validate-operators-init` rule, now that #70505 narrowed the rule to
allow
`field is None` / `field is not None` provision checks back in `__init__`.
**`AgentOperator`** : straight revert of #70338's
`message_history`/`enable_hitl_review`
check back to `__init__`, with
`test_agent.py::test_message_history_with_hitl_review_raises`
reverted to assert at construction time (and its unneeded `skipif` removed).
**`DocumentLoaderOperator`** : partial revert. `source_path`/`source_bytes`
exclusivity is
pure provision and moves back to `__init__`. The `file_type` check stays in
`execute()`,
since it backs an `assert` on the *rendered* value of `file_type` (itself a
template
field). So, checking it in `__init__` would validate the unrendered template
string instead.
Tests split to match: the two exclusivity tests revert to constructor-time,
the two
`file_type` tests stay at `.execute()`.
## Testing
- `uv run --script scripts/ci/prek/validate_operators_init.py` on both files
-> clean,
no exemption entries needed under the narrowed rule.
- `pytest providers/common/ai/tests/unit/common/ai/operators/test_agent.py
providers/common/ai/tests/unit/common/ai/operators/test_document_loader.py` ->
passing.
related: #70503
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
<!--
Assisted by: Claude Sonnet 5 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]