Skip to content

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

Description

@SanHsien

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)

Activity

  1. MohammedAlkindi commented on Sep 10, 2026

    @MohammedAlkindi
    Contributor

    #486 and #490 clear the same single failure here, measured on Windows 11.

    tests/unit/test_compare_scan_accuracy.py on main 69dcdfb is 4 failed, 25 passed. With either PR applied it is 3 failed, and the one each clears is test_runtime_probe_hashes_installed_and_editable_dependency_bytes in both cases.

    The visible difference is coverage rather than behaviour on this platform: #490 reports 28 passed against #486's 26, because #490 adds two tests of its own.

    What I could not evaluate: #490 also says it preserves the empty-authority delimiter so valid POSIX double-slash paths survive. That is not observable from a Windows box, and it is the one place the two could actually differ, so it looks worth checking before picking between them.

    The other three failures in that file are unrelated to both and reproduce on main.

  2. rng1995 commented on Sep 16, 2026

    @rng1995
    Collaborator

    Implementation is in progress in PR #490, which converts editable file:// dependency URLs without duplicating the Windows drive prefix. Keeping this issue open until the PR merges and the Windows regression is verified.

  3. SanHsien commented on Sep 17, 2026

    @SanHsien
    Author

    Thanks for the update. That sounds good to me.
    I’ll leave #485 open while #490 lands and the Windows regression is verified. Thanks for carrying the fix forward.

  4. rng1995 commented on Oct 4, 2026

    @rng1995
    Collaborator

    Updated implementation links: PR #490 remains open for portable editable-dependency file-URL conversion. The open PR #636 also proposes Windows file-URL normalization alongside other Windows compatibility fixes. Neither has merged; the older PR #486 is closed unmerged. Keeping this issue open until an accepted fix lands.

    PR-state snapshot checked on 2026-10-04:

    • PR #490 — open, non-draft; GitHub review decision: changes requested.
    • PR #636 — open, non-draft; GitHub review decision: changes requested; latest reported check rollup: failure.

    Keeping this issue open: the relevant implementation is not merged. Check/review status is a point-in-time snapshot, not a claim of merge readiness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions