Skip to content

fix(scripts): convert editable file URLs portably - #490

Open
mohgupta-ship-it wants to merge 11 commits into
mainfrom
codex/fix-editable-file-url-conversion
Open

fix(scripts): convert editable file URLs portably#490
mohgupta-ship-it wants to merge 11 commits into
mainfrom
codex/fix-editable-file-url-conversion

Conversation

@mohgupta-ship-it

Copy link
Copy Markdown
Member

Summary

  • Convert editable-install file URLs with the standard platform path adapter.
  • Preserve the empty-authority delimiter so valid POSIX double-slash paths remain local on Python 3.14 while Windows drive URLs lose their extra leading slash.
  • Add portable regression coverage for both URL shapes.

This builds on #486 and preserves the original author attribution while closing the compatibility gap found during validation.

Fixes #485

Validation

  • make lint
  • make format-check
  • ruff check scripts/compare_scan_accuracy.py
  • Targeted path-conversion tests: 3 passed
  • Full Python 3.12 suite: 3,980 passed, 14 skipped, 4 xfailed
  • Python 3.14 standard-library conversion probe for empty-authority double-slash paths

Submitted by Codex on behalf of Mohit Gupta.

SanHsien and others added 3 commits September 6, 2026 17:24
A Windows file URL's path is "/C:/Users/...". Path() reads the leading
slash as a root, so unquote() produced "C:\C:\Users\..." and the
following resolve(strict=True) raised WinError 123. url2pathname is the
stdlib conversion for this and is identical to the old behavior on POSIX,
where the path has no drive letter to double.

test_runtime_probe_hashes_installed_and_editable_dependency_bytes already
covers this; it just never runs on a Windows host in CI. On Windows 11 /
Python 3.13 it fails before this change and passes after.

Fixes #485

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: SanHsien <34234698+SanHsien@users.noreply.github.com>
Keep empty-authority delimiters intact for POSIX double-slash paths while retaining correct Windows drive conversion.

Prepared by Codex on behalf of Mohit Gupta.

Signed-off-by: Mohit Gupta <mohgupta@nvidia.com>
Construct the empty-authority delimiter explicitly so Python patch releases feed the same path shape to url2pathname.

Prepared by Codex on behalf of Mohit Gupta.

Signed-off-by: Mohit Gupta <mohgupta@nvidia.com>
SanHsien added a commit to SanHsien/SkillSpector that referenced this pull request Sep 11, 2026
…VIDIA#524

Raise reviewed_pr_through to 527 and reviewed_issue_through to 524 in
tools/upstream_baseline.json (commit axis unchanged at 69dcdfb). Every
item gets a verdict in docs/DECISIONS.md: NVIDIA#493/NVIDIA#507/NVIDIA#508/NVIDIA#511 verified
via git merge-base --is-ancestor as already included through the
2.11.1/2.11.2 sync (including NVIDIA#521, which merged only into the still-
open NVIDIA#516 stack, not main); the remaining 27 items stay "wait for
upstream merge", none adopted now.

Two items get dedicated comparison notes per docs/DIVERGENCE.md's
static_runner.py and scripts/compare_scan_accuracy.py rows: NVIDIA#522 uses a
different env var name and different default/semantics than this
fork's SKILLSPECTOR_MAX_STATIC_SECONDS, so merging it cannot simply
delete the divergence row and needs a downstream env var migration
first; NVIDIA#490 extends this fork's own upstream PR NVIDIA#486 with a Python
3.14/POSIX edge case the fork's Windows environment does not hit, so
NVIDIA#486 is left untouched pending upstream's own resolution. NVIDIA#501-NVIDIA#505 and
NVIDIA#518 are also flagged as near-verbatim matches to this fork's existing
Windows test divergence rows, worth revisiting for row deletion once
merged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: SanHsien <34234698+SanHsien@users.noreply.github.com>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SkillSpector Review]

Changes requested at head ea42d8e0e0ca2fabf049345b3856fa166a3792d5.

  • scripts/compare_scan_accuracy.py:187: for an empty-authority URL whose parsed path begins with exactly //, the new branch prepends two more slashes. On supported pre-3.14 POSIX Python, url2pathname leaves those four slashes unchanged and Path.resolve() collapses them to a single root slash, losing the implementation-defined exactly-two-leading-slash path that was parsed. The test mocks url2pathname and asserts only its input, so it cannot catch the resulting path corruption. Use a version-independent conversion that preserves the parsed local path semantics on both POSIX and Windows, and test the actual converted/resolved result across supported Python versions rather than only a mocked argument.

No checks are reported and GitHub reports merge state BLOCKED; the code issue and missing required CI both block merge. This PR appears to supersede #486, so avoid landing both versions of the same fix.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants