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:
@@ -175,12 +175,14 @@ done < "$CHANGED_FILE"
|
||||
# python3 crashing, PyYAML failing to import — is a non-zero exit with no OK /
|
||||
# INVALID line, which the caller reports as a read failure, never as a missing
|
||||
# version. Bytes are decoded explicitly so the caller's locale cannot turn a
|
||||
# non-ASCII SKILL.md into a crash; `\s*` before each `\n` absorbs CRLF.
|
||||
# non-ASCII SKILL.md into a crash; `[ \t\r]*` before each `\n` absorbs CRLF.
|
||||
# Whitespace before the opening `---` is accepted, matching FRONTMATTER_RE in
|
||||
# factory-audit's lib-boundary-resolver.sh, which skill-size-check applies.
|
||||
read_version() {
|
||||
python3 -c '
|
||||
import re, sys, yaml
|
||||
text = sys.stdin.buffer.read().decode("utf-8-sig", errors="replace")
|
||||
m = re.match(r"---[ \t\r]*\n(.*?)\n---[ \t\r]*(\n|\Z)", text, re.S)
|
||||
m = re.match(r"[ \t\r\n]*---[ \t\r]*\n(.*?)\n---[ \t\r]*(\n|\Z)", text, re.S)
|
||||
data = None
|
||||
if m:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user