Skip to content

The agent that grows with you

fix(pm): core-only installs on mirrors without upload times work again

Teknium9f63a6fe5cfe
diff --git a/pm/workspace.py b/pm/workspace.py
index b893c19583c..cffff0ce461 100644
--- a/pm/workspace.py
+++ b/pm/workspace.py
@@ -133,13 +133,27 @@ def _generate_pyproject(plugin_dirs: list[Path] | Mapping[Path, Path], root: Pat
document.setdefault("tool", {}).setdefault("uv", {})["workspace"] = {"members": sorted(members)}
text = tomli_w.dumps(document)
else:
- # Byte-identical to core: a member-less generation syncs frozen against core's own lock.
+ # A member-less generation syncs frozen against core's own lock.
text = core_text.rstrip("\n") + "\n"
target = root / "pyproject.toml"
+ text = _without_release_age(text)
_copy_core_inputs(source, root)
target.write_text(text, encoding="utf-8")
+def _without_release_age(text: str) -> str:
+ """Drop ``[tool.uv] exclude-newer`` from a generated root's pyproject text.
+
+ The lock already holds checked versions; on the user's machine the cutoff only gates the
+ build tools uv fetches for source builds (setuptools for Hermes itself), and a mirror that
+ serves no upload times rejects all of them (#135589). Text-level so the pre-3.11 bootstrap
+ python, which has no tomllib, can run it.
+ """
+ import re
+
+ return re.sub(r"(?m)^exclude-newer\s*=.*\n", "", text)
+
+
def _trust_core_lock(document: dict, core_lock: Path) -> None:
"""Hold core's packages at the versions core's lock already vetted.
@@ -377,6 +391,9 @@ def lock_and_sync(
# snapshotted members and their exact lock travel with the workspace.
# Use the snapshot's exclusions: build/ may hold an in-tree backend.
shutil.copytree(replay, root, symlinks=True, ignore=_member_ignored)
+ # A generation recorded before the cutoff left the user's machine still carries it.
+ manifest = root / "pyproject.toml"
+ manifest.write_text(_without_release_age(manifest.read_text(encoding="utf-8-sig")), encoding="utf-8")
frozen = True
environment.sync(root, extras=extras, frozen=frozen)
diff --git a/tests/pm/test_workspace.py b/tests/pm/test_workspace.py
index 0e4d0b17bd3..00e69797bf3 100644
--- a/tests/pm/test_workspace.py
+++ b/tests/pm/test_workspace.py
@@ -105,6 +105,18 @@ def test_classify_network_failure_stays_generic():
assert not isinstance(err, ResolutionConflict)
+def test_core_only_generation_carries_no_release_age_cutoff(layout):
+ """A core-only install (hermes update) is a frozen sync: the cutoff there only gates the build
+ tools uv fetches, and a mirror without upload times rejects every one of them (#135589)."""
+ tmp, core, _, _ = layout
+ manifest = core / "pyproject.toml"
+ manifest.write_text(manifest.read_text().replace("[tool.uv]\n", '[tool.uv]\nexclude-newer = "3 days"\n', 1))
+ root = tmp / "workspace"
+ ws._generate_pyproject([], root, source=core)
+ generated = (root / "pyproject.toml").read_text(encoding="utf-8")
+ assert "exclude-newer" not in generated and "[tool.uv]" in generated
+
+
def test_undated_index_failure_names_the_index_not_a_conflict():
"""uv's "has no publish time" is the index omitting upload times (#135589), not a conflict."""
from pm.workspace import ResolutionConflict, classify_uv_failure