Skip to content

chore(#113): require Testing section in PR body (config-driven)#124

Merged
atlas-apex merged 1 commit into
devfrom
chore/GH-113-pr-require-testing-section
Apr 24, 2026
Merged

chore(#113): require Testing section in PR body (config-driven)#124
atlas-apex merged 1 commit into
devfrom
chore/GH-113-pr-require-testing-section

Conversation

@atlas-apex

Copy link
Copy Markdown
Collaborator

Summary

Replaces the hardcoded Glossary-only section check in validate-pr-create.sh with a config-driven required-sections list. Shipped default is ["Testing", "Glossary"] — matches the canonical PR description shape in workflows/code-review.md. Forks extend, restrict, or replace via .claude/project-config.json.pr.required_sections[].

Closes the gap where pr-quality.md lists Testing as part of the canonical PR description but validate-pr-create.sh only enforced Glossary — asymmetric between written rule and mechanical gate.

  • .claude/hooks/validate-pr-create.sh — rewrote the Glossary block as a generic required-sections loop; loads list + skip marker from the shared config reader ([Chore] Make ticket-prefix whitelist + schema project-configurable (not hardcoded) #109); inline fallback matches shipped defaults.
  • .claude/project-config.defaults.json — extended the pr subtree with required_sections + skip_marker.
  • .claude/hooks/tests/test_validate_pr_required_sections.sh — 8 cases covering pass/fail per section, missing-both, skip marker, case-insensitivity, H3 rejection.
  • docs/rule-audit.md — updated the section 3 row + new [^pr-sections-113] footnote.

Testing

$ bash .claude/hooks/tests/test_validate_pr_required_sections.sh
PASS [body with Summary + Testing + Glossary → pass]
PASS [body missing Testing → block]
PASS [body missing Glossary → block]
PASS [body missing both → block with Testing message]
PASS [body missing both → block also names Glossary]
PASS [skip marker bypasses with warning]
PASS [headings are case-insensitive]
PASS [H3 headings do NOT satisfy the check (require H2)]
PASS: 8   FAIL: 0

Also dogfood: this PR itself has Testing + Glossary + Summary sections — the now-live-on-branch hook let it through when I ran gh api .../pulls -X POST with this body.

What a fork tweaks

Strict teams might add Rollback Plan, a service-delivery team might add Operational Impact:

{
  "pr": {
    "required_sections": ["Summary", "Testing", "Glossary", "Rollback Plan"],
    "skip_marker": "<!-- pr-sections: skip -->"
  }
}

Trivial-PR bypass marker (for lint-only fixes, version bumps):

<!-- pr-sections: skip -->

Printed to stderr as a WARN when it fires, grep-able so bypasses stay auditable.

Scope — what this does NOT do

  • Does not enforce section content quality — empty sections pass. The code-reviewer agent still applies judgement there.
  • Does not enforce section ORDER. Any order, as long as all are present.
  • Does not require H2 vs H3 to be a rejection (it does, but the rejection is by design — the canonical template uses H2).
  • Does not deprecate any existing Glossary-specific logic elsewhere (the code-reviewer agent still calls Glossary out by name).

Follow-ups

  • If teams routinely want content-presence checks (e.g. "Testing section must have at least one command block"), that's a separate enhancement — for now, empty passes.

Glossary

Term Definition
Required sections A list of H2 headings the hook insists must appear in the PR body. Configurable per fork; default [Testing, Glossary].
Skip marker A literal token in the body that bypasses the check with a visible WARN. For trivial PRs; auditable via grep -r.
H2 vs H3 ## Name matches, ### Name does not — the canonical PR template uses H2 for the section anchors.

Closes #113

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants