release 1.13.1: global progress done/total stable across phases

Phase summary no longer resets PROGRESS_TOTAL to local done (which made
bars like 34/34 then 38/47). Total is fixed at run start; only grows if
short; progress_finish snaps once at the end of the whole run.
This commit is contained in:
Hernâni Marques 2026-07-19 02:35:09 +02:00
parent 2931006e3c
commit 74e76aff2c
No known key found for this signature in database
GPG key ID: CB5738652768F7E9
5 changed files with 70 additions and 23 deletions

View file

@ -1 +1 @@
1.13.0
1.13.1

View file

@ -17,6 +17,7 @@ Git tags: `vMAJOR.FEATURE.FIX` (e.g. `v1.8.0`). File `VERSION` omits the `v` pre
| Tag | Date (UTC) | Notes |
|-----|------------|--------|
| **v1.13.1** | 2026-07-19 | **Bugfix:** progress bar **global** done/total — phase `summary()` no longer snaps total to phase-local N (fixes 34/34 then 38/47); final `progress_finish` snaps once; header shows 0/N. |
| **v1.13.0** | 2026-07-19 | **Feature:** phase **devtesting** / **franken** — fake-franken CHF via `rusty.taler-ops.ch` (`taler-devtesting` geniban + fake-incoming); stage host-agent can include it. |
| **v1.12.0** | 2026-07-19 | **Feature:** collapsible **monitoring env context** (agent header: env_file, suite pin, domain/hosts/flags) — `<details>` default closed; summary shows agent · domain · suite. |
| **v1.11.0** | 2026-07-19 | **Feature:** sticky **error/warn filter** — click counts to show only error or only warn log lines; sticky bar + overviews stay; `#filter-error` / `#filter-warn` (+ `#first-*` still works). |

View file

@ -55,6 +55,9 @@ i18n_text() {
fi
case "$s" in
"numbered checks this run:") printf 'controles numerotes de cette execution :' ;;
"numbered checks:") printf 'controles numerotes :' ;;
"(global done/total)") printf '(fait/total global)' ;;
"global checks:") printf 'controles globaux :' ;;
"failed — see list above"|"failed - see list above") printf 'echec — voir la liste ci-dessus' ;;
"BLOCKERS · pay/withdraw cannot finish") printf 'BLOCAGES · paiement/retrait impossible' ;;
"BLOCKERS (pay/withdraw cannot finish)") printf 'BLOCAGES (paiement/retrait impossible)' ;;

52
lib.sh
View file

