Skip to content

[BUG] apm prune deletes a dependency that another installed package still needs after it is removed from direct dependencies #3668

Closed

Description

Describe the bug

With dependencies: [org/d, org/e] where org/d depends on org/e, removing org/e from apm.yml by hand and running apm prune deletes org/e (checkout, deployed files and lock entry), even though org/d still needs it. apm audit --ci then passes. apm install handles the same edit correctly, re-recording org/e as transitive.

To reproduce

  1. Install with org/d and org/e, where org/d depends on org/e.
  2. Remove org/e from apm.yml.
  3. apm prune

Expected behavior

org/e is kept because it is still reachable.

Actual behavior

It is pruned. Prune computes expected packages from direct manifest entries plus lock entries with depth > 1, so the stale direct entry looks like an orphan.

Found by the 0.36.0 pre-release lifecycle sweep (#3649). Same behavior on v0.35.1, so this is not a 0.36 regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/dependenciespillar/consumetype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions