fix: validate Python callable file and name together - #849
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #849 +/- ##
=======================================
Coverage 95.66% 95.67%
=======================================
Files 13 13
Lines 1385 1387 +2
=======================================
+ Hits 1325 1327 +2
Misses 60 60 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tatiana
left a comment
There was a problem hiding this comment.
@cen-zp Thanks for the fix, and nice call not just flipping the and to or as the issue suggested - that would have broken the valid "python_callable only" and "name + file" configs. Doing an XOR check to the python_callable-absent case feels like the right approach,
One optional cleanup: the new check repeats not task_params.get("python_callable") right before the existing if not ...:, so it reads as three back-to-back python_callable checks.
I'm happy to approve and merge it once you change it out of draft!
9dc5ab2 to
67440bc
Compare
|
Hi @tatiana, thanks again for the review! I’ve applied the optional cleanup and marked the PR ready for review. The latest workflow runs also appear to be awaiting maintainer approval. Could you please take another look when you have a chance? |
Summary
python_callable_nameandpython_callable_fileare provided togetherDagFactoryExceptionfor either incomplete configurationRoot cause
The builder only rejected configurations where all Python callable options were absent. When exactly one file-based callable parameter was provided, it accessed the missing dictionary key directly and raised
KeyError.Validation
hatch run tests.py3.11-3.2:test— 295 passed, 7 skipped, 1 deselectedpytest tests/test_dagbuilder.py -q— 87 passed, 4 skippedFixes #101