apm: lockFileMaintenance deletes apm.lock.yaml, which drops APM's ownership of committed files and MCP entries #46702
Replies: 1 comment
|
Hi @salpers, Diagnosis & Proposed SolutionYour diagnosis is correct. APM's update strategy relies on having an up-to-date lockfile with metadata about the state of installed packages, including MCP ownerships and file hashes of all deployed files. Deleting apm.lock.yaml before installing new versions of a package removes that critical context needed for Using It will update all locked/transitive dependencies that have changed while keeping APM-managed state. Suggested Next Steps
|
Uh oh!
There was an error while loading. Please reload this page.
How are you running Renovate?
Self-hosted Renovate CLI
Which platform you running Renovate on?
GitHub.com
Which version of Renovate are you using?
44.131.3
Please tell us more about your question or problem
Minimal reproduction: https://github.com/salpers/renovate-apm-lock-maintenance-repro
For
lockFileMaintenance, theapmmanager deletesapm.lock.yamland then runsapm install(artifacts.ts#L44-L58). APM's lockfile isn't only a version pin. It also records which deployed files and native MCP config entries APM manages. APM projects commit the filesapm installdeploys (.github/,.claude/,.mcp.json, ...). With the lock gone,apm installfinds those files already on disk and can't tell them apart from files a user wrote by hand, so it won't claim them. The resulting maintenance PR:mcp_target_servers: {}and nokind: urideployments)deployed_filesin the reproapm audit --cifail withDrift detected: 7 file(s) ... unrecordedRunning
apm installagain doesn't restore the records. On our repo, every weekly lock file maintenance PR had exactly this diff. The APM maintainers looked at it in microsoft/apm#3090. They don't want APM to rebuild ownership from matching file contents, because an identical file could have been written by hand. They'd rather the integration keep the existing lockfile.Results from the repro's committed state with apm 0.32.0 (the lock pins
microsoft/apm-sample-packageone commit behind):apm-sample-packageapm audit --cirm apm.lock.yaml && apm install(today)apm update --yesapm install --refreshSuggested fix: when
isLockFileMaintenanceis set, keep the lockfile and runapm update --yesinstead ofapm install.apm updateis the<tool> updatecommand that the adding-a-package-manager guide recommends over delete-and-install. It re-resolves every dependency inapm.yml, transitive ones included, to the latest ref the manifest allows. It doesn't touch the manifest, it redeploys changed files, and it reconciles MCP servers. It has been available since APM 0.23.0. The other path (apm installafter a manifest bump) keeps the lockfile and isn't affected.If that direction works for you, I'm happy to open the PR (artifacts.ts, spec and readme).
Workaround until then, for repos whose apm dependencies are all pinned exactly (so maintenance has nothing to refresh):
"apm": { "lockFileMaintenance": { "enabled": false } }.Logs (if relevant)
apm install output after the lockfile was deleted
All reactions