feat(policy): warn on consumer PR-template drift (template conformance guard)#54
Merged
Merged
Conversation
Add a structure-only validator (and formatter) that checks a committed PR template has the contract's required headings in the required order, without the body-fill checks (checked boxes, placeholders, substantive content) that a template legitimately lacks. Catches the drift class where a repo's own PULL_REQUEST_TEMPLATE.md cannot itself pass the gate it is subject to. Refs #53 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a warning-only step to the pr-contract job that fetches the caller repo's .github/PULL_REQUEST_TEMPLATE.md and validates its structure against the contract, surfacing drift directly instead of via a confusing body-check failure. Phase 1 = warning-only (never hard-fails), matching the evidence parser. Reaches consumers only after a @v1 retag. Refs #53 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A consumer repo's
.github/PULL_REQUEST_TEMPLATE.mdis copied at onboarding and tracked by nothing afterward, so it silently rots out of sync with the strict PR contract. When repo-template adopted the strict structure on 2026-05-31, onboarded repos kept their pre-strict copies — and filling out the repo's own template verbatim then failsrepo-required-gate / pr contractwithmissing_heading: ### Verification Notes. This bit hudson-bend (#43) and was found in archon + jma-ui. Diagnosed via /page-gm.This adds a warning-first guard:
validatePrTemplate+formatPrTemplateResultinscripts/pr-contract.mjs— structure-only (headings present + in order; no checked-box/placeholder/substance checks, which a template legitimately lacks).repo-required-gate.yml'spr-contractjob that fetches the caller's committed template and surfaces drift directly. Never hard-fails (Phase 1, matches the evidence parser). A later opt-in input can promote it to an error.With this, drift is caught on the first PR after a template change instead of after a confusing gate failure.
Verification
npx vitest run— 121 passed (incl. 5 newvalidatePrTemplatecases)actionlint .github/workflows/repo-required-gate.yml— cleanVerification Notes
New tests assert the canonical template passes and that a pre-strict template (the exact hudson-bend#43 shape:
## Changelog, no## Docs / Changelog) and a notes-less template both warn withmissing_heading. The workflow step reuses the already-checked-out validator, is gated to non-draft PRs, runs with!cancelled()so drift is reported even when the body check fails, and degrades tocore.info/core.warning(never a hard failure) on a 404 / read error / import error.Docs / Changelog
Linked Issue
Closes #53
Risks
@v1retag — holding that per owner instruction. Until retagged, this is inert for consumers pinned at@v1.agent/codex/36-pr-contract-gate(stale, no PR) also editsrepo-required-gate.yml; this diff is additive to ease any future merge.v1back).