altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

upgrade() depends on semver — if import fails, users are permanently locked on old versions

Open anandgupta42 opened this issue 8 months ago • 0 comments

Description

The upgrade() function in cli/upgrade.ts imports semver for version comparison. If this import fails at runtime in the compiled binary (e.g., bundling issue, missing dependency), the entire upgrade path throws an error that is silently swallowed by .catch(() => {}) in worker.ts:289.

This means users on the broken version can never auto-update or even see an upgrade notification — they're permanently locked out.

Root Cause

  1. semver is a 14KB external package imported for a single gte() call
  2. The caller worker.ts:289 does .catch(() => {}) — any throw is invisible
  3. No smoke test verifies that upgrade() can even be imported

Fix

  1. Replace semver with inline compareVersions() (25 lines, zero dependencies)
  2. Replace .catch(() => {}) with error logging
  3. Add 73 tests including module import smoke tests and parity checks

anandgupta42 avatar Mar 23 '26 22:03 anandgupta42