fix: --update flag now bypasses lockfile SHA to fetch latest content#192
Merged
danielmeppiel merged 2 commits intomicrosoft:mainfrom Mar 7, 2026
Conversation
…icrosoft#190) Gate lockfile SHA overrides behind `not update_refs` so that `apm install --update` actually re-fetches the latest content instead of re-downloading the stale pinned commit. Three conditions were fixed in _install_apm_dependencies(): - Pre-download ref construction: skip lockfile override when updating - Sequential download ref construction: same guard added - skip_download condition: already_resolved no longer bypasses --update Adds 14 unit tests covering the corrected logic.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes apm install --update so it truly refreshes dependencies by preventing lockfile-pinned SHAs (and the “already resolved” short-circuit) from overriding --update behavior during install.
Changes:
- Gate lockfile SHA overrides behind
not update_refsin both the parallel pre-download and sequential download ref construction paths. - Gate
already_resolvedbehindnot update_refsin theskip_downloadcondition so--updatewon’t silently reuse a previously-resolved package. - Add new unit tests covering
--updateinteractions with lockfile overrides and skip conditions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/apm_cli/cli.py |
Ensures --update bypasses lockfile SHA pinning and avoids stale “already resolved” reuse during install. |
tests/unit/test_install_update.py |
Adds regression coverage for the --update/lockfile/skip-download behavior. |
You can also share your feedback on Copilot code review. Take the survey.
…ean imports - Revert already_resolved skip: the BFS callback already fetches fresh content when update_refs=True, so re-downloading is redundant. - Remove unused imports from test file (pytest, Path, patch, MagicMock, GitReferenceType).
danielmeppiel
approved these changes
Mar 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #190 —
apm install --updatewas not updating subdirectory packages (or any packages) because the download reference was unconditionally overridden with the lockfile's pinned SHA, even when--updateexplicitly requests the latest version.Root Cause
Three code paths in
_install_apm_dependencies()did not respect theupdate_refsflag:_pd_dlrefusing the lockfile SHA regardless of--updateskip_downloadcondition —already_resolved(set when the BFS resolver callback pre-downloaded a package) bypassed--update, causing the stale cached version to be usedFix
not update_refsin both download ref construction pathsalready_resolvedbehindnot update_refsin theskip_downloadconditionNote on the reported symptom
The issue reports
git remote -vinsideapm_modules/owner/repo/showing the consuming project's remote. This is a red herring — subdirectory packages are extracted from a temp clone (no.gitdirectory is kept), so runninggit remote -vinside them walks up to the project root's.git. The actual symptom is stale content after--update.Tests
tests/unit/test_install_update.py🤖 Test Improver here - I'm an automated AI assistant focused on improving tests for this repository.
Activity for March 2026
Suggested Actions for Maintainer
(Previously submitted PRs may have been merged or are pending - check recent PR list for [Test Improver] prefix PRs.)
Maintainer Priorities
No specific priorities communicated yet.
Testing Opportunities Backlog
agents_compiler.py— 69% coverage, medium priority (complex compilation logic)workflow/runner.py— done this run (22%→100%)codex.pyadapter — 44% coverage, low priority (network-heavy)commands/deps.py— 6% coverage, low priority (complex, large file)copilot.pyadapter — 8% coverage, low priority (network-heavy)Discovered Commands
Run History
2026-03-09 01:06 UTC - Run
test_install_command.py(Rich markup wrapping(org/repo))workflow/runner.py:find_workflow_by_name,run_workflow,preview_workflow,collect_parametersmissing-params branchworkflow/runner.py22% → 100%; total 54% (1307 passing, 0 failing)2026-03-08 01:07 UTC - Run
distributed_compiler.py(50%→97%)test_install_command.py2026-03-07 01:06 UTC - Run
collection_parser.py(0%→100%)test_install_command.py2026-03-06 01:08 UTC - Run
apm_resolver.py(9%→98%),dependency_graph.py(59%→100%)2026-03-05 01:07 UTC - Run
GitHubTokenManager(20%→99%)2026-03-04 01:07 UTC - Run
core/operations.py(0%→100%),runtime/manager.py(17%→84%)2026-03-03 19:54 UTC - Run
registry/operations.py(6%→88%)2026-03-03 16:56 UTC - Run
package_validator.py(10%→100%); fixedUnboundLocalErrorbug2026-03-03 10:55 UTC - Run
constitution_block.py(53%→100%),injector.py(44%→93%)