docs(gates): re-verify the apm gate facts on apm 0.39.3
The apm-audit-ci section now records 15 root checks and 2 plugin checks, a run of about 70 s through uv run, manifest-parse as a named row, the new plain-audit wording, and the waiver re-verified in a scratch copy of plugins/mattpocock. The setup note and "Pushing without a network" give the two one-time online steps, the pinned invocation, and the first-0.39-install refusal on a 0.28-deployed checkout. Refs #272 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
1 parent
01fe1fb767
commit
386ab7ec5d
1 file changed
+65
-29
+65
-29
@@ -1162,7 +1162,9 @@ plugin packages under `plugins/` — because the root-only invocation audits the
|
||||
**nothing else**, and `apm-pack-check-clean` does not parse plugin `dependencies:` blocks either.
|
||||
Verified: a malformed dependency entry passes
|
||||
`apm pack --check-versions --check-clean --dry-run` and fails `apm audit --ci` in that package's
|
||||
directory. Costs ~0.5s per package.
|
||||
directory. The whole hook, the root plus every plugin package, takes about 70 s through `uv run` on
|
||||
apm 0.39.3 (measured 70-90 s, about 20 s of it the root audit). On apm 0.28.0 it cost about 0.5 s
|
||||
per package.
|
||||
|
||||
**Both apm hooks run the repo-pinned apm.** They source `scripts/lib/apm.sh`, the one place the
|
||||
invocation is spelled: `uv run --project <repo root> --frozen apm` (ADR-0034). `--project` comes
|
||||
@@ -1184,34 +1186,46 @@ none. `drift`'s install replay (apm 0.28.0) runs `git init` and `git checkout` i
|
||||
env copied from `os.environ`, so the inherited `GIT_DIR` wins. The `init` wrote `core.bare=true` into
|
||||
the shared `.git/config`, and the `checkout` moved the worktree's HEAD to the lock-pinned commit
|
||||
(issue #204). Pre-commit runs hooks from the worktree root, so once the vars are gone plain
|
||||
discovery finds the right repo. `tests/test-apm-hooks-git-env.sh` pins this for both hooks.
|
||||
discovery finds the right repo. *2026-12-02 (holocron#272):* apm 0.39.3 builds the env for its own
|
||||
git calls through `git_subprocess_env` in `apm_cli/utils/git_env.py`, which strips `GIT_DIR` and the
|
||||
other repo-locating vars. The leak was not reproduced again on 0.39.3, and the scrub stays as
|
||||
defence in depth. `tests/test-apm-hooks-git-env.sh` pins this for both hooks.
|
||||
|
||||
**What it actually runs is asymmetric**, and the two manifest classes are not comparable. Verified by
|
||||
running `apm audit --ci` (apm 0.28.0) at the repo root and in `plugins/lint/`, reading the check
|
||||
names straight off its own compliance table:
|
||||
running `apm audit --ci` (apm 0.39.3, holocron#272; first done on 0.28.0) at the repo root and in
|
||||
`plugins/lint/`, reading the check names straight off its own compliance table:
|
||||
|
||||
On the **root** manifest, **10 checks**: `lockfile-exists`, `ref-consistency`,
|
||||
On the **root** manifest, **15 checks**: `lockfile-exists`, `ref-consistency`,
|
||||
`deployment-ledger-owners`, `deployed-files-present`, `no-orphaned-packages`,
|
||||
`skill-subset-consistency`, `config-consistency`, `content-integrity`, `includes-consent`, `drift`.
|
||||
`lockfile-targets-current`, `skill-subset-consistency`, `config-consistency`,
|
||||
`native-mcp-ownership`, `content-integrity`, `local-bundle-hooks`, `hook-approval-pins`,
|
||||
`exec-status-current`, `includes-consent`, `drift`. apm 0.28.0 ran ten of these; the five it lacked
|
||||
are `lockfile-targets-current`, `native-mcp-ownership`, `local-bundle-hooks`, `hook-approval-pins`
|
||||
and `exec-status-current`.
|
||||
|
||||
On each **plugin** manifest, **1 check**: `lockfile-exists`. Conditional, and vacuous while every
|
||||
On each **plugin** manifest, **2 checks**: `lockfile-exists` and `content-integrity` (0.28.0 ran
|
||||
only `lockfile-exists`). The plugin-level `content-integrity` row scans no package source: on
|
||||
0.39.3 it still passed with a bidi override planted in a scratch copy of `plugins/lint`. When
|
||||
`lockfile-exists` fails, the table holds that one row alone. `lockfile-exists` is conditional, and vacuous while every
|
||||
plugin `apm.yml` declared `dependencies: {apm: [], mcp: []}` — it reports `No dependencies declared
|
||||
-- lockfile not required`. An earlier revision of this section said it would arm the moment one did
|
||||
not. **It has armed.** `plugins/onedev` was the first plugin package to declare a real dependency — it
|
||||
pinned `code.onedev.io/onedev/tod#v4.3.4` — and was removed on 2026-11-11; `plugins/mattpocock`
|
||||
carries the same shape (pinned third-party skills, no primitives of its own) and the check fires on
|
||||
it for real. Everything else in the list above is root-only, because it is the
|
||||
it for real. Everything else in the root list is root-only, because it is the
|
||||
root install that has a lockfile, a deployment ledger and deployed files to check.
|
||||
|
||||
**A plugin package that declares dependencies has no green state, so the hook waives exactly one
|
||||
failure.** Verified against apm 0.28.0 in `plugins/onedev/` (since removed; the behaviour is the same for any package that declares dependencies):
|
||||
failure.** Verified against apm 0.28.0 in `plugins/onedev/` (since removed; the behaviour is the same for any package that declares dependencies), and again on apm 0.39.3 in a scratch copy of `plugins/mattpocock` (holocron#272):
|
||||
|
||||
- **Without a package `apm.lock.yaml`**, `lockfile-exists` fails — `apm.yml declares dependencies but
|
||||
apm.lock.yaml is absent` — reported as `1 of 1 check(s) failed`.
|
||||
apm.lock.yaml is absent` — reported as `1 of 1 check(s) failed`. Unchanged on 0.39.3.
|
||||
- **With one**, generated by `apm lock` in the package directory, `lockfile-exists` passes and
|
||||
thereby arms the other nine checks; `drift` then fails reporting **8 unintegrated files** at
|
||||
`.agents/skills/<name>/SKILL.md`, i.e. demanding the dependency's skills be *deployed inside the
|
||||
package*. `apm lock` also leaves an `apm_modules/` tree inside the package.
|
||||
thereby arms the rest of the root check set; `drift` then fails reporting unintegrated files at
|
||||
`.agents/skills/<name>/...`, i.e. demanding the dependency's skills be *deployed inside the
|
||||
package*. On 0.28.0 that was nine more checks and 8 files from onedev; on 0.39.3 it is fourteen
|
||||
more checks and 74 files from mattpocock. `apm lock` also leaves an `apm_modules/` tree inside the
|
||||
package.
|
||||
|
||||
The cause is that apm treats any directory holding both `apm.yml` and `apm.lock.yaml` as an **install
|
||||
root**, and a plugin package is not one. `scripts/apm-audit-ci.sh` therefore waives `lockfile-exists`
|
||||
@@ -1220,9 +1234,10 @@ so any second failing check changes the count and the run fails normally, and ou
|
||||
recognise fails closed. The root manifest is never waived. Recorded as ADR-0026.
|
||||
|
||||
**Dropping `--ci` for package directories was considered and rejected.** It is the smaller change and
|
||||
it is wrong. Verified on apm 0.28.0 against a scratch package whose dependency entry carried no
|
||||
`git`/`path`/`registry` field: `apm audit --ci` exits 1 naming the field, while plain `apm audit`
|
||||
prints `No apm.lock.yaml found -- nothing to scan` and exits 0. Malformed-dependency detection is the
|
||||
it is wrong. Verified on apm 0.28.0, and again on 0.39.3 (holocron#272), against a scratch package
|
||||
whose dependency entry carried no `git`/`path`/`registry` field: `apm audit --ci` exits 1 naming the
|
||||
field, while plain `apm audit` exits 0. Plain `apm audit` printed `No apm.lock.yaml found -- nothing
|
||||
to scan` on 0.28.0 and prints `No recognized deployed primitives found -- nothing to scan` on 0.39.3. Malformed-dependency detection is the
|
||||
reason this section gives for auditing packages at all, and a package *with* dependencies is the only
|
||||
kind that can carry a malformed dependency entry — so dropping `--ci` would discard the check
|
||||
precisely where it earns its keep.
|
||||
@@ -1231,15 +1246,24 @@ precisely where it earns its keep.
|
||||
turns the waiver off. That fails the push rather than hiding a defect; re-verify against the new
|
||||
output and update the patterns rather than widening them.
|
||||
|
||||
**`manifest-parse` is not a named check** in apm 0.28.0's output, and an earlier revision of this
|
||||
section listed it as one. Parsing is still enforced — a dependency entry missing its
|
||||
`git`/`path`/`registry` field fails with `Cannot parse apm.yml` — but it fails the invocation before
|
||||
the table is built rather than appearing as a row in it.
|
||||
**`manifest-parse` is a named check on apm 0.39.3, and was not one on 0.28.0.** On 0.28.0 a
|
||||
dependency entry missing its `git`/`path`/`registry` field failed the invocation with `Cannot parse
|
||||
apm.yml` before the table was built. On 0.39.3 the same entry produces a one-row table, a failing
|
||||
`manifest-parse` row reading `Cannot parse apm.yml: Invalid APM dependency ...`, and `1 of 1
|
||||
check(s) failed` (holocron#272). The waiver does not cover it: that row lacks the `declares
|
||||
dependencies but apm.lock.yaml is absent` line the waiver also requires. A parsable manifest gets no
|
||||
`manifest-parse` row, which is why it is missing from both lists above.
|
||||
|
||||
**The hook needs a completed `apm install`.** `deployed-files-present` checks the install output on
|
||||
disk, so on a fresh clone it fails with `303 deployed file(s) missing` and takes the push with it.
|
||||
That is not a defect in the gate; it is the gate correctly reporting that nothing has been installed
|
||||
yet. Run `apm install` before the first push from a new checkout.
|
||||
disk, so on a fresh clone it fails with `<N> deployed file(s) missing` (303 on 0.28.0; the count
|
||||
follows the lock) and takes the push with it. That is not a defect in the gate; it is the gate
|
||||
correctly reporting that nothing has been installed yet. Before the first push from a new checkout,
|
||||
run `uv sync --frozen` and then `uv run --frozen apm install`, each once and online. Without the
|
||||
first, the hooks' plain `uv run --frozen` performs that sync itself, which needs the network. An older checkout
|
||||
whose `.claude/skills`, `.claude/agents` and `.claude/commands` were deployed by apm 0.28 moves those
|
||||
three directories aside before that first 0.39 install. Otherwise apm refuses to replace the files
|
||||
with `no trustworthy local deployment baseline`, because 0.28 recorded no deployment evidence for
|
||||
them. apm's message suggests a bare `apm install`; run the `uv run --frozen` form instead.
|
||||
|
||||
It does **not** enforce an org policy. apm discovers one from the git remote and only understands
|
||||
github.com and Azure DevOps, so against this repo's self-hosted Gitea remote it prints:
|
||||
@@ -1259,10 +1283,12 @@ that can never go green is not a gate. Revisit only if this repo gains a policy
|
||||
or hash drift detected` — so the root invocation already covers it and nothing needs adding. What
|
||||
remains true is that the *standalone* mode is different: plain `apm audit` (`--ci` refuses to combine
|
||||
with `--file`/`--strip`/`--dry-run`/`PACKAGE`) run in a plugin directory reports
|
||||
`No apm.lock.yaml found -- nothing to scan` and exits 0, because only the root has a lockfile.
|
||||
Plugin manifests get `lockfile-exists` and nothing else; they are not Unicode-scanned. That holds
|
||||
because no package carries an `apm.lock.yaml` — one would arm the other nine checks, `content-integrity`
|
||||
among them, which is the state ADR-0026 rules out rather than a second scan worth having.
|
||||
`No recognized deployed primitives found -- nothing to scan` on 0.39.3 (`No apm.lock.yaml found --
|
||||
nothing to scan` on 0.28.0) and exits 0, because only the root has a lockfile and deployed files.
|
||||
Plugin manifests are not Unicode-scanned. 0.39.3 does add a `content-integrity` row in a plugin
|
||||
directory, but it scans no package source (see above). That holds because no package carries an
|
||||
`apm.lock.yaml`. One would arm the rest of the root check set, a scanning `content-integrity` among
|
||||
them, which is the state ADR-0026 rules out rather than a second scan worth having.
|
||||
|
||||
### `check-executables-allow-sync`
|
||||
|
||||
@@ -1292,6 +1318,10 @@ executables, since a third-party dependency can be parked too. A missing lock is
|
||||
`apm-audit-ci`'s `lockfile-exists`. It is a line scan of the shape apm writes, not a YAML parse.
|
||||
|
||||
The rest of this section describes the 0.28.0 matching that the version-blind behaviour comes from.
|
||||
*2026-12-02 (holocron#272):* the functions it names are still in apm 0.39.3's source with the same
|
||||
roles. `materialize_exec_map` still stores each key under its version-blind name, and `_map_grants`
|
||||
documents ordinary grants as version-blind. What changed is the name half of the key, which is now
|
||||
the full identity described above.
|
||||
|
||||
apm gates a package's `hooks/` and `bin/` on root `apm.yml`'s `executables.allow`
|
||||
(`apm_cli/security/executables.py`). `is_package_approved` is itself an exact dictionary lookup, but
|
||||
@@ -1364,7 +1394,11 @@ drift after the fact, not by a derived gate.
|
||||
|
||||
## Pushing without a network
|
||||
|
||||
No pre-push hook needs the network **once `apm install` has populated `apm_modules/`**. Every entry
|
||||
No pre-push hook needs the network **once two one-time online steps have run in this checkout**:
|
||||
`uv sync --frozen`, which installs the apm that `uv.lock` pins into `.venv/`, then
|
||||
`uv run --frozen apm install`, which populates `apm_modules/` and the deployed tree. Every apm
|
||||
call in the hooks goes through the pinned invocation in `scripts/lib/apm.sh` (ADR-0034); after the
|
||||
first sync, its implied `uv` sync is a no-op that needs no network. Every entry
|
||||
in root `apm.yml`'s `marketplace.packages[]` resolves from a local `./plugins/<name>` path, so
|
||||
`apm-pack-check-clean` never calls `git ls-remote`.
|
||||
|
||||
@@ -1375,7 +1409,9 @@ replay the install to diff scratch against the working tree, and that replay is
|
||||
clone** there is no cache to replay from, so the replay clones from the holocron remote and those two
|
||||
checks fail offline, with `deployed-files-present` already failing for the same reason (see
|
||||
`apm-audit-ci` above). The offline guarantee is a property of a populated `apm_modules/`, not of the
|
||||
hook set: run `apm install` once on a new checkout and it holds from then on.
|
||||
hook set: run `uv sync --frozen` and `uv run --frozen apm install` once on a new checkout and it
|
||||
holds from then on. Run apm only in that pinned form here: a bare `apm` reaches the machine-global
|
||||
0.28.0, which this repo does not use and which refuses the v4 `apm.lock.yaml`.
|
||||
|
||||
## Plugin release tags are not a gate
|
||||
|
||||
|
||||
Reference in new issue
Block a user