Skip to content

feat(inquirerer-utils): add suppressUpdateCheck to write cache entry after update#65

Merged
pyramation merged 1 commit intomainfrom
devin/1772210653-add-suppress-update-check
Feb 27, 2026
Merged

feat(inquirerer-utils): add suppressUpdateCheck to write cache entry after update#65
pyramation merged 1 commit intomainfrom
devin/1772210653-add-suppress-update-check

Conversation

@pyramation
Copy link
Contributor

feat(inquirerer-utils): add suppressUpdateCheck for post-update cache

Summary

Adds a new exported function suppressUpdateCheck(toolName, currentVersion) to @inquirerer/utils, alongside the existing clearUpdateCache.

Problem: After a CLI update command (e.g. pgpm update) installs a new version, clearUpdateCache deletes the cache file. The next CLI invocation — still running under the old binary due to process/shim timing — finds no cache, fetches the latest version from npm, compares it against the stale pkgVersion, and shows a false-positive "Update available" message.

Solution: suppressUpdateCheck writes a cache entry with latestVersion set to the current binary's version. The next checkForUpdates call sees latestVersion === pkgVersionhasUpdate: false. The cache expires after 24h, at which point a fresh check runs against the (by then correct) new binary.

This is a companion to constructive#749 which updates the pgpm update command to call suppressUpdateCheck instead of clearUpdateCache.

Review & Testing Checklist for Human

  • Cache format coupling: suppressUpdateCheck writes { latestVersion, timestamp } — the same internal format that checkForUpdates reads (lines 137-138 of update-check.ts). Verify this stays consistent. Both are in the same file, but worth confirming.
  • Fallback behavior: On write failure, the catch block calls clearUpdateCache, which re-exposes the original bug (false-positive update message). Confirm this is acceptable as a best-effort fallback vs. silently failing.
  • No unit tests added: The package currently has zero tests (--passWithNoTests). Consider whether a test for this function is needed before merging, especially to lock in the cache format contract.

Notes

…after update

After a CLI update command installs a new version, the currently running
binary still reports the old version. If we merely clear the cache, the
next command fetches the latest from npm and compares against the stale
pkgVersion, producing a false-positive 'Update available' message.

suppressUpdateCheck writes the current binary's version as latestVersion
so the next checkForUpdates call sees no update needed. The cache expires
after 24h, at which point a fresh check runs against the new binary.
@devin-ai-integration
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit 8aa6b50 into main Feb 27, 2026
36 checks passed
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