1fanwang opened a new pull request, #72925:
URL: https://github.com/apache/airflow/pull/72925

   When minimum acceptable worker versions were configured, an edge worker 
submitting an unparseable version string caused packaging version parsing to 
raise an unhandled InvalidVersion exception. This escaped to the application 
handler and returned an HTTP 500 error for invalid client input.
   
   This change catches InvalidVersion in _version and raises an HTTP 400 Bad 
Request error matching the route error specification.
   
   # Testing Done
   
   Reproduction before fix:
   ```bash
   uv run --project providers/edge3 pytest -k 
test_version_invalid_raises_http_400
   ```
   
   Pre-fix output:
   ```text
   FAILED test_worker.py test_version_invalid_raises_http_400 - 
packaging.version.InvalidVersion: Invalid version: 'invalid-version-string'
   ```
   
   Verification after fix:
   ```bash
   uv run --project providers/edge3 pytest 
providers/edge3/tests/unit/edge3/worker_api/routes/test_worker.py -k 
"test_version or test_assert_version"
   ```
   
   Post-fix output:
   ```text
   ================= 3 passed, 37 deselected, 1 warning in 9.72s 
==================
   ```
   
   <details>
   <summary>Raw logs</summary>
   
   ```text
   test_worker.py test_version PASSED [  2%]
   test_worker.py test_version_invalid_raises_http_400 PASSED [  5%]
   test_worker.py test_assert_version PASSED [  7%]
   ```
   
   </details>
   


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