compare_scan_accuracy: editable-dependency file:// URL resolves to "C:\C:\..." on Windows

Author: SanHsienCreated Sep 6, 2026Updated Sep 17, 2026

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:

python
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:

python
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)