Activation reaches plugin discovery before the application dependencies exist. Give PM its own locked Python project and runtime so it can install or repair the application without importing that dependency tree. Keep PM outside the application workspace. A shared uv workspace resolves the application graph and cannot provide this isolation. Route mutations through an isolated worker and preserve transaction callbacks, cancellation, custom package registrations, and correlated receipts. Use the same runtime builder for source installs and packaged payloads. Keep offline wheelhouse support in that builder. Nix builds the independent PM lock as a separate derivation. Refuse lazy-disabled bootstrap before installing tools or dependencies. Move first-party YAML readers and writers to ruamel. Keep the application lock's transitive PyYAML requirements for third-party packages. Verification: - Focused canonical Python suite: 177 passed, 1 host-gated skip. - Electron backend probes: 12 passed. Electron typecheck passed. - Both uv locks, scoped lint, Bash syntax, and whitespace checks passed. - Cold activation, corrupt-app repair, offline staging, and relocation ran. - Built and exercised the Nix PM runtime and standalone YAML merge script. Six broader caller test files retain the same 24 failing test IDs as an archive of HEAD. The existing real-home guard blocks those tests before they can exercise the affected paths. No full-suite pass is claimed. Native Windows signing and full Bionic package execution remain unverified.
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
"""Installed runtime lookup uses the same shipped/addition precedence as ensure."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pm
|
|
from pm import paths
|
|
from pm.ensure import ensure
|
|
from pm.lock import Lockfile
|
|
from tests.pm.test_pm_authority import pm_env, served # noqa: F401
|
|
|
|
|
|
def test_installed_lookup_prefers_current_pin_then_recorded_fallback(pm_env, tmp_path, monkeypatch):
|
|
ensure("faketool", explicit=True)
|
|
original = pm.installed_package("faketool")
|
|
assert original is not None and original.binary.is_file()
|
|
|
|
lock = Lockfile(pm_env["lockfile_path"])
|
|
lock.set_pin("faketool", "2.0", {"any": {
|
|
"url": pm_env["base_url"] + "/faketool-2.0.tar.gz", "sha256": "b" * 64,
|
|
}})
|
|
lock.save()
|
|
assert pm.installed_package("faketool") is None
|
|
assert pm.installed_package("faketool", allow_outdated=True) == original
|
|
|
|
shipped = tmp_path / "sealed" / "tools"
|
|
shipped.mkdir(parents=True)
|
|
monkeypatch.setattr(paths, "store_root", lambda: shipped)
|
|
monkeypatch.setattr(paths, "writable_store_root", lambda: pm_env["runtime"])
|
|
assert pm.installed_package("faketool", allow_outdated=True) == original
|
|
original.binary.unlink()
|
|
assert pm.installed_package("faketool", allow_outdated=True) is None
|