compare_scan_accuracy: editable-dependency file:// URL resolves to "C:\C:\..." on Windows
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 1.5k
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 66
Description
Summary
The runtime identity probe in scripts/compare_scan_accuracy.py converts an editable dependency's direct_url.json file:// URL to a local path with Path(urllib.parse.unquote(parsed.path)). On Windows that produces a doubled drive letter and the subsequent resolve(strict=True) raises.
Where
scripts/compare_scan_accuracy.py, inside _RUNTIME_IDENTITY_PROBE:
editable_root = Path(urllib.parse.unquote(parsed.path)).resolve(strict=True)
Why it breaks
A Windows file:// URL is file:///C:/Users/.../pkg, so urlsplit(...).path is /C:/Users/.../pkg — with a leading slash. Path() reads that slash as a root, so the result is C:\C:\Users\...\pkg:
>>> from urllib.parse import urlsplit, unquote
>>> from pathlib import Path
>>> Path(unquote(urlsplit("file:///C:/Users/me/pkg").path))
WindowsPath('/C:/Users/me/pkg') # -> resolves against the cwd drive as C:\C:\Users\me\pkg
resolve(strict=True) then raises:
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect:
'C:\C:\Users\...\editable-dependency'
On POSIX the two are identical (/tmp/pkg either way), which is why CI does not see it.
Reproduction
On Windows, with the repo installed as an editable dependency:
uv run pytest tests/unit/test_compare_scan_accuracy.py::test_runtime_probe_hashes_installed_and_editable_dependency_bytes
Fails with the WinError 123 above. This is your existing test, unmodified — it already covers the bug, it just never runs on a Windows host in CI.
Suggested fix
urllib.request.url2pathname is the stdlib function for this conversion and is correct on both platforms:
editable_root = Path(urllib.request.url2pathname(parsed.path)).resolve(strict=True)
Verified on Windows 11 / Python 3.13: the test above goes from failing to passing with that one-line change, and ruff check / ruff format --check stay clean. Happy to open a PR.
Environment
- Windows 11, native (not WSL)
- Python 3.13.14, uv 0.12.8
- SkillSpector 2.11.0 (
7805bb9)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in scripts/compare_scan_accuracy.py at _RUNTIME_IDENTITY_PROBE and inspect how the parsed file:// path is converted before resolve(strict=True). Run tests/unit/test_compare_scan_accuracy.py::test_runtime_probe_hashes_installed_and_editable_dependency_bytes on Windows; done means the editable-dependency test passes without the doubled drive-letter error and ruff checks remain clean.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100