Skip to content

Commit 7c9a625

Browse files
committed
fix(upgrade): handle version prefix matching in success detection
When version detection returns short form (3.13) but target is full version (3.13.11), the upgrade success check incorrectly reported failure. Now checks if versions are prefix-related before warning. Example: installed=3.13, target=3.13.11 - after upgrade the snapshot may still show 3.13, but since 3.13 is a prefix of 3.13.11, we consider the upgrade successful within that version range.
1 parent a415bfc commit 7c9a625

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

scripts/guide.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,14 @@ process_tool() {
318318
prompt_pin_version "$tool" "$installed"
319319
elif [ "$new_installed" = "$installed" ] && [ "$new_installed" != "$latest" ]; then
320320
# Version didn't change and not at target
321-
printf "\n ⚠️ Upgrade did not succeed (version unchanged)\n"
322-
prompt_pin_version "$tool" "$installed"
321+
# BUT: if installed is a prefix of latest (e.g., 3.13 vs 3.13.11), consider it success
322+
# This happens when version detection returns short form but upgrade actually worked
323+
if [[ "$latest" == "$new_installed"* ]] || [[ "$new_installed" == "$latest"* ]]; then
324+
: # Prefix match - upgrade likely succeeded, don't warn
325+
else
326+
printf "\n ⚠️ Upgrade did not succeed (version unchanged)\n"
327+
prompt_pin_version "$tool" "$installed"
328+
fi
323329
else
324330
# Upgrade succeeded - remove any existing pin to avoid stale pins
325331
if catalog_has_tool "$tool"; then
@@ -361,8 +367,13 @@ process_tool() {
361367
printf "\n ⚠️ Upgrade failed (install script error)\n"
362368
printf " Auto-update is still enabled - will try again next time.\n"
363369
elif [ "$new_installed_a" = "$installed" ] && [ "$new_installed_a" != "$latest" ]; then
364-
printf "\n ⚠️ Upgrade did not succeed (version unchanged)\n"
365-
printf " Auto-update is still enabled - will try again next time.\n"
370+
# Version didn't change - but check for prefix match (e.g., 3.13 vs 3.13.11)
371+
if [[ "$latest" == "$new_installed_a"* ]] || [[ "$new_installed_a" == "$latest"* ]]; then
372+
printf " ✓ Auto-update enabled. This tool will update automatically in future.\n"
373+
else
374+
printf "\n ⚠️ Upgrade did not succeed (version unchanged)\n"
375+
printf " Auto-update is still enabled - will try again next time.\n"
376+
fi
366377
else
367378
printf " ✓ Auto-update enabled. This tool will update automatically in future.\n"
368379
# Remove any existing pin

0 commit comments

Comments
 (0)