Files
Holocron/docs/adr/0026-a-plugin-package-is-not-an-install-root.md
T
Defame1297andClaude Opus 5.5 b80c26e064 docs(adr): add dated apm 0.39.3 notes to the 0.28.0 claims
ADRs 0017, 0019, 0021, 0026, 0029 and 0033 get 2026-12-02 forward notes
recording each 0.28.0 claim's result on apm 0.39.3: held, changed, or
not re-run. ADR-0019 gains a note that the executables.allow key is now
the full package identity (#271), not the bare kyberforge#<version>
form it describes. ADR-0034 consequence 4 records the re-check as done.

Refs #272

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 11:49:22 +00:00

5.0 KiB

A plugin package is not an install root — apm-audit-ci waives lockfile-exists for one

Status: Accepted (2026-09-20)

Amended 2026-12-02 (holocron#272): re-verified on apm 0.39.3 in a scratch copy of plugins/mattpocock. Without a package lock, the same line and 1 of 1 check(s) failed appear, so the waiver is unchanged. With one from apm lock, the rest of the root set arms (fourteen more checks, not nine), and drift fails on 74 unintegrated files under .agents/skills/. Two details below changed. A plugin package whose lockfile-exists passes now runs two checks, with content-integrity added. Plain apm audit now prints No recognized deployed primitives found -- nothing to scan. The malformed-entry case still separates --ci (exit 1, now a failing manifest-parse row) from plain apm audit (exit 0), so the rejection of dropping --ci stands.

plugins/onedev is the first plugin package in this repo to declare a real dependency. It pins code.onedev.io/onedev/tod#v4.3.4 so that a consumer installing onedev from the holocron marketplace picks up OneDev's eight TOD skills transitively — a marketplace.packages entry takes a local source: path, so a third-party repo cannot be listed for redistribution on its own, and the wrapper is the only mechanism that carries it.

That arms a check every previous plugin left vacuous, and leaves the package with no green state.

apm audit --ci in a plugin directory runs one check, lockfile-exists. While every plugin apm.yml declared dependencies: {apm: [], mcp: []} it reported No dependencies declared -- lockfile not required and passed. plugins/onedev declares dependencies, so (verified against apm 0.28.0):

  • without a package apm.lock.yaml it fails — apm.yml declares dependencies but apm.lock.yaml is absent, reported as 1 of 1 check(s) failed
  • with one it passes, and passing arms the other nine checks. drift then fails reporting eight unintegrated files at .agents/skills/<name>/SKILL.md — it wants the dependency's skills deployed inside the package. Generating the lockfile with apm lock also creates an apm_modules/ tree in there.

The cause is that apm treats any directory holding both apm.yml and apm.lock.yaml as an install root. A plugin package is not one: it is content to be installed somewhere else. The second state is not a stricter version of the first, it is a category error — a package has no deployment target of its own, so there is nothing for a drift check to be right about.

The hook therefore waives lockfile-exists, and only that, for a non-root manifest. scripts/apm-audit-ci.sh replaces the inline bash -c loop that .pre-commit-config.yaml carried. The waiver fails closed on three axes: the root manifest is never waived whatever it reports; the failing check must be lockfile-exists and no other, asserted by matching 1 of 1 check(s) failed, so any second failing check changes the count and fails the push normally; and output apm does not produce in the recognised shape is a failure.

Dropping --ci for package directories was rejected. It was the smaller change — plain apm audit in a plugin directory 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 no git/path/registry field: apm audit --ci exits 1 naming the missing field, while plain apm audit exits 0 and says nothing. Malformed- dependency detection is the reason docs/spec/gates.md gives for auditing packages at all, and a package with dependencies is the only kind that can carry a malformed dependency entry — so the cheap fix would have discarded the check precisely where it earns its keep, in the one package that newly needs it.

Two alternatives were rejected for making the wrapper pointless or the repo fragile. Dropping the dependency from plugins/onedev turns the gate green immediately, but a consumer installing onedev from the marketplace then receives an empty package, which removes the only reason the wrapper exists. Committing a package lockfile and running apm install inside the package satisfies drift on a machine that has done so, but makes deployed-files-present a fresh-clone failure and commits this repo to maintaining a nested install root per package.

The weak point is stated rather than designed away: the waiver matches on apm's stdout, so an apm upgrade that rewords either line silently turns it off. That direction is safe — it fails the push rather than hiding a defect. Re-verify against the new output and update the two patterns rather than widening them.

This changes shared enforcement, which is why it is recorded here rather than left as a comment. docs/spec/gates.md's apm-audit-ci section carries the operative detail.

(Note, 2026-11-11: plugins/onedev has since been removed. The decision stands: plugins/mattpocock declares dependencies and no primitives of its own, so it is the package the waiver now covers.)