Skip to content

Commit 5fdc8b9

Browse files
authored
Merge pull request #21508 from mvdbeek/fix_invocation_response_model
[25.0] Fix type annotation for invocation report ``errors`` field
2 parents 8f4744e + 6f98404 commit 5fdc8b9

File tree

4 files changed

+53
-5
lines changed

4 files changed

+53
-5
lines changed

client/src/api/schema/schema.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14020,9 +14020,11 @@ export interface components {
1402014020
* Errors
1402114021
* @description Errors associated with the invocation.
1402214022
*/
14023-
errors?: {
14024-
[key: string]: unknown;
14025-
} | null;
14023+
errors?:
14024+
| {
14025+
[key: string]: unknown;
14026+
}[]
14027+
| null;
1402614028
/**
1402714029
* Galaxy Version
1402814030
* @description The version of Galaxy this object was generated with.

lib/galaxy/managers/markdown_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def handle_error(self, container, line, error):
418418

419419
class ReadyForExportMarkdownDirectiveHandler(GalaxyInternalMarkdownDirectiveHandler):
420420
def __init__(self, trans, extra_rendering_data=None):
421-
extra_rendering_data = extra_rendering_data or {}
421+
extra_rendering_data = extra_rendering_data if extra_rendering_data is not None else {}
422422
self.trans = trans
423423
self.extra_rendering_data = extra_rendering_data
424424

lib/galaxy/schema/invocation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ class InvocationReport(Model, WithModelClass):
470470
generate_time: Optional[str] = schema.GenerateTimeField
471471
generate_version: Optional[str] = schema.GenerateVersionField
472472

473-
errors: Optional[Dict[str, Any]] = Field(
473+
errors: Optional[List[Dict[str, Any]]] = Field(
474474
default=None,
475475
title="Errors",
476476
description="Errors associated with the invocation.",

lib/galaxy_test/api/test_workflows.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3411,6 +3411,52 @@ def test_workflow_invocation_report_custom(self):
34113411
assert "## Workflow Inputs" in markdown_content
34123412
assert "## About This Report" in markdown_content
34133413

3414+
@skip_without_tool("cat")
3415+
def test_workflow_invocation_report_invalid_hdca_id(self):
3416+
"""Test that an invalid HDCA id is reported in errors."""
3417+
workflow_with_unknown_directive = """
3418+
class: GalaxyWorkflow
3419+
name: Workflow With Unknown Directive
3420+
inputs:
3421+
input_1: data
3422+
outputs:
3423+
output_1:
3424+
outputSource: first_cat/out_file1
3425+
steps:
3426+
first_cat:
3427+
tool_id: cat
3428+
in:
3429+
input1: input_1
3430+
report:
3431+
markdown: |
3432+
## Test Report
3433+
3434+
```galaxy
3435+
history_dataset_collection_display(history_dataset_collection_id=1000000)
3436+
```
3437+
"""
3438+
test_data = """
3439+
input_1:
3440+
value: 1.bed
3441+
type: File
3442+
"""
3443+
with self.dataset_populator.test_history() as history_id:
3444+
summary = self._run_workflow(workflow_with_unknown_directive, test_data=test_data, history_id=history_id)
3445+
workflow_id = summary.workflow_id
3446+
invocation_id = summary.invocation_id
3447+
# Fetch the report - errors should be collected in the response
3448+
report_response = self._get(f"workflows/{workflow_id}/invocations/{invocation_id}/report")
3449+
self._assert_status_code_is(report_response, 200)
3450+
response_json = report_response.json()
3451+
# Check that errors were collected
3452+
assert "errors" in response_json
3453+
assert response_json["errors"] is not None
3454+
assert len(response_json["errors"]) > 0
3455+
# Verify the error message mentions the actual error
3456+
error_entry = response_json["errors"][0]
3457+
assert "error" in error_entry
3458+
assert "History dataset collection association not found" in error_entry["error"]
3459+
34143460
@skip_without_tool("cat1")
34153461
def test_export_invocation_bco(self):
34163462
with self.dataset_populator.test_history() as history_id:

0 commit comments

Comments
 (0)