Validate matched multi-input expansion errors before async job prep#23058
Validate matched multi-input expansion errors before async job prep#23058SID-6921 wants to merge 3 commits into
Conversation
Signed-off-by: SID <nandasiddhardha@gmail.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR improves request validation behavior by translating InputMatchedException failures from meta-parameter expansion into a user-facing RequestParameterInvalidException.
Changes:
- Import
InputMatchedExceptionfor handling expansion failures. - Wrap
expand_meta_parameters_async(...)intry/exceptto raiseRequestParameterInvalidException. - Wrap
expand_meta_parameters(...)intry/exceptto raiseRequestParameterInvalidException.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try: | ||
| expanded_incomings, job_tool_states, collection_info = expand_meta_parameters_async( | ||
| request_context.app, self, tool_request_internal_state | ||
| ) | ||
| except InputMatchedException as exc: | ||
| raise exceptions.RequestParameterInvalidException(str(exc)) from exc |
|
This looks good but could you include a test for the API level behavior ? galaxy/lib/galaxy_test/api/test_jobs.py Lines 1354 to 1364 in 6b81c55 is more or less how this could look like |
… jobs Signed-off-by: SID <nandasiddhardha@gmail.com>
|
Added the requested API-level regression test in 0995097. New test: test_async_job_submission_rejects_mismatched_multi_inputs in lib/galaxy_test/api/test_jobs.py. It verifies async POST /api/jobs returns 400 with a validation error when matched multi-input lengths differ. |
|
https://github.com/galaxyproject/galaxy/actions/runs/28682121263/job/85075326385?pr=23058#step:9:1060 is a relevant test failure |
Consolidates duplicate InputMatchedException->RequestParameterInvalidException translation logic between expand_incoming_async and expand_incoming methods. This improves maintainability and ensures consistent error handling across both API paths for job submission (sync and async). The helper method _raise_matched_input_errors clearly documents the intent: mismatched multi-input parameter lengths should surface as 400 validation errors. Fixes: duplicated exception handling patterns Part of: PR galaxyproject#23058 - Validate matched multi-input expansion errors
|
I've refactored the code to extract the duplicate InputMatchedException handling into a helper method _raise_matched_input_errors. This consolidates the logic between \�xpand_incoming_async\ and \�xpand_incoming, improving maintainability and ensuring consistent error handling. Changes made:
The refactored code maintains the same behavior while reducing duplication. Tests are running now. |
|
The same test is still failing: https://github.com/galaxyproject/galaxy/actions/runs/29383806554/job/87287064090?pr=23058#step:7:1636 |
Summary
Problem
Issue #22884 reports malformed matched inputs reaching async prep and generating noisy internal errors around Celery job preparation. This patch validates the error at API/tool expansion boundary and returns a clear request-level error.
Notes
Testing