diff --git a/docs/adr/0019-session-start-hook-keeps-the-apm-install-current.md b/docs/adr/0019-session-start-hook-keeps-the-apm-install-current.md index e8ce5df..411ec74 100644 --- a/docs/adr/0019-session-start-hook-keeps-the-apm-install-current.md +++ b/docs/adr/0019-session-start-hook-keeps-the-apm-install-current.md @@ -7,6 +7,11 @@ and nothing detects it. **Status: accepted (2026-08-14).** +*Amended 2026-12-01 (holocron#265): the hook resolves apm through the contract in ADR-0034 (a +repo-pinned `uv run --frozen` apm, else `PATH` apm, else exit 0) instead of a bare `command -v apm`. +The "0.28.0" claims below (the correction near line 80, the `apm outdated` prose at about line 143, +and the sidecar reproduction at about line 217) are pending re-verification on 0.39.3 under #265.* + ## Context The pre-existing answer was `scripts/git-hooks/post-push`, which pulled the marketplace clone and diff --git a/docs/adr/0033-plugin-releases-are-tagged-plugin-v-version.md b/docs/adr/0033-plugin-releases-are-tagged-plugin-v-version.md index 6dec278..4c4e426 100644 --- a/docs/adr/0033-plugin-releases-are-tagged-plugin-v-version.md +++ b/docs/adr/0033-plugin-releases-are-tagged-plugin-v-version.md @@ -2,6 +2,10 @@ **Status: accepted (2026-11-27).** +*Amended 2026-12-01 (holocron#265): the 0.28.0 claims in this ADR (the `apm outdated` tag-pattern +check in Context and the apm behaviour in consequence 3) are pending re-verification on 0.39.3 under +#265, once apm is pinned per repo (ADR-0034). The Decision is unchanged.* + ## Context Issue #223. Consumers that pin a holocron package need a git tag per package version. Two consumers diff --git a/docs/adr/0034-apm-is-pinned-per-repo-with-uv.md b/docs/adr/0034-apm-is-pinned-per-repo-with-uv.md new file mode 100644 index 0000000..ebcd22a --- /dev/null +++ b/docs/adr/0034-apm-is-pinned-per-repo-with-uv.md @@ -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 --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.