diff --git a/plugins/kyberforge/.apm/skills/instructions-author/tests/new-instructions.bats b/plugins/kyberforge/.apm/skills/instructions-author/tests/new-instructions.bats index 718e092..d05701f 100644 --- a/plugins/kyberforge/.apm/skills/instructions-author/tests/new-instructions.bats +++ b/plugins/kyberforge/.apm/skills/instructions-author/tests/new-instructions.bats @@ -28,7 +28,21 @@ fill() { "$1" } +# In this repo apm is the one pinned in pyproject.toml/uv.lock, run through +# scripts/lib/apm.sh as `uv run --project --frozen apm` (ADR-0034), +# so these tests exercise 0.39.3 and never whatever apm is on PATH. The pin is +# a declared dependency here, so a missing uv or an apm below the helper's +# minimum FAILS rather than skips: a skip would let `run-tests.sh --strict` go +# green without running these tests. Outside this repo (no helper) the PATH +# apm is used, and its absence still skips. need_apm() { + if [[ -f "$REPO_ROOT/scripts/lib/apm.sh" ]]; then + # shellcheck source=/dev/null + source "$REPO_ROOT/scripts/lib/apm.sh" + require_apm_version || fail "the repo-pinned apm is unavailable; run 'uv sync --frozen' at $REPO_ROOT" + apm() { run_apm "$@"; } + return 0 + fi command -v apm >/dev/null 2>&1 || skip "apm CLI not installed" } @@ -173,10 +187,14 @@ need_apm() { } # --------------------------------------------------------------------------- -# apm behaviour the skill's gotchas rest on (verified against apm 0.28.0) +# apm behaviour the skill's gotchas rest on. Verified against apm 0.28.0, then +# re-pinned to the repo's 0.39.3 (#271), where three behaviours changed: compile +# --target claude writes a CLAUDE.md that imports AGENTS.md, an unquoted applyTo +# fails install closed, and compile warns when applyTo matches no file. The +# skill's own text still describes 0.28.0 in places; see #271's report. # --------------------------------------------------------------------------- -@test "filled scaffold compiles for the Claude target into CLAUDE.md without the description" { +@test "filled scaffold compiles for the Claude target: CLAUDE.md imports AGENTS.md, which drops the description" { need_apm make_package bash "$SCRIPT" my-rule "$ROOT" @@ -185,9 +203,11 @@ need_apm() { run apm compile --target claude assert_success assert [ -f "$ROOT/CLAUDE.md" ] - run grep -F 'Use type hints.' "$ROOT/CLAUDE.md" + run grep -Fx '@AGENTS.md' "$ROOT/CLAUDE.md" assert_success - run grep -F 'Python style rules' "$ROOT/CLAUDE.md" + run grep -F 'Use type hints.' "$ROOT/AGENTS.md" + assert_success + run grep -F 'Python style rules' "$ROOT/AGENTS.md" assert_failure } @@ -221,17 +241,16 @@ need_apm() { assert [ ! -f "$ROOT/CLAUDE.md" ] } -@test "an unquoted applyTo still installs, as a rule with no paths:" { +@test "an unquoted applyTo fails install closed and deploys no rule" { need_apm make_package mkdir -p "$ROOT/.apm/instructions" printf -- '---\ndescription: x\napplyTo: **/*.py\n---\n# T\n\n- a\n' > "$ROOT/.apm/instructions/bad.instructions.md" cd "$ROOT" run apm install - assert_success - assert [ -f "$ROOT/.claude/rules/bad.md" ] - run grep -F 'paths:' "$ROOT/.claude/rules/bad.md" assert_failure + assert_output --partial "Rejected frontmatter in bad.instructions.md" + assert [ ! -f "$ROOT/.claude/rules/bad.md" ] } @test "compile --validate exits 0 and hides the warnings a real compile prints" { @@ -259,5 +278,8 @@ need_apm() { assert_success assert_output --partial "dry-run" refute_output --partial "Failed to parse" - refute_output --partial "Warning" + # 0.39 warns when applyTo matches no file, which an empty package always + # does; any other warning is a parse or validation finding. + run grep -F "Warning" <<< "$(grep -vF "matched no files" <<< "$output")" + assert_failure }