[BUG] incompatible immutable dependency refs are silently collapsed
Describe the bug
APM silently collapses incompatible immutable dependency refs for the same package identity.
A consumer declares both:
- a direct dependency on
shared-package#v1, and parent-package#v1, which transitively requiresshared-package#v2.
Both refs are immutable. APM installs and locks only shared-package#v1, emits no conflict warning or error, and accepts the resulting graph in frozen mode. The installed parent therefore receives a different immutable version than its manifest requires.
To Reproduce
- Create
shared-packagetagsv1andv2. - Create
parent-package#v1with a dependency onshared-package#v2. - Create a consumer with direct dependencies on
shared-package#v1andparent-package#v1. - Run a normal install.
- Inspect the lockfile and installed packages: only
shared-package#v1is present. - Run the equivalent frozen install. It succeeds without reporting the incompatible transitive requirement.
Expected behavior
Different immutable refs for one package identity should either:
- fail resolution with a clear conflict listing the parents and requested refs, or
- install isolated versions when the deployment model supports that safely.
Frozen replay should not accept a graph in which an immutable transitive requirement was replaced by a different ref.
Environment (please complete the following information):
- OS: macOS
- Python Version: 3.14.7
- APM Version: 0.31.0 installed with Homebrew
- VSCode Version (if relevant): Not applicable
Logs
No warning or error is emitted. The lockfile contains only the directly pinned immutable ref.
Thanks for the clear reproduction on APM 0.31.0. A consumer that pins shared-package#v1 while a parent requires shared-package#v2 should not install as if those refs were interchangeable.
What appears to happen today: resolution keys packages by identity (repo, not ref) and applies first-wins flattening. The lockfile then records only the winning immutable ref. apm install --frozen is a structural replay of that lock, so it can succeed even though a required immutable constraint was dropped. That contradicts the documented lockfile contract (deterministic install from apm.lock.yaml) and OpenAPM req-rs-001 empty-intersection fail-closed (silent first-wins MUST NOT be substituted). Isolated or nested parallel versions are reserved for later (conflict_resolution: nest is not a v0.1 install path).
Advisory recommendation: treat this as a bounded resolver bug. Fail install when incompatible immutable refs for one package identity appear in the graph, name both parent chains in the error, and refuse frozen replay of a collapsed lock. Do not implement nested side-by-side versions as part of this issue.
This is advisory only. A responsible maintainer still needs to record scope, done-when, and a review contact before anyone implements it. Please do not open a PR against this issue until that record exists.
If you have a lockfile snippet from the repro, posting it here would help a maintainer confirm the collapsed key without re-running the fixture.
Generated by autopilot-issue-triage-worker. This comment is AI-generated and may contain errors.
Retested with Homebrew APM 0.31.0 in an isolated HOME. The result still reproduces.
The consumer directly pins:
- git: https://github.com/Adjust/agent-skills
path: skills/preview-markdown
ref: v0.3.0
- git: https://github.com/Adjust/agent-skills
path: skills/inspect-app
ref: inspect-app-v0.4.10
The materialized inspect-app manifest requires the incompatible immutable ref:
dependencies:
apm:
- adjust/agent-skills/skills/preview-markdown#preview-markdown-v0.4.7
Resolution reports the transitive edge:
Resolved dependency tree: 2 direct + 1 transitive deps (max depth 2)
agent-skills-inspect-app > agent-skills-preview-markdown
But the relevant lockfile entries contain only the direct v0.3.0 preview-markdown ref:
dependencies:
- repo_url: adjust/agent-skills
name: inspect-app
resolved_commit: 0845c03a00187e287fa3d3bedcf6d53f924a01cf
resolved_ref: inspect-app-v0.4.10
version: 0.4.10
virtual_path: skills/inspect-app
- repo_url: adjust/agent-skills
name: preview-markdown
resolved_commit: ffcef1dafb8346dc86990c72b7d71c2ab984f75f
resolved_ref: v0.3.0
version: 0.3.0
virtual_path: skills/preview-markdown
There is no second preview-markdown row and no preview-markdown-v0.4.7 value anywhere in the lockfile. The normal install exits 0 without a conflict diagnostic. A subsequent apm install -g --frozen also exits 0 and reports the state already up to date.
For repeatability, Git transport was redirected to an existing local clone while retaining the exact published tag names and commits shown above; the isolated consumer HOME, cache and deployment roots were separate.
Thanks @DaveMeadAdjust for the detailed reproduction and isolated retest, including the manifest and lockfile evidence.
I approve the bounded fail-closed fix below. When the current single-version model cannot satisfy all immutable requirements, APM must report the conflict rather than silently substitute a version and report success. Nested or side-by-side versions require a separate isolation and deployment design and are not part of this fix.
Decision: approve Area: project Scope: Fix silent collapse of incompatible immutable requirements for the same package identity. Fail normal resolution on genuine conflicts and reject frozen replay of a graph that drops a required immutable constraint. Use the existing resolver and lockfile architecture. Done when: Conflicts fail with diagnostics naming both root-to-conflict chains and requested refs. Regression tests cover direct/transitive and transitive/transitive conflicts, invalid frozen replay, and valid compatible or equivalent requirements. Different ref spellings alone are not treated as proof of incompatibility. User-facing documentation explains the error and how to resolve it. Out of scope: Nested or side-by-side package versions, harness deployment isolation, new conflict-resolution modes, and broad resolver or lockfile redesign. Review contact: @danielmeppiel
Anyone taking this on should first check for existing work and comment here to coordinate. Please link this issue and this approval comment in the PR body. Approval is for the bounded scope above; it does not guarantee merge or a release date.
Decision: approve Area: project Scope: Fix silent collapse of incompatible immutable requirements for the same package identity. Fail normal resolution on genuine conflicts and reject frozen replay of a graph that drops a required immutable constraint. Use the existing resolver and lockfile architecture. Done when: Conflicts fail with diagnostics naming both root-to-conflict chains and requested refs. Regression tests cover direct/transitive and transitive/transitive conflicts, invalid frozen replay, and valid compatible or equivalent requirements. Different ref spellings alone are not treated as proof of incompatibility. User-facing documentation explains the error and how to resolve it. Out of scope: Nested or side-by-side package versions, harness deployment isolation, new conflict-resolution modes, and broad resolver or lockfile redesign. Review contact: @danielmeppiel