Return a clear error for malformed tool ids in guid_to_repository#23141
Open
SAY-5 wants to merge 2 commits into
Open
Return a clear error for malformed tool ids in guid_to_repository#23141SAY-5 wants to merge 2 commits into
SAY-5 wants to merge 2 commits into
Conversation
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Contributor
Author
|
Pushed a fix for the mypy failure on the new test: it was passing app=None against the ToolShedApp-typed parameter. Since the malformed-id check runs before app is dereferenced, I cast None to ToolShedApp so the type checker is satisfied while still exercising the error path. |
mvdbeek
reviewed
Jul 21, 2026
mvdbeek
left a comment
Member
There was a problem hiding this comment.
The fix looks great but the test doesn't add a lot of value. Can you either remove the test or test the positive cases as well ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A TRS tool id whose decoded guid has fewer than four slashes (for example
localhost/repos/owner) reachesguid_to_repository, wheretool_id.split("/", 5)returns too few values to unpack. The bareValueError: not enough values to unpack (expected 5, got 3)propagates out of the/api/ga4gh/trs/v2/tools/{id}/versionsendpoint as a 500 instead of a request error. Fixes #23139.This raises
RequestParameterInvalidExceptionfor malformed ids so the API returns a 400, and reads the owner/name by index so a guid that still carries a trailing version segment keeps working.How to test the changes?
(Select all options that apply)
License