Repository navigation
fix(install): drop the stale .apm-pin after a git -> registry source switch - #4597
Merged
Daniel Meppiel (danielmeppiel) merged 3 commits intoNov 21, 2026
Merged
Conversation
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 21, 2026 11:14
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 21, 2026 11:14
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the stale .apm-pin cleanup change.
No open issues 🎉
What changed in this PR
Fixes #4572 by clearing stale git .apm-pin markers after a dependency switches to a registry source. Cleanup stays in the existing cache-pin owner, restoring byte-stable repeat installs.
Changes:
- Removes markers for dependencies that are no longer markable, while protecting shared git paths and paths outside
apm_modules. - Adds owner-level and real-CLI regression coverage for cleanup, source switching, and repeat-install stability.
- Records the regression in the lifecycle bug ledger and changelog.
| File | Description |
|---|---|
tests/lifecycle/machines/test_m_source.py |
Tests source switches, marker validity, and byte-stable repeat installs. |
tests/integration/test_cache_pin.py |
Tests stale-marker cleanup, preserved markers, and unlink failures. |
tests/fixtures/lifecycle_bug_ledger.json |
Links issue #4572 to regression tests and lifecycle properties. |
src/apm_cli/install/cache_pin.py |
Adds best-effort stale-marker removal during lockfile synchronization. |
CHANGELOG.md |
Documents the source-switch cleanup fix. |
Review effort: Balanced
…4572) Co-authored-by: Copilot App <[email protected]>
…#4572) The cache-pin lockfile sync now removes a marker whose dependency is no longer markable (registry, local, unpinned), so a git -> registry switch converges on the first apm install. apm-spec-waiver: .apm-pin is APM cache hygiene, not an OpenAPM v0.1 observable Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-p1-4572-stale-apm-pin
branch
from
November 21, 2026 11:22
4db0969 to
c7ba84a
Compare
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-p1-4572-stale-apm-pin
branch
November 21, 2026 12:13
This was referenced Nov 21, 2026
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
#4597 fixed the stale .apm-pin after a git -> registry switch but kept the strict known cell, so test_source_spine_covers_every_form_and_op failed on main: the bug no longer reproduces. The X|install|pkg-registry|UPDATE=on cell now earns its oracle receipt like any other. Co-authored-by: Copilot App <[email protected]>
This was referenced Nov 21, 2026
5 of 12 tasks
Mohammed Alkindi (MohammedAlkindi)
pushed a commit
to MohammedAlkindi/apm
that referenced
this pull request
Nov 21, 2026
…(main red) microsoft#4597 fixed microsoft#4572 (a git -> registry switch now drops the stale .apm-pin) but left the strict KnownCell registry-source-switch-stale-pin in test_m_source.py. The cell no longer fails, so the source spine (test_source_spine_covers_every_form_and_op, lifecycle_smoke shard 4) fails strict on every PR. Drop the cell and its KNOWN_CELLS_BY_ID entry; the regenerated pair X|install|pkg-registry|UPDATE=on moves from known-failing to required. Refs microsoft#4572, microsoft#4565 Co-authored-by: Copilot App <[email protected]>
Merged
3 of 10 tasks
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.
Description
TL;DR — After a dependency switches from a git source to a registry source, the first
apm installnow removes the stale git.apm-pinfromapm_modules/<pkg>/. The fix lives in the single marker owner,src/apm_cli/install/cache_pin.py: its lockfile sync drops a marker whose dependency is no longer markable. A converged project is a byte fixpoint again: a repeatapm installandapm install --updatechange no bytes.Problem (WHY)
resolved_commit, so a git marker left in its copy names a commit the lockfile no longer vouches for.sync_markers_for_lockfileonly wrote markers for markable deps and skipped everything else, so repeated installs kept the stale marker.apm install --updatere-downloaded and deleted it, soinstallreported convergence whileinstall --updatestill changed bytes (lifecycle law I2). Found by M-SOURCE cellX|install|pkg-registry|UPDATE=onin the [TEST] Lifecycle obligations: burn the baseline down to at most 500 cells for 0.38 #4564 burn-down.Approach / Implementation (HOW)
src/apm_cli/install/cache_pin.pysync_markers_for_lockfilecollects install paths of unmarkable deps (registry, local, unpinned) and removes their.apm-pinafter the write pass. A path that a markable dep also claims is never cleared; only copies underapm_modulesare touched;OSErroris swallowed (best-effort, likewrite_marker). The registry download path is unchanged and relies on this owner.tests/lifecycle/machines/test_m_source.pytest_git_to_registry_switch_drops_the_stale_cache_pinon the M-SOURCE bench (real CLI, I1–I9 per step).tests/integration/test_cache_pin.pyapm_modulesuntouched, an unlink failure never raises.tests/fixtures/lifecycle_bug_ledger.jsonidempotency.byte_stable,source.ref_cache_coherent).CHANGELOG.mdTrade-offs
.apm-pin.Issue and approved scope
Issue: Closes #4572
Dependency order: none (independent of open PRs)
Human scope-approval comment: #4572 (comment)
Does this PR complete the issue, or what remains? It completes the issue: the receipt cell passes, controls hold, one CHANGELOG line.
Type of change
Testing
Scenario evidence
Validation commands and results
All runs through the host guard with
env -u GIT_EXEC_PATH PATH=/usr/bin:/bin:$PATH APM_BINARY_PATH=$PWD/.venv/bin/apm.pytest tests/lifecycle/machines/test_m_source.py::test_git_to_registry_switch_drops_the_stale_cache_pin(fix reverted)assert not pin.exists()pytest tests/lifecycle/machines/test_m_source.py(with fix)pytest tests/integration/test_cache_pin.pypytest tests/unit/install/ tests/unit/test_prune_command.py tests/unit/test_content_hash.py tests/integration/test_cache_coverage.py tests/integration/test_drift_detection.py tests/integration/test_drift_check_e2e.py tests/lifecycle/scenarios/test_cache_presence.py tests/quality/test_lifecycle_bug_ledger.py tests/spec_conformance/test_lockfile_reqs.pyuvx [email protected] check/format --check(CI paths)python -m pylint --disable=all --enable=R0801 ... src/apm_cli/ ...bash scripts/lint-auth-signals.shpython scripts/check_complexity_ratchet.py --base-ref origin/mainpython -m tests.quality.taxonomy --changedBASE_REF=<merge-base> bash tests/spec_conformance/mode_b_detector.shapm-spec-waiver)How to test
APM_BINARY_PATH=$PWD/.venv/bin/apm uv run --extra dev pytest "tests/lifecycle/machines/test_m_source.py::test_git_to_registry_switch_drops_the_stale_cache_pin" -n 0 -qsrc/apm_cli/install/cache_pin.pyand rerun: it fails on the.apm-pinassertion.uv run --extra dev pytest tests/integration/test_cache_pin.py -qChangelog
## [Unreleased]inCHANGELOG.md:user-visible effect first, 25 words or fewer, ending with
(#PR);breaking changes only under upgrade notes; no Highlights; see
.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regenerated.apm-pinis APM cache hygiene; spec gate waived in the fix commit.)Co-authored-by: Copilot [email protected]