Compatibility
apm.lock.yaml records two versions:
lockfile_version: the file format.apm_version: the APM that last wrote the file.
Only the format decides whether your APM can work with the file. A team, a CI runner and an update bot can run different APM releases on the same lockfile as long as each one reads its format.
What APM promises
Section titled “What APM promises”From APM 0.39.2:
-
The format decides. If your APM reads the file’s
lockfile_version, every command runs, whateverapm_versionsays. -
A newer writer only warns. When a newer APM wrote the file, each command prints one
[!]line on stderr and carries on. Exit codes and stdout do not change.[!] apm.lock.yaml was written by APM 0.40.0, newer than this APM 0.39.2. Its format (lockfile_version 4) is supported, so APM continues and keeps fields it does not know. Upgrade when convenient: apm self-update -
Unknown fields survive. When APM rewrites the file, it keeps the fields it does not recognise: at the top level, in dependency rows and in deployment rows. Fields that may describe old content are dropped:
- a dependency row’s, when its
resolved_commit,resolved_hash,version,content_hashorsource_digestchanged; - a deployment row’s, when its
content_hashor owner changed; - top-level fields, when a dependency was added, removed or changed.
Vendor
x-*keys at the top level are always kept.
- a dependency row’s, when its
-
Anything unsafe to ignore is refused. An unsupported
lockfile_version, an unknown deploymentkind, an unknown value in a known field (such asexec_statusorhost_type), or a duplicatedapm_versionorlockfile_versionkey stops the command with exit 1 before any file changes. The message tells you to upgrade APM; it never tells you to move the lockfile aside.[x] Unsupported lockfile version '5'; supported versions: 1, 2, 3, 4. Run 'apm self-update' to install an APM release that reads lockfile version '5'. -
No overwrite of an unreadable format. APM never replaces a lockfile in a format it cannot read, even when a command would otherwise create one.
-
Clean checkouts install to the recorded targets. If
apm.ymldeclares notargets:and no harness directory is found (for example because.github/and.claude/are gitignored),apm installuses the targetsapm.lock.yamlrecorded and says so:[i] No harness detected; using targets recorded in apm.lock.yaml: claude, copilot.--target,targets:and a detected harness still win first. Several detected harnesses, or a recorded target this APM does not know, still exit 2.The fallback can deploy to several recorded targets. A later install in the same checkout then finds several harness directories and stops with the ambiguous-harness error (exit 2), as it does today. Declare
targets:inapm.ymlto avoid this; update bots start from a fresh clone and are not affected. -
No-op runs change nothing. A run that changes nothing leaves the lockfile byte-identical; it is never restamped.
-
APM never switches itself. APM does not download or switch APM versions on its own. Upgrading is your call (
apm self-update). -
Format changes are rare and announced.
- Additive fields never bump
lockfile_version. - A change an older APM must not ignore bumps it, rarely. Read support ships at least 8 weeks before any release writes the new format.
- A security fix may ship read and write support together.
- Every lockfile field is registered as additive or format-bound, and a test enforces the registry.
- Additive fields never bump
apm audit --ci is stricter than the other commands: if the lockfile holds
fields your APM does not know (other than x- vendor keys), it fails with
exit 1 and names those fields, whatever apm_version says, because an APM
cannot certify data it does not understand. Plain apm audit warns and
evaluates. See apm audit.
Upgrade order
Section titled “Upgrade order”Upgrade CI and update bots first, then local machines. This applies to every
release: an APM that reads the format runs, but apm audit --ci refuses fields
it does not know.
APM 0.37.0 to 0.39.1 also refuse any lockfile written by a newer APM, even in a format they read. Once 0.39.2 or later rewrites your lockfile, those releases refuse it, so move CI and update bots to 0.39.2 or later first.
A bot running an older APM records its own version in apm_version; that line
moving down in a bot PR is expected.
In CI and update bots
Section titled “In CI and update bots”- Pin a minimum APM in CI, not an exact one: any release that reads your
lockfile format works for
apm install --frozen. See Run in CI. - If CI runs
apm audit --ci, keep CI’s APM at least as new as the newest APM that writes the lockfile; upgrade CI and update bots first. - The recommended bot command is
apm install --no-frozen; see Update bots.
Related
Section titled “Related”Copyright (c) Microsoft Corporation. General documentation: CC-BY-4.0. Software, code examples and OpenAPM: Apache-2.0. See scope and exclusions.