Skip to content

fix: correct regex syntax in governance hook for linked-issues detection - #1494

Merged
ashleyshaw merged 1 commit into
developfrom
fix/governance-hook-regex-syntax
Aug 4, 2026
Merged

fix: correct regex syntax in governance hook for linked-issues detection#1494
ashleyshaw merged 1 commit into
developfrom
fix/governance-hook-regex-syntax

Conversation

@ashleyshaw

Copy link
Copy Markdown
Member

Linked issues

Fixes#1489

Context

  • Severity/Impact: High (critical governance validation bug)
  • Affected versions/environments: develop branch

Reproduction

The governance validation hook fails to detect issue references:

# This should detect the issue but doesn't due to regex bug
pr_body="Fixes #1489"echo"$pr_body"| grep -qiE "(fixes|resolves|closes|relates to)\s+#[0-9]+"# FAILSecho"$pr_body"| grep -qiE "(fixes|resolves|closes|relates to)[[:space:]]+#[0-9]+"# WORKS

Root Cause

Line 102 of hooks/pr-merge-governance-validator.sh uses \s+ (POSIX character class) which is NOT supported by grep -E (ERE regex). The correct ERE syntax is [[:space:]]+.

Fix Summary

  • Replace unsupported \s+ with ERE-compatible [[:space:]]+ in regex pattern
  • One-line change enabling proper detection of linked issues in PR bodies
  • No impact on other validation logic

Verification

  • Regex fix verified locally with multiple test cases
  • Commit includes only the necessary fix (clean, minimal change)
  • No merge artifacts or unrelated changes

Changelog

Fixed


Checklist (Global DoD / PR)

  • All AC met and demonstrated
  • Tests added/updated (unit/E2E as appropriate)
  • Code quality verified (minimal, focused fix)
  • Docs/readme/changelog updated (if user-facing)
  • Security checklist completed (where relevant)
  • Code/design reviews approved
  • CI green; linked issues closed; release notes prepared (if shipping)

Fixes critical regex bug in hooks/pr-merge-governance-validator.sh line 102.
The hook used `\s+` (POSIX character class) which is NOT supported by
grep -E (ERE regex). The correct syntax for ERE is `[[:space:]]+`.
This bug prevented the governance hook from detecting linked issues
(Fixes #XXX, Relates to #XXX) and incorrectly blocked valid PR merges.
Impact: Governance validation now correctly detects issue references
and allows valid PRs with linked issues to merge.
Fixes#1489
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@coderabbitai

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@ashleyshaw, you've reached your PR review limit, so we couldn't start this review.

Next review available in:51 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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 9289fdc8-fab0-4915-94f4-9d29cff7f9ee

📥 Commits

Reviewing files that changed from the base of the PR and between 8b811f8 and 555b80e.

📒 Files selected for processing (1)
  • hooks/pr-merge-governance-validator.sh

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actionsgithub-actionsBot added status:needs-review Awaiting code review type:bug Bug or defect priority:normal Default priority area:scripts Scripts & tooling labels Aug 4, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⏱️ Aging and SLA annotation

  • Age: 0 day(s)
  • SLA state: Within SLA
  • Thresholds: warn at 7 days, breach at 14 days
  • Last updated: 2026-08-04T14:21:47.308Z

Maintained by project-meta-sync workflow.

@github-actionsgithub-actionsBot added type:chore Chore / small hygiene change meta:needs-changelog Requires a changelog entry before merge labels Aug 4, 2026
@mergify

mergifyBot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@ashleyshaw
ashleyshaw merged commit 300e500 into developAug 4, 2026
21 of 23 checks passed
@ashleyshaw
ashleyshaw deleted the fix/governance-hook-regex-syntax branch August 4, 2026 14:22
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #1494

CI Status:success
Files changed: 1
Risk Distribution: 0 critical, 0 high, 0 medium, 1 low

Recommendations

  • Ready to proceed pending human review

@ashleyshawashleyshaw self-assigned this Aug 4, 2026
@ashleyshawashleyshaw added this to the v1.0 milestone Aug 4, 2026
ashleyshaw added a commit that referenced this pull request Aug 4, 2026
…h conflict resolution
Squashed merge of PR #1494 missing changes:
- Added PR merge governance validation changelog entry
- Added governance hook compliance note to gitleaks-update.yml
- Resolved conflicts with concurrent CHANGELOG updates from PR #1422Fixes#1489, completes PR #1494 improvements.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:scriptsScripts & toolingmeta:needs-changelogRequires a changelog entry before mergepriority:normalDefault prioritystatus:needs-reviewAwaiting code reviewtype:bugBug or defecttype:choreChore / small hygiene change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: PR #1488 governance validation hook has regex bug + process workflow gaps

1 participant

@ashleyshaw