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-releases-client.git


The following commit(s) were added to refs/heads/main by this push:
     new 5dc4206  Wrap validation errors, check signal availability, and 
improve JWT refreshing
5dc4206 is described below

commit 5dc4206be1f99130cead6661a08ef097a182df12
Author: Sean B. Palmer <[email protected]>
AuthorDate: Fri Jul 11 20:55:19 2025 +0100

    Wrap validation errors, check signal availability, and improve JWT 
refreshing
---
 pyproject.toml          |  4 ++--
 src/atrclient/client.py | 20 ++++++++++++--------
 uv.lock                 |  4 ++--
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index d6d474a..d08e9d5 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -11,7 +11,7 @@ build-backend = "hatchling.build"
 
 [project]
 name            = "apache-trusted-releases"
-version         = "0.20250711.1932"
+version         = "0.20250711.1954"
 description     = "ATR CLI and Python API"
 readme          = "README.md"
 requires-python = ">=3.13"
@@ -72,4 +72,4 @@ select = [
 ]
 
 [tool.uv]
-exclude-newer = "2025-07-11T19:32:00Z"
+exclude-newer = "2025-07-11T19:54:00Z"
diff --git a/src/atrclient/client.py b/src/atrclient/client.py
index 815e11f..463bd49 100755
--- a/src/atrclient/client.py
+++ b/src/atrclient/client.py
@@ -40,6 +40,7 @@ import cyclopts
 import filelock
 import jwt
 import platformdirs
+import pydantic
 import strictyaml
 
 import atrclient.models as models
@@ -348,7 +349,10 @@ def app_release_info(project: str, version: str, /) -> 
None:
     host, verify_ssl = config_host_get()
     url = f"https://{host}/api/releases/{project}/{version}";
     result = asyncio.run(web_get_public(url, verify_ssl))
-    release = models.sql.Release.model_validate(result)
+    try:
+        release = models.sql.Release.model_validate(result)
+    except pydantic.ValidationError as e:
+        show_error_and_exit(f"Unexpected API response: {result}\n{e}")
     print(release.model_dump_json(indent=None))
 
 
@@ -591,19 +595,17 @@ def config_jwt_payload() -> tuple[str | None, dict[str, 
Any]]:
 def config_jwt_refresh(asf_uid: str | None = None) -> str:
     with config_lock() as config:
         pat_value = config_get(config, ["tokens", "pat"])
+        if asf_uid is None:
+            asf_uid = config.get("asf", {}).get("uid")
 
     if pat_value is None:
         show_error_and_exit("No Personal Access Token stored.")
+    if asf_uid is None:
+        show_error_and_exit("No ASF UID provided and asf.uid not configured.")
 
     host, verify_ssl = config_host_get()
     url = f"https://{host}/api/jwt";
 
-    if asf_uid is None:
-        asf_uid = config.get("asf", {}).get("uid")
-
-    if asf_uid is None:
-        show_error_and_exit("No ASF UID provided and asf.uid not configured.")
-
     jwt_token = asyncio.run(web_fetch(url, asf_uid, pat_value, verify_ssl))
 
     with config_lock(write=True) as config:
@@ -677,6 +679,7 @@ def config_walk(
 ) -> tuple[bool, Any | None]:
     match (op, parts):
         case ("get", [k, *tail]) if tail:
+            # TODO: If config.get(k, {}) is not a dict, this fails
             return config_walk(config.get(k, {}), tail, op)
         case ("get", [k]):
             return (k in config), config.get(k)
@@ -762,7 +765,8 @@ def documentation_to_markdown(
 def initialise() -> None:
     # We do this because pytest_console_scripts.ScriptRunner invokes main 
multiple times
     APP.version = VERSION
-    signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+    if sys.platform not in {"cygwin", "win32"}:
+        signal.signal(signal.SIGPIPE, signal.SIG_DFL)
     subcommands_register(APP)
 
 
diff --git a/uv.lock b/uv.lock
index 21381e3..851f3d2 100644
--- a/uv.lock
+++ b/uv.lock
@@ -2,7 +2,7 @@ version = 1
 requires-python = ">=3.13"
 
 [options]
-exclude-newer = "2025-07-11T19:32:00Z"
+exclude-newer = "2025-07-11T19:54:00Z"
 
 [[package]]
 name = "aiohappyeyeballs"
@@ -83,7 +83,7 @@ wheels = [
 
 [[package]]
 name = "apache-trusted-releases"
-version = "0.20250711.1932"
+version = "0.20250711.1954"
 source = { editable = "." }
 dependencies = [
     { name = "aiohttp" },


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to