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 ebed239 Include details in error messages about keys with no ASF UID
ebed239 is described below
commit ebed23972a352ae7ef31ae46723e93b379e142c7
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed May 21 16:45:16 2025 +0100
Include details in error messages about keys with no ASF UID
---
atr/db/interaction.py | 15 ++++++++++++++-
atr/routes/keys.py | 10 +++++++---
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/atr/db/interaction.py b/atr/db/interaction.py
index b3a25be..86476fd 100644
--- a/atr/db/interaction.py
+++ b/atr/db/interaction.py
@@ -39,6 +39,13 @@ import atr.util as util
_LOGGER: Final = logging.getLogger(__name__)
+class ApacheUserMissingError(RuntimeError):
+ def __init__(self, message: str, fingerprint: str | None, primary_uid: str
| None) -> None:
+ super().__init__(message)
+ self.fingerprint = fingerprint
+ self.primary_uid = primary_uid
+
+
class PathInfo(schema.Strict):
artifacts: set[pathlib.Path] = schema.factory(set)
errors: dict[pathlib.Path, list[models.CheckResult]] = schema.factory(dict)
@@ -74,7 +81,13 @@ async def key_user_add(asf_uid: str | None, public_key: str,
selected_committees
break
if asf_uid is None:
# We place this here to make it easier on the type checkers
- raise RuntimeError("No Apache UID found in the key UIDs")
+ non_asf_uids = key.get("uids", [])
+ first_non_asf_uid = non_asf_uids[0] if non_asf_uids else "None"
+ raise ApacheUserMissingError(
+ f"No Apache UID found. Fingerprint: {key.get('fingerprint',
'Unknown')}. Primary UID: {first_non_asf_uid}",
+ fingerprint=key.get("fingerprint"),
+ primary_uid=first_non_asf_uid,
+ )
# Store key in database
async with db.session() as data:
diff --git a/atr/routes/keys.py b/atr/routes/keys.py
index c35dc57..215ba47 100644
--- a/atr/routes/keys.py
+++ b/atr/routes/keys.py
@@ -584,14 +584,18 @@ async def _upload_process_key_blocks(key_blocks:
list[str], selected_committees:
)
except Exception as e:
logging.exception(f"Exception processing key #{i + 1}:")
+ fingerprint, user_id = "Unknown", "None"
+ if isinstance(e, interaction.ApacheUserMissingError):
+ fingerprint = e.fingerprint or "Unknown"
+ user_id = e.primary_uid or "None"
results.append(
{
"status": "error",
"message": f"Internal Exception: {e}",
"key_id": f"Key #{i + 1}",
- "fingerprint": "Error",
- "user_id": "Unknown",
- "email": "Unknown",
+ "fingerprint": fingerprint,
+ "user_id": user_id,
+ "email": user_id,
"committee_statuses": {},
}
)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]