feat(gates): waive ref-consistency for a plugin not yet on origin/main

A first-landing hook- or bin-shipping plugin could not be pushed.
check-executables-allow-sync requires its git+path entry in root apm.yml,
but root dependencies resolve from the remote's main (ADR-0019), so the
lock cannot record the plugin until it lands and root `apm audit --ci`
fails ref-consistency with `<identity>/plugins/<name>: not found in
lockfile`. No state of the branch satisfied both gates.

scripts/apm-audit-ci.sh now waives the root audit only when the sole
failure is ref-consistency (`1 of 3 check(s) failed`, as apm 0.39.3
prints it), every detail line is that form for the identity root
apm.yml's own git+path entry yields, plugins/<name>/apm.yml exists in
the working tree, and the plugin is absent from the local origin/main.
No fetch; a missing origin/main or unrecognised output fails closed. The
waiver lapses for a plugin once it is on origin/main, when the follow-up
lock PR must record it.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-12-06 09:35:52 +00:00
1 parent cc1d396d47
commit aaa73dddd3
4 files changed
+328 -4

No files matched your search

+17 -2
View File
@@ -72,7 +72,7 @@ version-blind, so a stale key deploys fine (see [apm gates](#apm-gates)).
| Hook | Guards |
|---|---|
| `apm-audit-ci` | `scripts/apm-audit-ci.sh` — `apm audit --ci` once per manifest, root plus each plugin package under `plugins/`, waiving only a package's `lockfile-exists` (see [below](#apm-audit-ci)) |
| `apm-audit-ci` | `scripts/apm-audit-ci.sh` — `apm audit --ci` once per manifest, root plus each plugin package under `plugins/`, waiving only a package's `lockfile-exists` and the root's `ref-consistency` for a plugin not yet on `origin/main` (see [below](#apm-audit-ci)) |
| `apm-pack-check-clean` | `scripts/apm-pack-check-clean.sh` — `apm pack --check-versions --check-clean --dry-run` with a scrubbed git env (see [`apm-audit-ci`](#apm-audit-ci)) — the compiled marketplace still matches what `apm.yml` + `.apm/` would generate, and per-package versions agree with the `per_package` strategy |
**Host validators** (needs the `claude` CLI on PATH)
@@ -1232,7 +1232,22 @@ The cause is that apm treats any directory holding both `apm.yml` and `apm.lock.
root**, and a plugin package is not one. `scripts/apm-audit-ci.sh` therefore waives `lockfile-exists`
and nothing else, and only for a non-root manifest: it asserts the string `1 of 1 check(s) failed`,
so any second failing check changes the count and the run fails normally, and output it does not
recognise fails closed. The root manifest is never waived. Recorded as ADR-0026.
recognise fails closed. The root manifest is never waived for `lockfile-exists`. Recorded as ADR-0026.
**The root has one waiver of its own: `ref-consistency` for a plugin not yet on `origin/main`.**
Root `apm.yml`'s first-party dependencies resolve from the remote's `main` (ADR-0019), so the lock
cannot record a plugin before it lands, while `check-executables-allow-sync` refuses a push of a
hook- or bin-shipping plugin whose git+path entry is missing from root `apm.yml`. Without a waiver a
first-landing executable-shipping plugin is unpushable: root `ref-consistency` fails with
`<identity>/plugins/<name>: not found in lockfile`. On apm 0.39.3 a failing `ref-consistency` cuts
the root run to three checks (holocron#179), so the hook waives it only when the output reads `1 of
3 check(s) failed`, the one failing row is `ref-consistency`, and every line of its details block is
that `not found in lockfile` form for an identity equal to root `apm.yml`'s own git+path entry for
`plugins/<name>` (derived by `check-executables-allow-sync`'s rule). Each `plugins/<name>/apm.yml`
must also exist in the working tree and be absent from the **local** `origin/main`, which must
resolve; nothing is fetched. Any other output fails closed. The waiver lapses for a plugin by
itself: once it is on `origin/main`, the follow-up PR that records it in the lock is required.
`tests/test-apm-audit-ci-waiver.sh` covers it.
**Dropping `--ci` for package directories was considered and rejected.** It is the smaller change
and it is wrong. Verified on apm 0.28.0, and again on 0.39.3 (holocron#272), against a scratch