andreahlert opened a new pull request, #238:
URL: https://github.com/apache/airflow-steward/pull/238

   ## What
   
   Fixes a latent correctness bug in `skill-validator`'s `parse_frontmatter`, 
surfaced by a code review.
   
   ### The bug
   
   `parse_frontmatter` treated any blank line as a terminator for the current 
key. A YAML block scalar (`|` or `>`) with a paragraph break (a blank line 
between two indented paragraphs) silently lost everything after the first 
paragraph.
   
   Two consequences:
   
   1. `validate_frontmatter` measures `len(fm["description"]) + 
len(fm["when_to_use"])` against `MAX_METADATA_CHARS` (the Claude Code 
truncation budget). With the dropped paragraphs the measurement was too small, 
so frontmatter that actually exceeded the budget could pass the check.
   2. `validate_principle_compliance` and `validate_trigger_preservation` only 
saw the truncated string, missing forbidden patterns or trigger phrasing that 
lived in the dropped paragraphs.
   
   ### Why latent
   
   No existing SKILL.md frontmatter currently uses a paragraph break in a block 
scalar, so nothing in-tree exercised the bug. But `init_skill.py` scaffolding 
emits multi-line `description` and `when_to_use` blocks, and any author writing 
a two-paragraph description would have been silently mis-validated.
   
   ### The fix
   
   In real YAML, a blank line inside a block scalar is part of the value, not a 
terminator. Only a new top-level key finalises the current value. The parser 
now appends blank lines to the value lines and lets `.strip()` at finalisation 
discard leading/trailing blanks so single-line values are unaffected.
   
   ## Changes
   
   - `src/skill_validator/__init__.py` — `parse_frontmatter`: blank line is 
content, not terminator
   - `tests/test_validator.py` — regression test for a `|` block scalar with an 
internal blank line
   
   ## Validation
   
   - `pytest`: 77 passed
   - `ruff check` / `ruff format` / `mypy`: clean
   - `prek` including `skill-validate (.claude/skills/**)`: all hooks pass — 
every existing SKILL.md still validates after the parser change


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to