Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
f9a51a0
fix(scripts): resolve editable file:// URLs with url2pathname
SanHsien Sep 6, 2026
7f0cba5
fix(scripts): preserve file URL authority semantics
mohgupta-ship-it Sep 6, 2026
1c0a099
fix(scripts): avoid file URL normalization drift
mohgupta-ship-it Sep 6, 2026
e853d00
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 6, 2026
44beabd
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 7, 2026
65c0c0e
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 9, 2026
cfe2d7c
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 9, 2026
ea42d8e
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 12, 2026
1a12ad0
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 12, 2026
0d44bad
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 12, 2026
e3b5b16
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 12, 2026
41bdc15
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 12, 2026
c49dfc0
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 12, 2026
0c84b0b
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 12, 2026
ce56485
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 14, 2026
a03d4a1
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 14, 2026
1c641b5
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 15, 2026
b5dd31c
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 15, 2026
b9f764c
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
df4e447
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
e5ac4db
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
922eb39
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
95e53e0
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
146ac44
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
94a4506
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
41f06f7
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
4fef64d
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
ba5ee73
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
3a5f6f6
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
0dd5494
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
3811f88
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
c5ae116
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
f22e8d2
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
8ee0a4c
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
a14d1e0
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
f97cfd0
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
380665b
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 16, 2026
f4f9927
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 17, 2026
4ee6696
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 17, 2026
5c5ddca
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 17, 2026
457f945
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 17, 2026
a1f7a9f
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 18, 2026
7ba28be
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 18, 2026
dec5ec8
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 18, 2026
eec5180
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 18, 2026
bde7f3b
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 18, 2026
646ec62
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 18, 2026
5baa9e9
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 21, 2026
4c7c752
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 21, 2026
d9880b8
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 21, 2026
f9228e8
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 21, 2026
3bd1689
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 21, 2026
ca411e9
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 21, 2026
a541527
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 21, 2026
a9f8c13
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 22, 2026
dfcc71f
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 22, 2026
51a967a
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 22, 2026
27b7e05
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 22, 2026
f06818c
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 22, 2026
e93ea01
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 23, 2026
d18a99f
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 23, 2026
631b35c
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 23, 2026
c2a44b9
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 23, 2026
2bc1c7e
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 23, 2026
cdc4e9f
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 23, 2026
2befa9e
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 23, 2026
e9a49a4
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 23, 2026
0fc64f7
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 23, 2026
f9a4bb9
Merge branch 'main' into codex/fix-editable-file-url-conversion
github-actions[bot] Sep 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scripts/compare_scan_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import platform
import sys
import urllib.parse
import urllib.request
from pathlib import Path

MAX_DEPENDENCY_FILES = 200_000
Expand Down Expand Up @@ -178,7 +179,13 @@ def hash_file(digest, label, path):
parsed = urllib.parse.urlsplit(raw_url)
if parsed.scheme != "file" or parsed.netloc not in {"", "localhost"}:
raise RuntimeError(f"editable dependency is not a local file target: {normalized_name}")
editable_root = Path(urllib.parse.unquote(parsed.path)).resolve(strict=True)
# url2pathname needs the empty-authority delimiter for paths beginning
# with "//". Build it explicitly because urlunsplit() normalizes this
# form differently across Python patch releases.
converter_input = parsed.path
if not parsed.netloc and converter_input.startswith("//"):

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.

[P2] Preserve localhost double-leading paths

The accepted URL file://localhost//path reaches this branch with parsed.netloc == "localhost" and parsed.path == "//path", so the delimiter is not restored. On Python 3.14, url2pathname reparses that input as file://path (authority path); POSIX then raises URLError instead of resolving the local //path. The repository supports Python 3.14. Restore the delimiter for this accepted localhost form as well and add a regression that exercises the real adapter rather than only mocking its argument.

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.

I checked this on the latest commit and can still reproduce the issue on Python 3.14: file://localhost//tmp/dep raises URLError instead of resolving the local path. Could we preserve // for localhost URLs too and add a regression test using the real converter?

converter_input = f"//{converter_input}"
editable_root = Path(urllib.request.url2pathname(converter_input)).resolve(strict=True)
if not editable_root.is_dir():
raise RuntimeError(f"editable dependency target is not a directory: {normalized_name}")
for editable_path in sorted(editable_root.rglob("*")):
Expand Down
58 changes: 58 additions & 0 deletions tests/unit/test_compare_scan_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import subprocess
import sys
import tarfile
import urllib.request
from collections.abc import Iterator
from contextlib import contextmanager, redirect_stdout
from pathlib import Path
Expand Down Expand Up @@ -1116,6 +1117,63 @@ def probe() -> dict[str, object]:
assert editable_changed["dependencies"] != original["dependencies"]


@pytest.mark.parametrize(
("editable_url", "expected_converter_input"),
[
("file:///C:/PortableRegressionProbe", "/C:/PortableRegressionProbe"),
("file:////portable-regression-probe", "////portable-regression-probe"),
],
ids=["windows_drive", "empty_authority"],
)
def test_runtime_probe_preserves_file_url_structure_for_path_conversion(
tmp_path: Path,
monkeypatch,
editable_url: str,
expected_converter_input: str,
) -> None:
installed_root = tmp_path / "site-packages"
installed_root.mkdir()
(installed_root / "dependency.py").write_text("VALUE = 1\n", encoding="utf-8")
editable_root = tmp_path / "editable-dependency"
editable_root.mkdir()
(editable_root / "source.py").write_text("VALUE = 2\n", encoding="utf-8")

class FakeDistribution:
metadata = {"Name": "example-dependency"}
version = "1.0"
files = ["dependency.py"]

def read_text(self, name: str) -> str | None:
if name == "RECORD":
return "dependency.py,,\n"
if name == "METADATA":
return "Name: example-dependency\nVersion: 1.0\n"
if name == "direct_url.json":
return json.dumps({"url": editable_url, "dir_info": {"editable": True}})
return None

def locate_file(self, package_path: object) -> Path:
return installed_root / str(package_path)

monkeypatch.setattr(importlib.metadata, "distributions", lambda: [FakeDistribution()])
converter_inputs: list[str] = []

def fake_url2pathname(value: str) -> str:
converter_inputs.append(value)
return str(editable_root)

monkeypatch.setattr(urllib.request, "url2pathname", fake_url2pathname)
rendered = io.StringIO()
with redirect_stdout(rendered):
exec(compare_scan_accuracy._RUNTIME_IDENTITY_PROBE, {})

payload = json.loads(rendered.getvalue())
dependency = payload["dependencies"][0]
assert converter_inputs == [expected_converter_input]
assert dependency["editable"] is True
assert dependency["editable_file_count"] == 1


@pytest.mark.parametrize(
("mutation", "message"),
[
Expand Down