fix: update check ignores stale UP_TO_DATE cache after version change

The UP_TO_DATE cache path exited immediately without checking if the
cached version still matched the local VERSION. After upgrading (e.g.
0.3.3 → 0.3.4), the cache still said "UP_TO_DATE 0.3.3" and the
script never re-checked against remote — so updates were invisible
until the 24h cache expired.

Now both UP_TO_DATE and UPGRADE_AVAILABLE verify cached version vs
local before trusting the cache.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-14 13:23:25 -05:00
parent 4e31acbd47
commit baf8acd55c
2 changed files with 19 additions and 1 deletions
+6 -1
View File
@@ -49,7 +49,12 @@ if [ -f "$CACHE_FILE" ]; then
CACHED="$(cat "$CACHE_FILE" 2>/dev/null || true)"
case "$CACHED" in
UP_TO_DATE*)
exit 0
# Verify local version still matches cached version
CACHED_VER="$(echo "$CACHED" | awk '{print $2}')"
if [ "$CACHED_VER" = "$LOCAL" ]; then
exit 0
fi
# Local version changed — fall through to re-check
;;
UPGRADE_AVAILABLE*)
# Verify local version still matches cached old version