Record that apm is pinned per repo with uv (minimum 0.39.2, pinned 0.39.3), shipped hook-first, with the consumer hook fallback contract. Add forward notes on ADR-0019 and ADR-0033 for their 0.28.0 claims, pending re-verification on 0.39.3. Refs #265, #245 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
5.0 KiB
apm is pinned per repo with uv
Status: accepted (2026-12-01).
Context
Issue #265. apm is installed once per machine with pipx, at 0.28.0, and every repo and the
SessionStart hook (ADR-0019) call whatever apm is on PATH. Three things now fail against that:
- Lockfile format. apm 0.37 and later write lockfile v4, and apm 0.36.1 and earlier refuse it. A lock written by 0.39.2 is in turn refused by 0.37.0 through 0.39.1.
- Command keys. apm 0.39.0 and later keep Claude command keys such as
disable-model-invocation(#245). Earlier versions drop them, so a deployed command silently loses the setting. - Machine-global drift. One shared binary means every checkout's behaviour depends on what was
last installed on that machine. apm has no minimum-version field in
apm.yml, and upstream's advice is to pin a minimum in CI. This repo has no CI (ADR-0024), so the pin has to live in the repo.
Decision
Each repo pins its own apm with uv. This repo needs apm 0.39.2 or later and is pinned to 0.39.3.
-
Pin. The root
pyproject.tomlhas no build system, sets[tool.uv] package = falseandrequires-python = ">=3.11", and declares[dependency-groups] dev = ["apm-cli==0.39.3"]. A committeduv.lockfixes the transitive dependencies..venv/is gitignored. -
Invocation. Repo scripts run apm as
uv run --project <repo root> --frozen apm. AnAPMenvironment variable overrides the command, as a seam for tests. -
Minimum version, 0.39.2. It is the lowest version that reads and writes lockfile v4 and is read back by later versions, and it is at or above 0.39.0, which keeps the Claude command keys. Inside this repo the
==pin enforces it. Where apm comes fromPATH(a consumer repo that does not pin), an explicit version check enforces it. -
uv only pins apm itself. ADR-0024 stands: apm is the only supported install path for plugin content. uv installs the tool, never plugins, skills or agents.
-
Hook first. The kyberforge
SessionStarthook change ships first, with a kyberforge version bump and its release tag (ADR-0033). The cutover (the v4 lock,pyproject.toml,uv.lock, the scripts and their tests) follows as one PR. The order matters because the deployed hook comes from themaincommit thatapm.lock.yamlrecords. If the v4 lock landed first, the old hook would runPATHapm 0.28.0, which refuses the lock, and staleness detection would be lost with no error. -
The cutover PR commits a lock rewrite (v1 to v4) on purpose. It is the one sanctioned exception to the rule that
apm.lock.yamlchurn is discarded on feature branches (ADR-0019). -
Consumer hook contract. The shipped hook (
check-apm-current.sh) resolves apm in this order:uv run --frozen, when the project pinsapm-cliand uv exists.apmonPATH.- Neither: exit 0.
It never triggers a uv sync, and on a cold cache it must not touch the network inside the
SessionStarttimeout. It never reports "up to date" when it ran on an apm older than 0.39.2. Its advice strings are fixed and name the chosen binary, with no interpolation of command output. -
Global apm 0.28.0 stays. It stays installed and on
PATH, because ansible still uses it (Defame1297/ansible-homelab-mono#1078). It is not upgraded. Whichever of that issue and Mortis/Kamino#499 lands last uninstalls it: the last mover deletes. -
New setup step. The offline pre-push guarantee of ADR-0019 now needs
uv sync --frozenonce andapm installonce per checkout. The first apm 0.39 install also needs the network, to record commit verdicts.
Considered options
Global pipx apm, as today (rejected). It is the drift described above, and it cannot enforce a minimum version.
Upgrade the global apm (rejected). It would fix this repo and break ansible, which still depends on 0.28.0 behaviour, and it would leave the next repo with the same shared-binary problem.
uvx (rejected). It has no lock, so apm's transitive dependencies float between runs and the
pin only covers the top-level package.
uv tool install (rejected). It is machine-global state, the same drift as pipx under a
different name.
Consequences
- A bare
apminstruction fails closed. Any leftoverapmcall in this repo that resolves to the global 0.28.0 refuses the v4 lock instead of rewriting it. That is the intended failure, but it will surprise whoever hits it; the fix is theuv runform. - The network is needed on first sync. A fresh checkout needs it for
uv sync --frozenand again for the firstapm install. After both, the offline guarantee holds. - uv becomes a prerequisite of working in this repo. A consumer without uv falls back to
PATHapm and the version check. - Re-verification is pending. ADR-0019 and ADR-0033 state facts verified against apm 0.28.0. They are re-checked on 0.39.3 under #265, and each carries a note saying so.
Related: ADR-0019, ADR-0024, ADR-0033; #245, #265; Defame1297/ansible-homelab-mono#1078; Mortis/Kamino#499.