Skip to content

[Chore] Require Testing section in PR body (extend validate-pr-create.sh) #113

@atlas-apex

Description

@atlas-apex

Driver

.claude/rules/pr-quality.md mandates a Glossary section in every PR (enforced by validate-pr-create.sh). It also describes a Testing section as part of the canonical PR description in workflows/code-review.md"Testing: How to verify this works" — but there is no hook checking for it. Result: PRs routinely ship without reviewable test instructions, forcing reviewers to reverse-engineer "how do I know this works?" from the diff.

Scope

Extend validate-pr-create.sh with a required-section check for PR bodies, driven by the same config schema as the issue-structure validator (apexyard#107).

# .claude/project-config.json
pr:
  required_sections:
    - "Summary"
    - "Testing"
    - "Glossary"
  skip_marker: "<!-- pr-sections: skip -->"

Validation:

  1. Extract the PR body from --body / --body-file / stdin.
  2. For each section in pr.required_sections, require an ## <Section> (or ### <Section>) heading followed by non-empty content.
  3. On fail: exit 2 naming the missing section(s).
  4. Skip marker honours legitimate exceptions (trivial dependency bumps, pure version-tag commits).

Acceptance Criteria

  • validate-pr-create.sh blocks on missing Testing section (in addition to the existing Glossary check).
  • Section list reads from project config; ships the canonical three as default.
  • Skip marker passes with a warning.
  • The check is case-insensitive on the heading text, strict on the empty-content rule.
  • Fixtures in .claude/hooks/tests/ cover each missing section and the skip path.
  • docs/rule-audit.md entry updated.
  • Config and helper code shared with apexyard#107 (both hooks use the same reader).

Risks / Dependencies

  • Risk of config drift if the issue hook and the PR hook diverge. Mitigation: shared helper (_lib-read-ticket-schema.sh or equivalent) introduced in apexyard#107.
  • Small risk of friction for PR authors. Mitigation: skip marker + helpful error message.
  • Depends on apexyard#109 (config location) and apexyard#107 (schema reader).

Glossary

Term Definition
Required section A Markdown heading that must be present in the PR body with non-empty content.
Testing section The heading under which the PR author documents how to verify the change — commands, manual steps, screenshots, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — plan-worthy, not urgentenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions