Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 27, 2025

Overview

This PR fixes a bug where Dev Proxy Toolkit incorrectly shows upgrade notifications even when the latest version is already installed. The issue occurred because the version extraction logic was picking up version numbers from file paths instead of actual update notifications.

Problem

When devproxy outdated --short runs, it can output different things depending on the configuration:

When no updates are available:

info    1 error responses loaded from /opt/homebrew/Cellar/dev-proxy/v0.29.1/devproxy-errors.json

When an update is available:

info    1 error responses loaded from /opt/homebrew/Cellar/dev-proxy/v0.29.0/devproxy-errors.json
info    v0.29.1

The original extractVersionFromOutput function used a generic regex that would match the first version number found, which was always from the file path. This caused false upgrade notifications suggesting users upgrade to the same version they already had installed.

Solution

Updated the extractVersionFromOutput function to:

  1. Process output line-by-line instead of using a global regex
  2. Skip lines containing file paths (identified by /, \, or loaded from)
  3. Only extract versions from dedicated notification lines
  4. Handle both Unix and Windows file paths correctly

Changes Made

Core Fix

  • src/detect.ts: Enhanced extractVersionFromOutput function with path-aware logic
  • Added comprehensive comments explaining the fix

Tests Added

Validation

  • ✅ All existing tests continue to pass (no regressions)
  • ✅ Build and lint successful
  • ✅ Production build successful

Before & After

Before (❌ Bug):

// Input: "info 1 error responses loaded from /path/v0.29.1/file.json"
extractVersionFromOutput(input) // Returns "0.29.1" - FALSE POSITIVE!

After (✅ Fixed):

// Input: "info 1 error responses loaded from /path/v0.29.1/file.json"  
extractVersionFromOutput(input) // Returns "" - No false notification

// Input: "info 1 error responses...\ninfo v0.29.1"
extractVersionFromOutput(input) // Returns "0.29.1" - Correct notification

Impact

Users will no longer see misleading upgrade notifications when they already have the latest version. The toolkit now correctly distinguishes between version numbers in file paths versus actual update availability notifications.

Fixes #286.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits June 27, 2025 09:00
…version from file paths

Co-authored-by: garrytrinder <11563347+garrytrinder@users.noreply.github.com>
- Update extractVersionFromOutput to skip file paths and only extract versions from actual update notification lines
- Add comprehensive tests for issue #286 scenarios including Windows paths
- Preserve existing functionality for all current test cases

Co-authored-by: garrytrinder <11563347+garrytrinder@users.noreply.github.com>
Copilot AI changed the title [WIP] Dev Proxy Toolkit shows false upgrade notification when no updates available Fix false upgrade notifications when latest Dev Proxy version is already installed Jun 27, 2025
Copilot AI requested a review from garrytrinder June 27, 2025 09:05
@garrytrinder garrytrinder marked this pull request as ready for review June 27, 2025 09:25
@garrytrinder garrytrinder marked this pull request as draft June 27, 2025 09:29
Co-authored-by: garrytrinder <11563347+garrytrinder@users.noreply.github.com>
Copilot AI requested a review from garrytrinder June 27, 2025 09:33
@garrytrinder garrytrinder marked this pull request as ready for review June 27, 2025 09:43
@garrytrinder garrytrinder merged commit 83fb835 into main Jun 27, 2025
3 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.

Dev Proxy Toolkit shows false upgrade notification when no updates available

2 participants