[BUG] install --dry-run falsely previews removal of a required transitive dependency
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 362
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 132
Description
Describe the bug
After a package with a transitive dependency is installed, rerunning apm install --dry-run from the unchanged consumer manifest omits the transitive package from its dependency preview and incorrectly says the transitive package's deployed files would be removed.
Running the same command without --dry-run resolves both packages and preserves the transitive files.
To Reproduce
-
Create three sibling directories named
consumer,parent, andchild. -
Create
consumer/apm.yml:name: consumer version: 1.0.0 targets: - copilot dependencies: apm: - ../parent -
Create
parent/apm.yml:name: parent version: 1.0.0 dependencies: apm: - ../child -
Create
child/apm.yml:name: child version: 1.0.0 -
Add this instruction at both
parent/.apm/instructions/parent.instructions.mdandchild/.apm/instructions/child.instructions.md:--- applyTo: "**" --- # Instruction -
From
consumer, runapm install --target copilot. Both packages are installed:[+] ../parent (local) [+] ../child (local) [*] Installed 2 APM dependencies -
Without changing any manifest, run
apm install --target copilot --dry-run:[i] APM dependencies (1): [i] - ../parent -> install [i] Files that would be removed (packages no longer in apm.yml): 1 [i] - .github/instructions/child.instructions.md -
Run
apm install --target copilotwithout--dry-run. It resolves both packages and leaves the child instruction unchanged.
Expected behavior
Dry-run reflects the real install plan: it includes the still-required transitive package and does not preview removal of its deployed files.
Environment (please complete the following information):
- OS: macOS
- Python Version: 3.14.7
- APM Version: 0.31.0 installed with Homebrew; also reproduced with current
main - VSCode Version (if relevant): Not applicable
Logs
The relevant output is included in the reproduction above.
Additional context
The dry-run plan collects only the root package's direct and development dependencies and uses those dependencies as its orphan-preview intent. The renderer passes that set to detect_orphans and labels the result as files that would be removed because packages are no longer in apm.yml.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the three-package scenario with apm install --target copilot followed by apm install --target copilot --dry-run. Read src/apm_cli/install/dry_run_plan.py at the dependency collection and orphan-preview sections, then inspect src/apm_cli/install/presentation/dry_run.py where the result is rendered. Done means dry-run includes the required transitive package and no longer previews its files for removal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100