fix(gates): waive lockfile-exists for a package, which is not an install root #137
Reference in New Issue
Block a user
Delete Branch "fix/apm-audit-ci-package-lockfile"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
plugins/onedev(merged in #136) is the first plugin package to declare a real dependency, and that arms a check every previous plugin left vacuous. apm treats any directory holding bothapm.ymlandapm.lock.yamlas an install root. A plugin package is not one — it is content to be installed somewhere else — so it has no green state:apm audit --ciresultapm.lock.yamllockfile-existsfails — "apm.yml declares dependencies but apm.lock.yaml is absent"apm.lock.yamllockfile-existspasses, arming the other nine;driftthen fails demanding the dependency's 8 skills be deployed inside the package at.agents/skills/<name>/SKILL.md.apm lockalso leaves anapm_modules/tree in there.This blocked every push from the repo, not just OneDev work. #136 had to be pushed with
--no-verifyas a result.What
scripts/apm-audit-ci.shreplaces the inlinebash -cloop in.pre-commit-config.yamland waives exactly one failure:lockfile-exists, for a non-root manifest. It fails closed on three axes:lockfile-existsand no other — asserted by matching1 of 1 check(s) failed, so any second failing check changes the count and fails normally;Dropping
--cifor packages was considered and rejectedIt was the smaller change — plain
apm auditin a package reports "No apm.lock.yaml found -- nothing to scan" and exits 0, so the loop would have gone green with a one-word edit. It is wrong. Verified on apm 0.28.0 against a scratch package whose dependency entry carried nogit/path/registryfield:apm auditapm audit --ciMalformed-dependency detection is the reason
gates.mdgives for auditing packages at all, and a package with dependencies is the only kind that can carry a malformed dependency entry. The cheap fix would have discarded the check precisely where it earns its keep.Known weak point
The waiver matches on apm's stdout, so an apm upgrade rewording either line silently turns it off. That direction is safe — it fails the push rather than hiding a defect. Re-verify and update the two patterns rather than widening them.
Also in this commit
apm.lock.yamlgains theonedeventry. #136 could not carry it: the root lockfile cannot recordplugins/onedevuntil apm can resolve it from the remote'smain, and it could not be onmainuntil #136 merged.Verification
scripts/apm-audit-ci.sh— shellcheck cleanapm audit --ci: waived lockfile-exists in plugins/onedev/ (package, not an install root)→ exit 0plugins/_tmpbroken/→ exit 1 (fixture removed)Two tests caught real defects in the first draft and are fixed here:
test-no-pipefail-early-exit-grep.sh—printf ... | grep -qunderset -o pipefailraces:grep -qexits on first match, SIGPIPEs the writer, and the writer's death becomes the pipeline's status. Now uses here-strings.test-adr0020-contract.sh— pins every repo-authored hook'sentry:; updated for the new one.Docs
docs/spec/gates.md—apm-audit-cisection rewritten; "six plugin packages" → seven; the old "arms itself the moment one does not" prediction recorded as having come true🤖 Generated with Claude Code
https://claude.ai/code/session_01NwD8Egs5r4ndqeFLmhusX2