fix(ops): don't cry wolf about a deploy that just hasn't ticked yet

A push seconds before an ops-health run has no skip reason yet — that is
normal, not a problem. Only flag a missing skip reason once the deploy script
hasn't run for >6 min (i.e. the timer really looks stopped).
This commit is contained in:
SkateSpots 2026-10-01 10:59:14 +07:00
parent 52ed2f89bd
commit 126eb38330

View file

@ -62,6 +62,11 @@ human_age() {
else echo "$((s / 86400))d"; fi
}
# Age of a file in seconds, or empty when it doesn't exist.
file_age() {
[ -f "$1" ] && echo $(( $(date +%s) - $(cat "$1" 2>/dev/null || echo 0) )) || echo ""
}
cd "$REPO" 2>/dev/null || { echo "ops-health: repo not found: $REPO" >&2; exit 2; }
now=$(date +%s)
@ -153,8 +158,13 @@ else
p " ${DIM}→ reason: ${sk_reason}${N}" ;;
esac
else
p " ${Y}no skip reason recorded — the deploy timer may not be running.${N}"
problems+=("deploy pending with no recorded reason"); signature+="noreason;"
r_age="$(file_age "$RUN_FILE")"
if [ -n "$r_age" ] && [ "$r_age" -lt 360 ]; then
p " ${DIM}waiting for the next deploy tick (~every 3m)…${N}"
else
p " ${Y}no skip reason recorded and the deploy script hasn't run recently — the timer may be stopped.${N}"
problems+=("deploy pending with no recorded reason"); signature+="noreason;"
fi
fi
fi