fix(paths): recognize Windows absolute paths (drive-letter/UNC) in parse_uri - #304
Open
Dan Shapiro (danshapiro) wants to merge 1 commit into
Open
fix(paths): recognize Windows absolute paths (drive-letter/UNC) in parse_uri#304Dan Shapiro (danshapiro) wants to merge 1 commit into
Dan Shapiro (danshapiro) wants to merge 1 commit into
Conversation
…rse_uri C:/..., C:\..., and \\server\share\... URIs previously fell through to the package-name heuristic, so no source handler claimed them and resolution failed with 'No handler for URI' on native Windows. This surfaced when settings.yaml referenced local behaviors/bundles via Windows paths, and when relative module entries inside cached bundles were resolved to absolute OS path strings (strict mode then aborted session startup). Fixes microsoft/amplifier#374
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.
Problem
On native Windows,
parse_uriclassified onlyfile://URLs, POSIX absolute paths (/...), and.//../relative paths as file URIs. Windows absolute paths (C:\...,C:/...) and UNC paths (\\server\share\...) fell through to the package-name heuristic, so no source handler claimed them:Two real-world impacts (reproduced on Windows 11, native PowerShell, amplifier 2026.08.14):
settings.yaml(e.g.bundle.app: [C:/Users/dan/code/bundle-the-usual/behaviors/the-usual.yaml]) fail to compose:Failed to compose behavior ....AMPLIFIER_ALLOW_PARTIAL_BUNDLE=1).Fix
In
parse_uri, recognize drive-letter (``:followed by` or `/`) and UNC (`\`) prefixes as `scheme="file"`, before the package-name fallback. Unconditional (not `os.name`-gated): on POSIX these inputs were previously misclassified as package names too — the file handler now at least reports an accurate `File not found`.Tests
Added 4 tests to
tests/test_paths.py(drive-letter forward/backslash, UNC,file://C:/...). Local run: 56 passed; the 5 failingTestNormalizePathtests fail identically on unmodified main (pre-existing POSIX-only assertions on a Windows test box, unrelated to this change).ruff checkandruff format --checkclean.Fixes microsoft/amplifier#374