fix(gates): read leading-whitespace frontmatter in check-skill-version-bump
read_version required --- at byte 0 while skill-size-check accepts leading blank lines, so a file one gate passed the other reported as unversioned, and an unversioned merge-base side let an unbumped change through. Match FRONTMATTER_RE, add case 39, and describe the main-tip check and fail-closed cases in the hook entry. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -567,6 +567,27 @@ else
|
||||
fi
|
||||
expect_pass "a skill replaced by a symlink is exempt as deleted" "$F"
|
||||
|
||||
echo ""
|
||||
echo "--- 39. leading blank lines before the frontmatter are parsed ---"
|
||||
# skill-size-check's FRONTMATTER_RE accepts whitespace before the opening
|
||||
# `---`; this gate must read the same shape. Otherwise the pushed side reports
|
||||
# "missing" for a file the commit hook accepted, and a baseline shaped this way
|
||||
# reads as "no valid version", which lets any version pass.
|
||||
# blank_lead <repo> <skill>: prefix that skill's SKILL.md with blank lines.
|
||||
blank_lead() {
|
||||
local f="$1/plugins/demo/.apm/skills/$2/SKILL.md"
|
||||
{ printf '\n \t\n'; cat "$f"; } > "$f.tmp" && mv "$f.tmp" "$f"
|
||||
}
|
||||
F="$(make_fixture)"
|
||||
(cd "$F" && git checkout -q main)
|
||||
blank_lead "$F" alpha; commit "$F" "alpha leading blank"
|
||||
(cd "$F" && git checkout -q feature && git merge -q main)
|
||||
write_skill "$F" demo alpha 'version: "1.0.0"' "lead body"; blank_lead "$F" alpha; commit "$F"
|
||||
expect_fail "unbumped skill with leading blank lines is held to its baseline version" \
|
||||
"alpha: 1\.0\.0 -> 1\.0\.0 \(not above merge-base\)" "$F"
|
||||
write_skill "$F" demo alpha 'version: "1.0.1"' "lead body 2"; blank_lead "$F" alpha; commit "$F"
|
||||
expect_pass "bumped skill with leading blank lines passes" "$F"
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
[[ $FAIL -eq 0 ]]
|
||||
|
||||
Reference in New Issue
Block a user