#!/usr/bin/env bash # check-node-pin.sh — weekly Electron/Node pin comparison (§5.4). # # Divergence is ADVISORY (exit 0, detail in the ping body); only genuine # staleness fails. Electron ships a major every 8 weeks, so failing on any # divergence would leave this check DOWN most of the year — and a check that is # already down cannot signal anything new, nor be told apart from one that # stopped running. set -uo pipefail : "${STALE_MAJORS:=2}" pinned=$(mise current node 2>/dev/null || echo "") [[ -n "$pinned" ]] || { echo "cannot determine pinned node version" >&2; exit 1; } json=$(curl -fsS -m 20 https://releases.electronjs.org/releases.json) \ || { echo "cannot reach releases.electronjs.org — not evidence of drift" >&2; exit 1; } latest=$(jq -r '[.[] | select(.channel=="stable")] | sort_by(.version) | last | .deps.node' <<<"$json") [[ -n "$latest" && "$latest" != "null" ]] || { echo "could not parse deps.node" >&2; exit 1; } echo "pinned node: $pinned electron stable bundles: $latest" [[ "${pinned%%.*}" == "${latest%%.*}" ]] && { echo "in sync"; exit 0; } behind=$(( ${latest%%.*} - ${pinned%%.*} )) echo "pin is ${behind} major(s) behind" if (( behind >= STALE_MAJORS )); then echo "STALE: bump server/files/mise.toml and re-run bootstrap.sh --target dev" >&2 exit 1 fi echo "advisory only — bump when convenient"