Skip to content

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.

From APM 0.39.2:

  1. The format decides. If your APM reads the file’s lockfile_version, every command runs, whatever apm_version says.

  2. 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
  3. 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_hash or source_digest changed;
    • a deployment row’s, when its content_hash or owner changed;
    • top-level fields, when a dependency was added, removed or changed. Vendor x-* keys at the top level are always kept.
  4. Anything unsafe to ignore is refused. An unsupported lockfile_version, an unknown deployment kind, an unknown value in a known field (such as exec_status or host_type), or a duplicated apm_version or lockfile_version key 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'.
  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.

  6. Clean checkouts install to the recorded targets. If apm.yml declares no targets: and no harness directory is found (for example because .github/ and .claude/ are gitignored), apm install uses the targets apm.lock.yaml recorded 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: in apm.yml to avoid this; update bots start from a fresh clone and are not affected.

  7. No-op runs change nothing. A run that changes nothing leaves the lockfile byte-identical; it is never restamped.

  8. APM never switches itself. APM does not download or switch APM versions on its own. Upgrading is your call (apm self-update).

  9. 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.

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 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.

  • 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.

Copyright (c) Microsoft Corporation. General documentation: CC-BY-4.0. Software, code examples and OpenAPM: Apache-2.0. See scope and exclusions.