You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2025/04/04 15:45:11 UTC

(tooling-trusted-release) branch main updated: Fix the extraction of Message-Id fields from task results

This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git


The following commit(s) were added to refs/heads/main by this push:
     new 0e20499  Fix the extraction of Message-Id fields from task results
0e20499 is described below

commit 0e20499ea6e40aa406e2c64123ee884b1e4dad6e
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Fri Apr 4 16:44:35 2025 +0100

    Fix the extraction of Message-Id fields from task results
---
 atr/routes/candidate.py | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/atr/routes/candidate.py b/atr/routes/candidate.py
index 9683501..170cca8 100644
--- a/atr/routes/candidate.py
+++ b/atr/routes/candidate.py
@@ -429,23 +429,20 @@ async def _resolve_post_files(project_name: str, release: models.Release, vote_r
 
 
 def _task_mid(latest_vote_task: models.Task) -> str:
+    task_mid = "(no result)"
+
     try:
-        # Result is stored as a JSON string
-        # Handle that defensively
-        if isinstance(latest_vote_task.result, str):
-            parsed_result = json.loads(latest_vote_task.result)
-            if not isinstance(parsed_result, list):
-                raise TypeError("Unexpected result type")
-        elif isinstance(latest_vote_task.result, list):
-            parsed_result = latest_vote_task.result
-        else:
-            raise TypeError("Unexpected result type")
-
-        task_mid = "(no result)"
-        for result in parsed_result:
-            if isinstance(result, dict):
-                task_mid = result.get("mid", "(mid not found in result)")
-            break
+        for result in latest_vote_task.result or []:
+            if isinstance(result, str):
+                parsed_result = json.loads(result)
+            else:
+                # Shouldn't happen
+                parsed_result = result
+            if isinstance(parsed_result, dict):
+                task_mid = parsed_result.get("mid", "(mid not found in result)")
+                break
+            else:
+                task_mid = "(malformed result)"
 
     except (json.JSONDecodeError, TypeError):
         task_mid = "(malformed result)"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org