fix: recognize Windows drive-letter absolute paths as local paths in DependencyReference#435
Merged
danielmeppiel merged 4 commits intomainfrom Mar 24, 2026
Merged
Conversation
…reference.py Co-authored-by: danielmeppiel <51440732+danielmeppiel@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/apm/sessions/9f97de46-d7db-4624-8633-30fdefbcf106
Copilot
AI
changed the title
[WIP] Fix CI/CD pipeline issues on Windows runner
fix: recognize Windows drive-letter absolute paths as local paths in DependencyReference
Mar 24, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Windows CI failures by ensuring DependencyReference.is_local_path() recognizes Windows drive-letter absolute paths so they are treated as local dependencies (instead of falling into remote repo validation).
Changes:
- Extend
DependencyReference.is_local_path()to detectX:\...andX:/...patterns. - Add unit tests covering drive-letter absolute paths with both separators and letter casing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/apm_cli/models/dependency/reference.py |
Updates local-path detection to include Windows drive-letter absolute paths. |
tests/unit/test_local_deps.py |
Adds regression tests for Windows absolute path detection. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
is_local_path()didn't handle Windows absolute paths with drive letters (C:\...,D:/...), causing Windows CI to raiseValueError: Use 'user/repo'...for anytmp_path-based local path before local validation logic could run.Description
DependencyReference.is_local_path()checked for./,../,/,~\,.\,..\prefixes but missed the Windows absolute path patternX:\/X:/. On Windows, pytest'stmp_pathproduces paths likeC:\Users\RUNNER\AppData\...which fell through to remote repo format validation and raisedValueError.Fix — one additional guard in
is_local_path():Safe on Linux/macOS: Unix paths start with
/, anduser/reposhorthand never has:at index 1.Type of change
Testing
4 new tests added to
TestIsLocalPath: backslash separator, forward-slash separator, uppercase drive letter, lowercase drive letter.Original prompt
Problem
The CI/CD Pipeline on the
mainbranch is failing on the Windows runner with 4 test failures intests/unit/test_install_command.py::TestLocalPathValidationMessages:test_local_path_failure_reason_nonexistenttest_local_path_failure_reason_file_not_dirtest_local_path_failure_reason_no_markerstest_local_path_failure_reason_valid_apm_ymlAll fail with the same error:
The error originates from
src/apm_cli/models/dependency/reference.pyline 703.Context
\vs forward slashes/, drive letter prefixes likeC:\, etc.).reference.pyis incorrectly interpreting these Windows-style paths as remote repository references and raising aValueErrorbefore the local path validation logic gets a chance to run.What to Fix
src/apm_cli/models/dependency/reference.pyaround line 703 and the logic that determines whether an input string is a local path vs a remote repo reference.tests/unit/test_install_command.py::TestLocalPathValidationMessagesto understand what inputs they provide and what behavior they expect.Latest Failing Run
.github/workflows/build-release.ymlThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: Fix CI on main branch in APM
Assistant:
I'd like to help you fix the CI on the main branch, but I need a bit more clarification:
Could you please provide the full repository name (in
owner/repoformat) for "APM"? For example, is it something likeyour-org/APMordanielmeppiel/APM?User: Microsoft/apm
Assistant:
Let me start by investigating the current CI failures on the main branch of the repository.
Assistant: Let me look at the most recent CI/CD Pipeline failure to understand what's going wrong.
Assistant: I found the issue. The most recent CI/CD Pipeline run (#23474188874) on
mainis failing with 4 test failures — all in the same test class. Here's the summary:Failing Tests
All 4 failures are in
tests/unit/test_install_command.py::TestLocalPathValidationMessages:test_local_path_failure_reason_nonexistentValueError: Use 'user/repo' or 'github.com/user/repo' or 'dev.azure.com/org/project/repo' formattest_local_path_failure_reason_file_not_dirValueErrortest_local_path_failure_reason_no_markersValueErrortest_local_path_failure_reason_valid_apm_ymlValueErrorRoot Cause
The error originates from
src/apm_cli/models/dependency/reference.py(line 703). It appears that the code path for parsing a dependency reference is raising aValueError(expecting auser/repoformat) before the local path validation logic gets a chance to run. The tests expect local path-specific failure messages, but instead the input is being interpreted as a remote repo reference and rejected.This is likely a regression where the input parsing order was changed — remote repo format validation now runs before local path checks.
Would you like me to create a PR to fix this?
I can open a pull request that investigates
reference.pyand the failing tests, and fixes the parsing logic so local paths are properly validated before the remote repo format check kicks in. Just confirm and I'll get started!User: Yes, consider that this happens only on Windows runner and we were fixing stuff around paths on previous PRs
Assistant: I've kicked off the Copilot coding agent to create a PR that fixes the Windows path parsing regression in
Microsoft/apm. It will:src/apm_cli/models/dependency/reference.pyaround line 703TestLocalPathValidationMessagestests to understand expected behaviorC:\) are correctly recognized as local paths before the remote repo format check runsThis pull request was created from Copilot chat.
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.