Uh oh!
There was an error while loading. Please reload this page.
fix: correct regex syntax in governance hook for linked-issues detection - #1490
fix: correct regex syntax in governance hook for linked-issues detection#1490ashleyshaw wants to merge 28 commits into
Conversation
…ithub-script logging
…ogging and proper error handling
… avoid script syntax breaking
…b-script complexity
…bles to avoid special character issues
…simpler and more reliable
…tion (test from develop)
…ests, 100% coverage of 6 assignment rules)
Add portable governance guardrail to block PR merges that violate: 1. PR template requirements (based on branch prefix per AGENTS.md) 2. Linked issue requirement (Fixes #XXX or Relates to #XXX) Hook runs before gh pr merge succeeds, providing clear error messages with actionable fixes. Prevents repeated governance violations that were costing tokens and undermining issue tracking. References: - AGENTS.md: PR template routing by branch prefix - CLAUDE.md: Repository structure and governance rules - docs/BRANCHING_STRATEGY.md: Branch naming discipline Hook location: hooks/pr-merge-governance-validator.sh (portable asset) Configuration: .claude/settings.json PreToolUse hook on Bash(gh pr merge *) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Merges latest develop changes while preserving feature branch commits. Resolves conflicts by taking feature branch version of workflow file (feat branch has the final correct Node.js script solution). Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Replace semicolon-separated shell commands with pipe-delimited multiline syntax to avoid YAML parser errors. Preserves set +e behavior for error handling in milestone assignment step. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Replace unsupported \s+ (POSIX character class) with [[:space:]]+ (ERE-compatible) in grep -qiE pattern. Previous syntax would fail to detect 'Fixes#123' patterns and incorrectly block valid PR merges. Fixes issue #1489 (code review finding from PR #1488). Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Warning Review limit reached
Next review available in:2 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Template check passed after update. Thanks for fixing the PR description. |
…ompt Add CONTINUATION_PROMPT_2026-08-04.md documenting: - Critical regex bug fix (PR #1490) - Governance process violations in #1489 - Pre-commit validation hook implementation plan - Root cause analysis and long-term improvements Update README with Phase 2 AI governance process work. Related to issue #1489, PR #1490. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Keep fix branch version with [[:space:]]+ (ERE-compatible). Develop still has old \s+ syntax. Fix takes precedence. Resolves merge conflict in PR #1490. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
🔍 Reviewer Summary for PR #1490CI Status: ❌ Recommendations
|
⏱️ Aging and SLA annotation
Maintained by project-meta-sync workflow. |
Tick the box to add this pull request to the merge queue (same as
|
ashleyshaw
commented
Aug 4, 2026
@Mergifyio queue |
|
There was a problem hiding this comment.
🟡 Not ready to approve
The linked-issues regex can still yield false positives by matching keywords inside longer words, weakening the governance check.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR restores linked-issue detection in the PR merge governance hook by replacing a grep -E-incompatible regex escape with an ERE-compatible whitespace class, unblocking valid merges on develop.
Changes:
- Fix linked-issues
grep -Epattern by switching from\s+to[[:space:]]+. - Minor Markdown whitespace tweak in
CHANGELOG.md. - Normalise YAML quoting for the scheduled cron expression in
gitleaks-update.yml.
File summaries
| File | Description |
|---|---|
| hooks/pr-merge-governance-validator.sh | Updates the linked-issues detection regex to be compatible with grep -E. |
| CHANGELOG.md | Adjusts spacing around the Unreleased sections. |
| .github/workflows/gitleaks-update.yml | Normalises cron quoting style in the workflow schedule. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| has_linked_issues=false | ||
| if echo "$pr_body" | grep -qiE "(fixes|resolves|closes|relates to)\s+#[0-9]+"; then | ||
| if echo "$pr_body" | grep -qiE "(fixes|resolves|closes|relates to)[[:space:]]+#[0-9]+"; then |
Add word boundary check by requiring keywords to be preceded by either start-of-line or whitespace. This prevents matching keywords inside longer words (e.g., 'prefixes #123' no longer matches 'fixes'). Maintains support for case-insensitive matching and flexible whitespace in 'relates to' pattern. Fixes Copilot review feedback on PR #1490. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
ashleyshaw
left a comment
There was a problem hiding this comment.
Fixed: Improved regex to require keywords at start-of-line or after whitespace to prevent false positives like 'prefixes #123' matching 'fixes'. Pattern now: (^|[[:space:]])(fixes|resolves|closes|relates[[:space:]]+to)[[:space:]]+#[0-9]+. Verified against test cases (6 positive, 6 negative).
🤖 Addressed by Claude Code
ashleyshaw
commented
Aug 4, 2026
ashleyshaw
commented
Aug 4, 2026
Work continued in clean PRs #1494 (regex fix) and #1495 (ESLint config). Closing in favor of those streamlined PRs. What was done in #1490:
Why moving to clean PRs:
Related: #1489 (governance validation improvements) |
Pull request was closed
Linked issues
Fixes#1489
Context
Reproduction
Root Cause
Line 102 of
hooks/pr-merge-governance-validator.shuses\s+(POSIX character class) which is NOT supported bygrep -E(ERE regex). Correct syntax is[[:space:]]+for space/tab/newline matching in ERE.Fix Summary
\s+with ERE-compatible[[:space:]]+in regex patternecho "Fixes #1376" | grep -qiE "(fixes|resolves|closes|relates to)[[:space:]]+#[0-9]+" && echo "PASS" || echo "FAIL"Verification
Risk & Rollback
Changelog
Fixed
[[:space:]]+instead of unsupported\s+(Fixesfix: PR #1488 governance validation hook has regex bug + process workflow gaps #1489)Added
Changed
Removed
Checklist (Global DoD / PR)