fix(gates): re-run the full root audit after the unlanded-plugin waiver
Why: on apm 0.39.3 a failing ref-consistency stops the root run after three checks, so while the unlanded-plugin waiver applied, the other twelve root checks (content-integrity, hook-approval-pins, local-bundle-hooks, exec-status-current, deployed-files-present, ...) never ran. Implementation notes: once the waiver's conditions hold, the hook copies the working tree (minus .git and .venv) into a mktemp dir. There it drops only the waived plugins' dependencies.apm items, checks the diff is deletions only, and runs git init with the same origin. It then runs apm audit --ci in the copy, and passes only on exit 0 with "All 15 check(s) passed". A copy was chosen over a trap-guarded in-place swap of apm.yml: it never writes the working tree, so the tree stays byte-identical even after SIGKILL. The plugin name must now start alphanumeric and contain no "..". Impact: tests cover a failing, short, or non-zero re-run; a one-of-three failure on another row; a duplicated details header; and dotted names. Each guard was mutation-checked. On this branch the re-run reports all 15 checks passing. Refs: #179 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
1 parent
aaa73dddd3
commit
e14fca123d
3 files changed
+253
-11
No files matched your search
+20
-3
@@ -1245,9 +1245,26 @@ the root run to three checks (holocron#179), so the hook waives it only when the
|
||||
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.
|
||||
resolve; nothing is fetched. A plugin name must start with a letter or digit and may not contain
|
||||
`..`. 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.
|
||||
|
||||
**The waiver re-runs the full root check set before it passes.** The cut-short run never reaches the
|
||||
other twelve root checks (`content-integrity`, `hook-approval-pins`, `local-bundle-hooks`,
|
||||
`exec-status-current`, `deployed-files-present` and the rest), so the three-check result alone
|
||||
would let a defect in any of them through. Once the conditions above hold, the hook copies the working
|
||||
tree (minus `.git` and `.venv`) into a `mktemp -d` directory with `tar`. In the copy it drops only the
|
||||
`dependencies:` > `apm:` items whose `path:` names a waived plugin, checks that the reduced
|
||||
`apm.yml` differs from the original by those deletions alone, and runs `git init` with the same
|
||||
`origin` URL, the only git state apm reads. It then runs `apm audit --ci` there. The push passes only
|
||||
if that run exits 0 and prints `All 15 check(s) passed`. On this branch (holocron#179, apm 0.39.3) it
|
||||
does, and the hook prints `root re-run without the unlanded plugins: All 15 check(s) passed`. A copy
|
||||
was chosen over swapping `apm.yml` in place under a `trap`: the copy never writes the working tree, so
|
||||
the tree stays byte-identical even after `SIGKILL`, and a concurrent apm never sees a reduced
|
||||
manifest. `.git` is not copied because in a linked worktree it points into the shared gitdir. `.venv`
|
||||
is not copied because apm runs from the real one via `uv run --project`. The scratch directory is
|
||||
removed on exit, including on `INT`, `TERM` and `HUP`. The script header records the full reasoning.
|
||||
`tests/test-apm-audit-ci-waiver.sh` covers the waiver, the re-run, and each of its guards.
|
||||
|
||||
**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
|
||||
|
||||
Reference in new issue
Block a user