@ -590,20 +590,38 @@ add_progress_total() {
PROGRESS_TOTAL=$((PROGRESS_TOTAL + n))
_mon_state_save
}
# When estimate was short, grow total so we never print done>total (e.g. 224/205).
# Keeps ~10% headroom so the bar is not stuck at 100% while checks continue.
# When the global estimate was short, grow total just enough so done≤total.
# Never shrink. Mid-run headroom is small and monotonic (stable N in done/N).
_progress_rebalance() {
[ "${PROGRESS_TOTAL:-0}" -gt 0 ] || return 0
[ "${PROGRESS_DONE:-0}" -gt 0 ] || return 0
if [ "$PROGRESS_DONE" -gt "$PROGRESS_TOTAL" ]; then
local head=$((PROGRESS_DONE / 10))
[ "$head" -lt 12 ] && head=12
# + max(8, 5% of done) so we do not snap to 100% then jump again next check
local head=$((PROGRESS_DONE / 20))
[ "$head" -lt 8 ] && head=8
PROGRESS_TOTAL=$((PROGRESS_DONE + head))
_mon_state_save
fi
}
# Snap total to actual done — only at whole-run end (not after each phase).
progress_finish() {
[ "${PROGRESS_OFF:-0}" = "1" ] && return 0
[ "${PROGRESS_DONE:-0}" -gt 0 ] || return 0
if [ "${PROGRESS_TOTAL:-0}" -ne "$PROGRESS_DONE" ]; then
PROGRESS_TOTAL=$PROGRESS_DONE
_mon_state_save
fi
_progress_bar_line "$PROGRESS_DONE" "$PROGRESS_TOTAL"
if [ "${GLOBAL_N:-0}" -gt 0 ]; then
printf -- '%s %s %d/%d (#001…#%03d)%s\n' \
"$D" "$(i18n_text 'global checks:')" \
"$PROGRESS_DONE" "$PROGRESS_TOTAL" "$GLOBAL_N" "$N"
fi
}
_progress_bar_line() {
# Format (grows left → right; badge = percent, not "PROG"):
# Format (grows left → right; badge = percent):
# ┌ 42% ┐ ████████░░░░░░░░░░░░░░░░ 31/74
# done/total = global numbered checks so far / global expected total
local done="$1" total="$2" width=28 pct=0 filled empty i bar pct_lab
# Defensive: never display done > total
if [ "$total" -gt 0 ] && [ "$done" -gt "$total" ]; then
@ -636,7 +654,7 @@ _progress_bar_line() {
while [ "$i" -lt "$empty" ]; do bar="${bar}"; i=$((i + 1)); done
pct_lab=$(printf '%3d%%' "$pct")
if [ "${BOX:-0}" = "1" ]; then
# badge = percent (clearer than "PROG"); bar grows ░→█ left to right
# badge = percent; bar grows ░→█ left to right; N/M = global check count
printf '%s┌%s┐%s %s%s%s %s%d/%d%s\n' \
"$BG_PROG" "$pct_lab" "$N" \
"$C" "$bar" "$N" \
@ -647,10 +665,10 @@ _progress_bar_line() {
fi
else
if [ "${BOX:-0}" = "1" ]; then
printf '%s┌ … ┐%s %sdone=%d%s (set PROGRESS_TOTAL= for %%)\n' \
printf '%s┌ … ┐%s %s%d/?%s (set PROGRESS_TOTAL= for global %%)\n' \
"$BG_PROG" "$N" "$D" "$done" "$N"
else
printf -- '%sdone=%d%s (set PROGRESS_TOTAL= for %%)\n' "$D" "$done" "$N"
printf -- '%s%d/?%s (set PROGRESS_TOTAL= for global %%)\n' "$D" "$done" "$N"
fi
fi
}
@ -811,18 +829,30 @@ section() {
summary() {
local blk_n=${#BLOCKERS[@]}
echo ""
# final progress line (no _take_tid — plain printf)
if [ "${PROGRESS_OFF:-0}" != "1" ] && [ "$PROGRESS_DONE" -gt 0 ]; then
# Snap total to actual so last line is exact N/N 100%
# Phase progress snapshot — keep GLOBAL total (do not snap N to phase-local done).
# Snapping here made mid-run bars like 34/34 then 38/47. Whole-run snap: progress_finish.
if [ "${PROGRESS_OFF:-0}" != "1" ] && [ "${PROGRESS_DONE:-0}" -gt 0 ]; then
if [ "${PROGRESS_FINAL:-0}" = "1" ]; then
# last phase / explicit final: done/total exact
if [ "$PROGRESS_TOTAL" -gt 0 ] && [ "$PROGRESS_DONE" -ne "$PROGRESS_TOTAL" ]; then
PROGRESS_TOTAL=$PROGRESS_DONE
_mon_state_save
fi
fi
_progress_rebalance
_progress_bar_line "$PROGRESS_DONE" "$PROGRESS_TOTAL"
fi
if [ "$GLOBAL_N" -gt 0 ]; then
# Always show global position: current # / expected total (if known)
if [ "${PROGRESS_TOTAL:-0}" -gt 0 ]; then
printf -- '%s %s #001…#%03d · %d/%d %s%s\n' \
"$D" "$(i18n_text 'numbered checks:')" "$GLOBAL_N" \
"$PROGRESS_DONE" "$PROGRESS_TOTAL" \
"$(i18n_text '(global done/total)')" "$N"
else
printf -- '%s %s #001…#%03d%s\n' "$D" "$(i18n_text 'numbered checks this run:')" "$GLOBAL_N" "$N"
fi
fi
if [ "$blk_n" -gt 0 ]; then
if [ "${BOX:-0}" = "1" ]; then
printf -- '%s┌ %s ┐%s\n' "$BG_BLK" "$(i18n_text 'BLOCKERS · pay/withdraw cannot finish')" "$N"

View file

@ -395,28 +395,34 @@ if [ "${#PHASES[@]}" -eq 0 ]; then
PHASES=(urls)
fi
# Rough expected check counts for progress % (override: PROGRESS_TOTAL=N).
# Prefer slightly high — lib.sh rebalances if still short (never shows done>total).
# Global expected check count for progress bar done/total (override: PROGRESS_TOTAL=N).
# One estimate for the whole run — phase summary() must NOT reset this mid-run.
# Prefer slightly high; lib.sh only grows if short (never shrinks until progress_finish).
if [ "${PROGRESS_TOTAL:-0}" = "0" ] || [ -z "${PROGRESS_TOTAL:-}" ]; then
_pt=0
for p in "${PHASES[@]}"; do
case "$p" in
urls) _pt=$((_pt + 95)) ;; # +qr + webui SPA fingerprints
inside) _pt=$((_pt + 30)) ;;
versions) _pt=$((_pt + 25)) ;;
versions) _pt=$((_pt + 35)) ;; # + disk probes can be many
sanity) _pt=$((_pt + 35)) ;;
server) _pt=$((_pt + 20)) ;;
# e2e: ATM ladder emits many INFO lines (coins before/after each note)
e2e) _pt=$((_pt + 240)) ;;
ladder|goa-ladder) _pt=$((_pt + 120)) ;;
auth401) _pt=$((_pt + 70)) ;;
aptdeploy) _pt=$((_pt + 20)) ;;
surface|ecosystem) _pt=$((_pt + 80)) ;;
monpages|pages) _pt=$((_pt + 30)) ;;
aptdeploy) _pt=$((_pt + 40)) ;;
surface|ecosystem) _pt=$((_pt + 120)) ;;
monpages|pages) _pt=$((_pt + 20)) ;;
mattermost) _pt=$((_pt + 25)) ;;
mail) _pt=$((_pt + 40)) ;;
devtesting|franken|fake-franken|fake_franken) _pt=$((_pt + 12)) ;;
esac
done
# monpages post-check after htmlify can add another inventory pass
case " ${PHASES[*]} " in
*" monpages "*|*" pages "*) _pt=$((_pt + 12)) ;;
esac
set_progress_total "$_pt"
unset _pt
fi
@ -503,7 +509,8 @@ if [ "${RUN_TIMEOUT:-0}" -eq 0 ]; then
else
printf ' run_timeout %ss wall clock (RUN_TIMEOUT=; 0=unlimited)\n' "$RUN_TIMEOUT"
fi
printf ' progress total≈%s (set PROGRESS_TOTAL= to override; PROGRESS_OFF=1 to hide)\n' "${PROGRESS_TOTAL:-0}"
printf ' progress %s/%s (global done/total · set PROGRESS_TOTAL= to override; PROGRESS_OFF=1 to hide)\n' \
"${PROGRESS_DONE:-0}" "${PROGRESS_TOTAL:-0}"
unset _INSIDE_ACCESS_HINT
chmod +x "$ROOT"/check_*.sh 2>/dev/null || true
@ -573,4 +580,10 @@ if [ "$RUN_TIMED_OUT" = "1" ]; then
"$RUN_TIMEOUT" "$elapsed"
fi
# Snap progress bar to real global count (done/total) once for the whole run
if type progress_finish >/dev/null 2>&1; then
printf '\n'
progress_finish
fi
exit "$ec"