[26.0] Fix AssertionError remapping malformed galaxy markdown blocks#23176
Open
mvdbeek wants to merge 1 commit into
Open
[26.0] Fix AssertionError remapping malformed galaxy markdown blocks#23176mvdbeek wants to merge 1 commit into
mvdbeek wants to merge 1 commit into
Conversation
_remap_container saved the directive line while looping over the
container's lines, but then re-matched GALAXY_MARKDOWN_FUNCTION_CALL_LINE
against the loop variable holding the container's *last* line. For stored
report markdown that was never validated (e.g. an unclosed ```galaxy
fence swallowing following prose), the re-match returned None and the
subsequent assert produced an unhandled 500 on
GET /api/invocations/{invocation_id}/report.
Keep the match object found in the loop instead, and turn the assert on
a second directive within one block into MalformedContents so malformed
user content yields a 4xx rather than an AssertionError.
Fixes galaxyproject#23175
Fixes USEGALAXY-EU-MAIN-61HFG00001W43
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.
_remap_container(in_remap_galaxy_markdown_calls) saved the directive line while looping over a```galaxycontainer's lines, but then re-matchedGALAXY_MARKDOWN_FUNCTION_CALL_LINEagainst the loop variable holding the container's last line. For stored report markdown that was never validated — e.g. an unclosed```galaxyfence, which makesGALAXY_FENCED_BLOCKswallow the following prose into the container — the re-match returnedNoneand the subsequentassertproduced an unhandled 500 onGET /api/invocations/{invocation_id}/report.Sentry captured the failing locals directly (9 occurrences on usegalaxy.eu 26.1.rc1):
matching_lineheld the directivehistory_dataset_as_image(output="spatial scatter plots filtered")whilelinewas<br>, somatchwasNone.This keeps the match object found during the loop instead of re-matching, and turns the other assert (a second directive within one block) into
MalformedContentsso malformed user content yields a 4xx rather than anAssertionError.Fixes #23175
Fixes USEGALAXY-EU-MAIN-61HFG00001W43
How to test the changes?
License