fix(core): validate-adapter.sh's --no-import-syntax flag is a no-op #115
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
plugins/core/.apm/skills/provider-adapter-author/scripts/validate-adapter.shaccepts--no-import-syntax, documents it inusage(), and a skill Gotcha instructs the agent to pass it for providers without an import mechanism. The flag changes no outcome.The bug
validate-adapter.sh:98-101:import_linesis derived by filtering lines that containAGENTS.md, so it is a strict subset of the condition it is OR'd with.bool(import_lines)can only be true when"AGENTS.md" in adapter_contentis already true. Both branches therefore reduce to the same expression, and the flag is inert.Confirmed empirically during #99 wave 3, on a
.mdcfixture carrying a plain-text pointer and no@AGENTS.mdline: exit 0 both with and without the flag.Why it matters
The flag exists to express a real distinction — Cursor and Copilot have no
@-import mechanism, so an adapter that points at AGENTS.md in prose is correct for them and should not be judged against an import line. That distinction is currently unenforced in either direction:The check is weaker than intended in the other direction too: because
has_referenceis satisfied by the bare stringAGENTS.mdappearing anywhere in the file, an adapter that merely mentions AGENTS.md in a comment passes the reference check without deferring to it at all.How it surfaced
A wave-3 retrofit rewrote the skill's Gotcha from a plain instruction into an assertion about script behaviour:
That sentence is false, and it was carrying the rhetorical weight of the surrounding rule. The Gotcha is being reverted to the old instruction form in the retrofit; this issue tracks the underlying script defect, which predates it.
Suggested fix
Decide what the flag should mean, then make the branches differ. The likely intent:
--no-import-syntax: require a prose pointer, and do not require an@AGENTS.mdline.AGENTS.mdsomewhere in the file.That makes the default branch stricter, so check the existing adapters in this repo before tightening it — the change could turn up pre-existing failures, which is arguably the point.
Worth adding a test that asserts the two branches disagree on at least one fixture. A flag whose branches are provably identical is the kind of thing a test would have caught at authoring time.
Files
plugins/core/.apm/skills/provider-adapter-author/scripts/validate-adapter.sh:98-101— the dead branchplugins/core/.apm/skills/provider-adapter-author/tests/— where the disagreement test belongsRelated
Found during #99 wave 3. Distinct from #110 (
BOUNDARY_ARROWregex) and #111 (provenance escape hatch).Fixed on
refactor/adr0020-skill-retrofit(not yet pushed — the PR body will carry the close)Implemented exactly as the suggested fix specifies. The branches now differ:
import_linesis no longer OR'd with the superset it is derived from, and the default branch now requires an actual@-import line rather than the bare stringAGENTS.mdappearing anywhere in the file — closing the second, weaker-than-intended direction this issue also flagged. The--no-import-syntaxbranch requires a prose pointer, so an inert@AGENTS.mdline with no prose does not satisfy it either.The disagreement test you asked for exists.
tests/validate-adapter.bats:plus the converse guard,
with --no-import-syntax, an inert @AGENTS.md line alone is not a prose pointer. A flag whose branches are provably identical now fails the suite.Also added, beyond the issue's scope: the two malformed
--max-linesinvocations (flag as final argument with no value; non-numeric value) now report a real error instead of failing silently.Suite result, run through
tests/run-bats.sh: 14 tests, 14 ok.On the warning about pre-existing failures: it did not materialise. The repo has two adapters —
CLAUDE.md(@AGENTS.md) andproviders/claude-code/CLAUDE.md(@~/.agents/AGENTS.md,@~/.claude/core/instructions/governance.md). Both carry real@-imports and both still exit 0 under the stricter default. Nothing was tightened into a break.