The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(pm): union sync must install member deps — add --all-packages
ethernetef5a98ed5713
diff --git a/pm/workspace.py b/pm/workspace.pyindex b20bdb033d8..b26cb8a0416 100644--- a/pm/workspace.py+++ b/pm/workspace.py@@ -297,7 +297,14 @@ def lock_and_sync(if lock.returncode != 0:raise InstallError("venv", f"uv lock exited {lock.returncode}: {lock.stderr[-600:]}")- cmd = [uv_bin, "sync", "--frozen"]+ # --all-packages is REQUIRED: plain `uv sync --frozen` installs only the+ # ROOT project's deps — workspace-member deps are locked by `uv lock`+ # but silently never reach site-packages (probed live 2026-09-03: a+ # member's pyfiglet stayed absent from site-packages under plain+ # --frozen, present under --all-packages). The union's whole contract+ # is that plugin deps ride the venv; without this flag every member+ # install is a silent no-op.+ cmd = [uv_bin, "sync", "--frozen", "--all-packages"]for extra in sorted(set(extras or [])):cmd += ["--extra", extra]sync = subprocess.run(cmd, cwd=str(root), env=env, capture_output=True, text=True)@@ -372,7 +379,14 @@ def _default_venv_dir() -> Path:def _uv_binary() -> Optional[str]:+ """Store uv first (pinned), PATH uv second (dev machines, test envs).+ A dev machine with uv on PATH but no provisioned store is the normal+ pre-`pm install` state — 'uv is not installed' there is a lie."""from pm.ensure import uv as pm_uvuv_bin, _env = pm_uv(realize=False)- return uv_bin+ if uv_bin:+ return uv_bin+ import shutil++ return shutil.which("uv")diff --git a/tests/pm/test_union_installs_members.py b/tests/pm/test_union_installs_members.pynew file mode 100644index 00000000000..9d98c60f265--- /dev/null+++ b/tests/pm/test_union_installs_members.py@@ -0,0 +1,101 @@+"""E2E: the workspace union must INSTALL member deps, not just lock them.++Probed live 2026-09-03: plain `uv sync --frozen` installs only the ROOT+project's dependencies — workspace-member deps are locked by `uv lock`+but never reach site-packages. The union's whole contract is that plugin+deps ride the venv, so lock_and_sync must pass --all-packages. This test+builds a REAL mini-workspace and asserts the member's dep is importable+after lock_and_sync — the exact failure the probe caught (green-looking+lock, empty site-packages) can never silently return.+"""++from __future__ import annotations++import sys+from pathlib import Path++import pytest++import pm.workspace as ws+++def _uv_available() -> bool:+ import shutil++ return shutil.which("uv") is not None+++def mini_workspace(tmp_path, monkeypatch):+ """A real generated workspace: fake core pyproject + a plugin member+ whose dep (pyfiglet) is NOT a root dep. Store paths pointed at tmp."""+ core = tmp_path / "core"+ core.mkdir()+ (core / "pyproject.toml").write_text(+ "[project]\n"+ 'name = "fake-core"\n'+ 'version = "0.1.0"\n'+ 'requires-python = ">=3.11"\n'+ 'dependencies = []\n',+ encoding="utf-8",+ )+ plug = tmp_path / "plugins" / "member-plug"+ plug.mkdir(parents=True)+ (plug / "pyproject.toml").write_text(+ "[project]\n"+ 'name = "member-plug"\n'+ 'version = "0.1.0"\n'+ 'requires-python = ">=3.11"\n'+ 'dependencies = ["pyfiglet==1.0.2"]\n',+ encoding="utf-8",+ )+ store = tmp_path / "store"+ store.mkdir()+ venv = tmp_path / "venv"++ import pm.paths++ monkeypatch.setattr(pm.paths, "repo_root", lambda: core)+ monkeypatch.setattr(pm.paths, "store_root", lambda: store)+ monkeypatch.setattr(ws.paths, "repo_root", lambda: core)+ monkeypatch.setattr(ws.paths, "store_root", lambda: store)+ return tmp_path, plug, venv++[email protected](_uv_available() is False, reason="uv not on PATH")+def test_lock_and_sync_installs_member_deps(mini_workspace):+ """The probe scenario: after lock_and_sync, the member's dep MUST be+ importable from the synced venv. Under plain `uv sync --frozen` the+ lock contains the dep but site-packages does not — this fails."""+ _, plug, venv = mini_workspace+ ws.lock_and_sync([plug], [], venv_dir=venv)++ site = venv / "Lib" if (venv / "Lib").exists() else venv / "lib"+ packages = sorted(p.name for p in site.glob("*site-packages"))+ assert packages, "no site-packages in the synced venv"+ sp = site / packages[0]++ # the member's dep landed (this is the --all-packages contract)+ assert (sp / "pyfiglet").is_dir() or any(+ p.name.startswith("pyfiglet") for p in sp.iterdir()+ ), (+ "member dep locked but NOT installed — lock_and_sync must pass "+ "--all-packages (plain `uv sync --frozen` is root-only)"+ )++[email protected](_uv_available() is False, reason="uv not on PATH")+def test_union_survives_a_resync(mini_workspace):+ """The prune-proof contract: a second lock_and_sync (what an update+ rebuild does) must NOT remove the member's deps — they are in the+ union lock, not pip-guests."""+ _, plug, venv = mini_workspace+ ws.lock_and_sync([plug], [], venv_dir=venv)+ ws.lock_and_sync([plug], [], venv_dir=venv)++ site = venv / "Lib" if (venv / "Lib").exists() else venv / "lib"+ sp = site / next(iter(sorted(p.name for p in site.glob("*site-packages"))))+ assert any(p.name.startswith("pyfiglet") for p in sp.iterdir()), (+ "member deps were stripped by a re-sync — the union lock must own "+ "them across rebuilds"+ )