Skip to content

Commit 13434cd

Browse files
authored
chore(deps): bump zad-cli naar v0.8.0 en lees nieuwe diagnose-output (#50)
v0.8.0 verving het platte {error,status_code} JSON-formaat door een diagnose-object (headline, summary, next_steps, fault). report_zad_error leest nu die velden en valt terug op .error voor version-skew, zodat netwerk- en onbekende fouten hun boodschap behouden in plaats van leeg te tonen.
1 parent ea7dec7 commit 13434cd

2 files changed

Lines changed: 31 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [4.0.6] - 2026-06-19
11+
12+
### Changed
13+
- Bump zad-cli from v0.6.0 to v0.8.0 (admin orphan-report/orphan-confirm commands, and a new structured error diagnosis layer with source labels, next-step suggestions and CI exit codes 1/2/3)
14+
- Update `report_zad_error` to read zad-cli's new diagnosis JSON (`headline`, `summary`, `next_steps`) so error annotations surface the cause and remediation; falls back to the old flat `error` field for version skew. Network/unknown failures (HTTP status 0) now keep their message instead of dropping it.
15+
1016
## [4.0.5] - 2026-05-19
1117

1218
### Changed

scripts/zad-common.sh

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Install zad-cli if not already available.
77
# Pin to a specific version tag to prevent breaking changes.
8-
ZAD_CLI_VERSION="v0.6.0"
8+
ZAD_CLI_VERSION="v0.8.0"
99

1010
install_zad_cli() {
1111
if command -v zad >/dev/null 2>&1; then
@@ -61,8 +61,11 @@ validate_integer() {
6161
#
6262
# Usage: report_zad_error <operation> <cli_stdout> <project-id>
6363
#
64-
# The CLI outputs JSON errors to stdout in --output json mode:
65-
# {"error": "HTTP 401: ...", "status_code": 401}
64+
# zad-cli >= v0.7.0 outputs a structured diagnosis to stdout in --output json mode:
65+
# {"fault": "Auth", "headline": "Authentication failed (HTTP 401).",
66+
# "summary": "...", "next_steps": ["..."], "status_code": 401}
67+
# Older CLIs used a flat {"error": "HTTP 401: ...", "status_code": 401}; we fall
68+
# back to that shape so a version skew never swallows the message.
6669
report_zad_error() {
6770
local operation="$1"
6871
local cli_stdout="$2"
@@ -75,14 +78,16 @@ report_zad_error() {
7578
return
7679
fi
7780

78-
local status_code error_msg
81+
local status_code headline summary
7982
status_code=$(echo "$cli_stdout" | jq -r '.status_code // 0' 2>/dev/null || echo "0")
80-
error_msg=$(echo "$cli_stdout" | jq -r '.error // empty' 2>/dev/null || echo "")
83+
# Prefer the new diagnosis headline; fall back to the old flat .error field.
84+
headline=$(echo "$cli_stdout" | jq -r '.headline // .error // empty' 2>/dev/null || echo "")
85+
summary=$(echo "$cli_stdout" | jq -r '.summary // empty' 2>/dev/null || echo "")
8186

8287
case "$status_code" in
8388
0)
84-
if [ -n "$error_msg" ]; then
85-
echo "::error::${operation} failed: $error_msg"
89+
if [ -n "$headline" ]; then
90+
echo "::error::${operation} failed: $headline"
8691
else
8792
echo "::error::${operation} failed with no HTTP status code"
8893
echo "::error::This could be a network issue, timeout, or CLI error"
@@ -104,10 +109,22 @@ report_zad_error() {
104109
if [ "$status_code" -ge 500 ] 2>/dev/null; then
105110
echo "::error::${operation} failed: ZAD API server error (HTTP $status_code) after retries"
106111
else
107-
echo "::error::${operation} failed (HTTP $status_code): $error_msg"
112+
echo "::error::${operation} failed (HTTP $status_code): ${headline:-error}"
108113
fi
109114
;;
110115
esac
116+
117+
# Surface the backend's own summary and remediation, when present.
118+
if [ -n "$summary" ] && [ "$summary" != "$headline" ]; then
119+
echo "::error::Details: $summary"
120+
fi
121+
local steps
122+
steps=$(echo "$cli_stdout" | jq -r '.next_steps[]? // empty' 2>/dev/null || echo "")
123+
if [ -n "$steps" ]; then
124+
while IFS= read -r step; do
125+
[ -n "$step" ] && echo "::error::Next step: $step"
126+
done <<< "$steps"
127+
fi
111128
}
112129

113130
# Delete a ZAD deployment via CLI, handling not-found gracefully.

0 commit comments

Comments
 (0)