Skip to content

fix(notifier): suppress stale update notice during self-update#24

Merged
epodivilov merged 1 commit into
mainfrom
fix/notifier-skip-self-update
Jun 21, 2026
Merged

fix(notifier): suppress stale update notice during self-update#24
epodivilov merged 1 commit into
mainfrom
fix/notifier-skip-self-update

Conversation

@epodivilov

Copy link
Copy Markdown
Owner

Summary

wt self-update printed a stale Update available: 0.7.3 → 0.8.0 · run wt self-update line right after a successful upgrade.

Root cause: the notifier runs at bootstrap, reads the cache, and registers a process.on("exit") handler with latestVersion captured in its closure. self-update then replaces the binary and writes the cache (writeUpdateCache in self-update.ts), but the exit handler is already armed with the pre-upgrade version and fires anyway.

Fix: skip the notifier entirely when argv contains the self-update command. The command reports its own outcome, so the footer notice is redundant on both the "already up to date" and "upgraded" paths.

Changes

  • src/cli/update-notifier.ts — new SKIP_COMMANDS set alongside SKIP_FLAGS; combined argv check.
  • src/cli/update-notifier.test.ts — covers the new gate.

Test plan

  • pnpm typecheck
  • pnpm lint
  • bun test (513 pass, +1 new)
  • Manual: run wt self-update while a stale cache says "update available" — no footer line should follow Done!.

The update notifier registered a `process.on("exit")` handler at startup
that captured the cached `latestVersion` in its closure. When the
`self-update` command then upgraded the binary in the same process, the
already-registered handler still printed "Update available: x → y" on
exit — pointing at the very version the user just installed.

Skip the notifier entirely when argv contains `self-update`. The command
itself reports the upgrade outcome, so the footer notice would be
redundant even on the no-op "already up to date" path.

Add a SKIP_COMMANDS set alongside the existing SKIP_FLAGS so the two
classes of skip-reasons stay distinct, and cover the new gate with a
focused test.
@epodivilov epodivilov merged commit fce45b2 into main Jun 21, 2026
1 check passed
@epodivilov epodivilov deleted the fix/notifier-skip-self-update branch June 21, 2026 09:14
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.

1 participant