fix(monitoring): clearer WARN lines (problem + context)

This commit is contained in:
Hernâni Marques 2026-07-16 20:43:56 +02:00
parent f9e3b7a515
commit ab8399d034
No known key found for this signature in database
2 changed files with 31 additions and 6 deletions

View file

@ -225,7 +225,8 @@ for AMT in "$@"; do
rung=$((rung + 1))
if ladder_over; then
STOP_REASON="timeout budget ${LADDER_TIMEOUT_S}s"
warn "ladder" "budget exhausted after $OK_N ok rungs"
warn ladder "time budget exhausted" \
"problem: LADDER_TIMEOUT_S=${LADDER_TIMEOUT_S}s reached after ${OK_N} ok rungs; remaining amounts not tried"
break
fi
@ -267,7 +268,8 @@ for AMT in "$@"; do
# Probe only: bank may reject GOA:0 — record and continue ladder
status="ZERO_REJECT"
note="zero-withdraw rejected (expected possible): $note"
warn bank "mint $AMT" "$note"
warn bank "mint $AMT rejected" \
"problem: bank will not create a GOA:0 withdrawal (zero amount probe). Ladder continues. detail: $note"
echo -e "${rung}\t${range_note}\t${AMT}\t${status}\t${ms_mint}\t${ms_accept}\t${ms_confirm}\t${ms_settle}\t${ms_total}\t${WID}\t${note}" >>"$TSV"
OK_N=$((OK_N + 1))
continue
@ -299,11 +301,14 @@ for AMT in "$@"; do
if [ "$IS_ZERO" = "1" ]; then
status="ZERO_SKIP"
note="zero-withdraw skip (7006 / no denoms): $note"
warn wallet "accept $AMT skipped" \
"problem: wallet code 7006 — no coin denominations for GOA:0 (zero amount cannot be withdrawn as coins). Ladder continues. detail: $note"
else
status="SKIP_DENOM"
note="skip amount (wallet 7006 no denoms): $note"
warn wallet "accept $AMT skipped" \
"problem: wallet code 7006 — no denominations match this amount (below smallest coin or not combinable). Ladder continues with next rung. detail: $note"
fi
warn wallet "accept $AMT" "$note"
echo -e "${rung}\t${range_note}\t${AMT}\t${status}\t${ms_mint}\t${ms_accept}\t${ms_confirm}\t${ms_settle}\t${ms_total}\t${WID}\t${note}" >>"$TSV"
continue
fi
@ -473,7 +478,8 @@ sys.exit(0 if Decimal(sys.argv[1]) > Decimal(sys.argv[2]) else 1)
if echo "$xfer" | grep -qi True; then
status="OK_BANK_LAG"
note="bank transfer_done avail=${after} $xfer"
warn "settle lag $AMT" "bank confirmed; wallet still ${CUR}:${after} (${ms_settle}ms)"
warn settle "lag after $AMT" \
"problem: bank transfer_done but wallet balance not increased yet (avail=${CUR}:${after}, settle ${ms_settle}ms) — coins may still be in flight"
OK_N=$((OK_N + 1))
echo -e "${rung}\t${range_note}\t${AMT}\t${status}\t${ms_mint}\t${ms_accept}\t${ms_confirm}\t${ms_settle}\t${ms_total}\t${WID}\t${note}" >>"$TSV"
else

View file

@ -304,9 +304,28 @@ fail() {
ERRORS+=("${LAST_TID:+$LAST_TID }$label${detail:+ — $detail}")
}
warn() {
local label="$1" detail="${2:-}"
# Forms (same idea as err; always try to state the problem):
# warn "problem"
# warn "problem" "why / context"
# warn component "problem" "why / context"
local a1="${1:-}" a2="${2:-}" a3="${3:-}"
local head detail
_take_tid
printf '%s[WARN]%s %s%s%s\n' "$Y" "$N" "$(_fmt_tid)" "$label" "${detail:+ — $detail}"
if [ -n "$a3" ]; then
head="${a1}: ${a2}"
detail="$a3"
elif [ -n "$a2" ]; then
head="$a1"
detail="$a2"
else
head="$a1"
detail=""
fi
if [ -n "$detail" ]; then
printf '%s[WARN]%s %s%s — %s\n' "$Y" "$N" "$(_fmt_tid)" "$head" "$detail"
else
printf '%s[WARN]%s %s%s\n' "$Y" "$N" "$(_fmt_tid)" "$head"
fi
WARN_N=$((WARN_N + 1))
}
info() {