|
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
# 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.toml` has no build system, sets `[tool.uv] package = false` and
|
|
|
|
|
|
|
|
`requires-python = ">=3.11"`, and declares `[dependency-groups] dev = ["apm-cli==0.39.3"]`. A
|
|
|
|
|
|
|
|
committed `uv.lock` fixes the transitive dependencies. `.venv/` is gitignored.
|
|
|
|
|
|
|
|
- **Invocation.** Repo scripts run apm as `uv run --project <repo root> --frozen apm`. An `APM`
|
|
|
|
|
|
|
|
environment 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 from `PATH` (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 `SessionStart` hook 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
|
|
|
|
|
|
|
|
the `main` commit that `apm.lock.yaml` records. If the v4 lock landed first, the old hook would run
|
|
|
|
|
|
|
|
`PATH` apm 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.yaml` churn is discarded on feature branches (ADR-0019).
|
|
|
|
|
|
|
|
- **Consumer hook contract.** The shipped hook (`check-apm-current.sh`) resolves apm in this order:
|
|
|
|
|
|
|
|
1. `uv run --frozen`, when the project pins `apm-cli` and uv exists.
|
|
|
|
|
|
|
|
2. `apm` on `PATH`.
|
|
|
|
|
|
|
|
3. Neither: exit 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
It never triggers a uv sync, and on a cold cache it must not touch the network inside the
|
|
|
|
|
|
|
|
`SessionStart` timeout. 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 --frozen` once
|
|
|
|
|
|
|
|
and `apm install` once 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1. **A bare `apm` instruction fails closed.** Any leftover `apm` call 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 the `uv run` form.
|
|
|
|
|
|
|
|
2. **The network is needed on first sync.** A fresh checkout needs it for `uv sync --frozen` and again
|
|
|
|
|
|
|
|
for the first `apm install`. After both, the offline guarantee holds.
|
|
|
|
|
|
|
|
3. **uv becomes a prerequisite** of working in this repo. A consumer without uv falls back to `PATH`
|
|
|
|
|
|
|
|
apm and the version check.
|
|
|
|
|
|
|
|
4. **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.
|