Skip to content

fix: auto-upgrade marker no longer masks newer remote versions - #523

Closed
gregario wants to merge 1 commit into
garrytan:mainfrom
gregario:fix/stale-upgrade-marker
Closed

gregario wants to merge 1 commit into
garrytan:mainfrom
gregario:fix/stale-upgrade-marker

Conversation

@gregario

Copy link
Copy Markdown
Contributor

Problem

When a just-upgraded-from marker file persists across sessions, gstack-update-check short-circuits at Step 2 (line 112–122) — it writes UP_TO_DATE to cache and exits immediately, never fetching the remote VERSION. Users silently stay on old versions, potentially missing dozens of commits.

Reported in #515: a user upgraded from 0.9.3.0 → 0.9.4.0, then missed 42 commits because the marker caused Step 4 (remote fetch) to be skipped entirely.

Root cause

# Step 2 — before fix
if [ -f "$MARKER_FILE" ]; then
  ...
  echo "UP_TO_DATE $LOCAL" > "$CACHE_FILE"  # ← premature
  ...
  exit 0  # ← never reaches remote check
fi

The script assumes "just upgraded = up to date", which isn't true if the remote advanced between the upgrade and the next session.

Fix

Remove the exit 0 and the premature UP_TO_DATE cache write. The script now:

  1. Consumes and deletes the marker (same as before)
  2. Clears the snooze file (same as before)
  3. Outputs JUST_UPGRADED for the preamble (same as before)
  4. Falls through to Step 3 (cache check) → Step 4 (remote fetch)

If no further updates exist, Step 4 writes UP_TO_DATE to cache as normal. If a newer version landed, the user sees both JUST_UPGRADED and UPGRADE_AVAILABLE in the same session.

Changes

  • bin/gstack-update-check — remove early exit and premature cache write from Step 2 (+2/−3 lines)
  • browse/test/gstack-update-check.test.ts — add two regression tests:
    • Path C2: marker present + remote has newer version → outputs both notices, cache reflects UPGRADE_AVAILABLE
    • Path C3: marker present + remote matches local → outputs JUST_UPGRADED, cache reflects UP_TO_DATE

Test plan

  • All 35 existing + 2 new tests pass (bun test browse/test/gstack-update-check.test.ts)
  • Full bun test passes (only pre-existing bug: package.json version out of sync with VERSION file on main #399 version mismatch fails — unrelated)
  • Existing "just-upgraded clears snooze file" test still passes
  • Existing "outputs JUST_UPGRADED and deletes marker" test still passes (falls through to remote fetch, which writes UP_TO_DATE on unreachable remote)

Fixes #515

When a just-upgraded-from marker persists across sessions, the update
check would write UP_TO_DATE to cache and exit immediately — never
fetching the remote VERSION. Users silently miss updates that landed
after their last upgrade.

Remove the early exit and premature cache write so the script falls
through to the remote check after consuming the marker. This ensures
JUST_UPGRADED is still emitted for the preamble, while also detecting
any newer versions available upstream.

Fixes garrytan#515
@gregario

Copy link
Copy Markdown
Contributor Author

Merged via #552. Closing.

@gregario gregario closed this Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-upgrade misses updates when just-upgraded-from marker is stale

1 participant