fix: honor explicit global install refs (closes #1555)#1559
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes #1555 where apm install -g <pkg>#<ref> was silently ignored if the package was already listed unpinned in the global apm.yml. The fix updates the existing apm.yml entry in-place when the user supplies an explicit ref on the CLI, so the user's intent wins over a stale unpinned entry.
Changes:
- New helper
_manifest_has_different_entry_for_identityto detect a pre-existing manifest entry whose canonical differs from the CLI input. - In
_resolve_package_references, the "already in deps" branch now also re-merges when an explicit CLI ref differs from the manifest entry, using the CLI-derived structured entry when no other entry was registered. - New regression test covering CLI-supplied ref pinning an unpinned manifest entry.
Show a summary per file
| File | Description |
|---|---|
| src/apm_cli/commands/install.py | Adds helper + branch to update manifest when CLI ref differs from existing identity entry. |
| tests/unit/commands/test_install_resolve_refs.py | Regression test asserting the unpinned dep gets pinned to the CLI ref and dependencies_changed is set. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
8a9e71e to
36242cf
Compare
Fold panel follow-ups for the explicit-ref install fix by making validation output distinguish an updated manifest entry from a no-op, using generic manifest persistence wording, and documenting the fix in the changelog. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
36242cf to
849ad2e
Compare
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 0 | Ref-update logic was extracted into apm_cli.install.package_resolution to keep commands/install.py within its architecture budget. |
| CLI Logging Expert | 0 | 0 | 0 | No raw output paths added; install feedback now distinguishes updated refs from no-op existing deps. |
| DevX UX Expert | 0 | 0 | 0 | Folded the confusing already in apm.yml and marketplace-specific success wording. |
| Supply Chain Security Expert | 0 | 0 | 0 | No new trust boundary; explicit refs reduce floating dependency risk. |
| OSS Growth Hacker | 0 | 0 | 0 | Added a changelog entry for the trust-building silent-footgun fix. |
| Test Coverage Expert | 0 | 0 | 0 | Regression coverage plus mutation-break checks protect the ref-update feedback and persistence paths. |
Folded in this run
849ad2e6- validation output now saysupdated ref in apm.ymlwhen an existing manifest entry is rewritten.849ad2e6- manifest persistence success wording is generic instead of marketplace-specific.849ad2e6- CHANGELOG records the explicit-ref global install fix.849ad2e6- ref-update manifest rewrite logic moved intoapm_cli.install.package_resolution, restoring thecommands/install.pyarchitecture budget under the merge-commit invariant.
Copilot signals reviewed
- Copilot review
4395565193: no inline findings; classified as no actionable Copilot items.
Validation evidence
- Local tests:
uv run --extra dev pytest tests/unit/test_command_logger.py tests/unit/install/test_package_resolution_persistence.py tests/unit/commands/test_install_resolve_refs.py tests/unit/test_install_command.py tests/unit/commands/test_install_context_and_resolution.py tests/unit/install/test_architecture_invariants.py -q-> 231 passed. - Local lint:
uv run --extra dev ruff check src/ tests/anduv run --extra dev ruff format --check src/ tests/-> clean. - Additional guards: pylint R0801 clean;
scripts/lint-auth-signals.shclean. - Mutation-break evidence: removing the updated-ref validation branch made
test_validation_pass_existing_updatedfail; restoring marketplace-specific persistence wording madetest_persist_dependency_list_reports_generic_manifest_updatefail. - CI: all PR checks green on
849ad2e6cb7f42a060a3d4b0acddfcef34675688.
Mergeability snapshot
| #PR | head | ceo_stance | iterations | folds | deferrals | copilot_rounds | ci_status | mergeable | merge_state_status | notes |
|---|---|---|---|---|---|---|---|---|---|---|
| #1559 | 849ad2e | ship_now | 1 | 4 | 0 | 2 | green | MERGEABLE | BLOCKED | awaiting required review |
Recommendation
Ship when the maintainer is ready. There are no deferred items from this shepherd pass.
Full per-persona findings
All actionable panel items were folded in 849ad2e6. No remaining in-scope follow-ups.
This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.
Summary
Validation
Closes #1555