Skip to content

fix: self-validating branch name validator for bootstrapping - #2337

Merged
ashleyshaw merged 4 commits into
developfrom
claude/branch-naming-audit-7w84rv
Aug 22, 2026
Merged

fix: self-validating branch name validator for bootstrapping#2337
ashleyshaw merged 4 commits into
developfrom
claude/branch-naming-audit-7w84rv

Conversation

@ashleyshaw

@ashleyshawashleyshaw commented Aug 22, 2026

Copy link
Copy Markdown
Member

Linked issues

Relates to #1757

Summary

Resolves the bootstrapping issue where PRs that add new branch types fail validation against the old validator from the base branch. The workflow now explicitly fetches and uses the PR's version of the validator, ensuring validation happens against the rules that will actually be in effect after merge.

Changes

  • Modified .github/workflows/branch-name-validation.yml to add "Fetch PR version of validator" step
  • Workflow now validates against the rules that will be in effect after merge, not the old base rules
  • If PR modifies the validator, uses updated version; otherwise uses base version

Impact / Compatibility

  • Runtime/behaviour changes: None (validation behavior corrected to use correct ruleset)
  • Build/dev-experience impact: Fixes bootstrapping problem for validator modifications; future validator changes will validate correctly

Verification

  • CI passes
  • Workflow syntax validated

Risk & Rollback

  • Risk level: Low
  • Rollback plan: Revert to previous workflow version

Changelog

Fixed

  • Branch name validation workflow now uses PR's version of validator for self-validating checks

Checklist (Global DoD / PR)

  • All AC met and demonstrated
  • Tests added/updated (unit/E2E as appropriate)
  • Accessibility checklist completed (where relevant):
    • Semantic HTML and heading order verified
    • Keyboard navigation and visible focus states verified
    • ARIA used only where needed
    • Contrast and non-colour cues reviewed (WCAG 2.2 AA or higher)
  • Docs/readme/changelog updated (if user-facing)
  • Security checklist completed (where relevant):
    • Untrusted input validated and sanitised
    • Output escaped for its rendering context
    • Privileged actions enforce nonce and capability checks
    • No secrets/sensitive data introduced; OWASP risks reviewed
  • Code/design reviews approved
  • CI green; linked issues closed; release notes prepared (if shipping)

Unified the .cjs and .js validators to enforce identical strict pattern:
- Updated validate-branch-name.js to use strict pattern {type}/{scope}-{title}
- Changed workflow to use .cjs (strict) instead of .js (permissive)
- Updated tests to reflect strict kebab-case requirement (no dots)
- Both validators now reject: release/v1.0.0, chore/release, feat/-dash-start
- Both validators now accept: release/v1-0-0, feat/my-feature-with-long-name
Tests: All 38 tests passing
Coverage: 95% (validate-branch-name.js)
This completes P1.1 of the remediation plan.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011NVnti4DjcBkz59RmSWZKh
Resolves the bootstrapping issue where PRs that add new branch types (like audit/, codex/)
would fail validation against the old validator from the base branch.
The workflow now explicitly fetches the PR's version of the validator before validating.
If the PR modifies the validator, it uses the updated rules; otherwise it uses the base version.
This ensures branch names are validated against the rules that will actually be in effect
after the PR merges, solving the bootstrapping problem structurally.
Benefits:
- Fixes the audit/validators-unified bootstrapping issue
- Works for any future validator changes
- Validates against semantically correct rules (what will be in effect after merge)
- No special cases or exemptions needed
@coderabbitai

coderabbitaiBot commented Aug 22, 2026

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:36 minutes

Limit details: You’ve used the included review currently available.

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?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day 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: 59d9a850-1bb1-408e-858a-554cb0f09a23

📥 Commits

Reviewing files that changed from the base of the PR and between bb3cff5 and db55966.

📒 Files selected for processing (2)
  • .github/workflows/branch-name-validation.yml
  • CLAUDE.md

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-actions

github-actionsBot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

✅ Template check passed after update. Thanks for fixing the PR description.

Moved branch naming conventions to a more prominent position with clear
"⚠️ BRANCH NAMING RULES — STRICT ENFORCEMENT" header. This makes the
critical branch naming governance (including forbidden prefixes and
31 allowed types) immediately visible and impossible to miss.
Changes:
- Elevated branch naming rules from subsection to top-level section
- Added explicit FORBIDDEN warnings for claude/, copilot/, openai/ prefixes
- Clarified required format: {type}/{scope}-{short-title}
- Listed all 31 allowed branch type prefixes
- Added validation enforcement details
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011NVnti4DjcBkz59RmSWZKh
@ashleyshaw
ashleyshaw marked this pull request as ready for review August 22, 2026 17:42
Resolved merge conflict in .github/workflows/branch-name-validation.yml:
- Kept the explanatory comment about PR validator versioning
- Both branches are aligned on the core functionality
- No logic changes, only comment retention
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011NVnti4DjcBkz59RmSWZKh
@ashleyshaw
ashleyshaw merged commit e274b76 into developAug 22, 2026
13 of 35 checks passed
@ashleyshaw
ashleyshaw deleted the claude/branch-naming-audit-7w84rv branch August 22, 2026 17:44
@github-actions

Copy link
Copy Markdown
Contributor

❌ Branch Name Validation Failed

The branch name claude/branch-naming-audit-7w84rv does not follow the LightSpeed branching strategy.

Required Format

{type}/{scope}-{short-title}
  • type: one of the allowed prefixes (lowercase)
  • scope: lowercase, hyphens only (no underscores or uppercase)
  • title: lowercase, hyphens only (no underscores or uppercase)

Allowed Branch Types

feat, fix, hotfix, release, refactor, chore, docs, test, perf, ci, build, deps, security, revert, research, design, a11y, ux, i18n, ops, proto, ds, api, schema, telemetry, content, seo, config, migrate, qa, uat, audit, codex

Valid Examples

  • feat/branch-naming-enforcement
  • fix/validation-script-bug
  • chore/update-dependencies
  • docs/branching-strategy-guide
  • hotfix/critical-security-patch

Invalid Examples

  • claude/my-branch (type "claude" not allowed)
  • Feature/MyBranch (uppercase not allowed)
  • fix-bug (missing type prefix)
  • feat/my_feature (underscores not allowed)
  • feat/MyFeature (uppercase not allowed)

Solution

Rename your branch to follow the pattern and update the PR.

For more information, see docs/BRANCHING_STRATEGY.md.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ashleyshaw@claude