fix(pr-review): count only filled text in the description triage (#2604)

Merged
DO
7d ago
+398-4

Summary

pr-review's description triage now counts only text the author filled in. It drops HTML comments, headings with nothing under them and empty Label: lines before the keyword match, and it recognises the org default template's headings. Closes #2604.

Problem

sc_description_missing matched keywords in the raw body, so an unfilled template passed on its own guidance comments and bare headings. #1976 went through that way with this repo's template. The org default template that combsmith/.github#1566 adds (Why / What changed / What to look at / Decisions and protected edits, with Risk:, Rollback: and Monitoring: lines) scored 1 of 5 missing when unfilled, while an empty body scores 5 and escalates.

Risk

Medium-low. scripts/lib/safety-checks.sh only: _sc_desc_filled_text is new and sc_description_missing reads its output. More pull requests can now escalate on description quality: any whose body is still an unfilled template. dev-lead's body backfill keys on the same count, so it now repairs a dev-lead body that is an unfilled template; its own generated bodies still score 0.

Test plan

  • tests/test_safety_checks.bats: 21 new tests. The unfilled org template scores exactly like an empty body (5 missing), naming #1976; the filled template scores 0; a #1976-shaped body (the template comment with its opener deleted) scores 5. Then one case each for: comment-only words, an unclosed comment at a line start, an empty heading, an empty Label: line, a plain label over a list, a nested list label, ## Why, the "Checks and reviews" block, an arrow in prose or mermaid, comment markers inside code, dev-lead's body for an issue that quotes <!--, # lines inside a fence, ## Risk: low headings, subheadings, the <summary> tag, numbered labels and rules, tab indents, and CR line ends.
  • tests/test_dev_lead_pr_body.bats: the AC #4 test asserted the unfilled template passes, which is this bug. It now checks the template filled (0|) and unfilled (like an empty body). The commit carries a Test-Change-Justification: trailer.
  • scripts/test-local.sh on the three suites that source the lib: 22/22, 81/81, 8/8. shellcheck is clean. The awk is POSIX only; I ran the probes with gawk and with BSD awk.
  • Reviews: Claude review, 9 findings (4 major false escalations: arrows, <!-- in code, ## Risk: low headings, subheadings; plus the summary tag, numbered labels and rules, tabs, the template snapshot), all taken. Security read: no high or medium; 3 low (the arrow rule, CR-only line ends, the body as one jq argument), all taken. Gemini: tabs, taken. Graphite: the arrow rule, taken.
  • pr-review on 30ea5358: its blocker was CI still running (now green); info taken in b407217c: a failed jq filter now warns on stderr (the text still reads as empty, so the body escalates, the safe direction), pinned by a new test that fails on the earlier script. Suites 113/113 (safety checks plus dev-lead body). Readers on b407217c: Claude review and security read, none.

Rollback

Revert this pull request. No state is written; the triage reads the body on each run.

Monitoring

pr-review's triage findings: a description-quality escalation on a pull request whose body is filled in would be a false positive to report on #2604. Channels: this rides the next autocut to pr-review/v1-next and reaches stable by ring promotion. The org default template in combsmith/.github#1566 waits until this is on stable.

Interaction contract

  • N/A — this PR does not add or change an agentic role.

Checklist

  • shellcheck scripts/*.sh passes for any changed shell scripts.
  • Docs updated where behavior or standards changed (the function's header comment).

🤖 Generated with Claude Code