Uh oh!
There was an error while loading. Please reload this page.
refactor(validation): P1.1 - Unify branch name validators - #2300
refactor(validation): P1.1 - Unify branch name validators#2300ashleyshaw wants to merge 1 commit into
Conversation
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✅ Template check passed after update. Thanks for fixing the PR description. |
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
❌ Branch Name Validation FailedThe branch name Required Format
Allowed Branch Types
Valid Examples
Invalid Examples
SolutionRename your branch to follow the pattern and update the PR. For more information, see docs/BRANCHING_STRATEGY.md. |
Linked issues
Relates to #1967 (CI Validation Issues: Branch Naming & Gitleaks Discrepancies)
Relates to #1755 (Branch Naming Enforcement Workflow)
Summary
Unified the branch name validation scripts to enforce identical strict pattern across all validation layers. This eliminates the divergence between
.cjs(strict) and.js(permissive) validators that was causing inconsistent branch naming enforcement.Problem Addressed:
.cjsvalidator enforced strict{type}/{scope}-{title}pattern.jsvalidator allowed permissive{type}/{anything}pattern with dots.js(permissive), allowing invalid branches to pass validationrelease/v1.0.0failed .cjs but passed .jsSafety Nets
scripts/validation/__tests__/validate-branch-name.test.jsApproach
Structural changes (APIs, patterns):
.jsvalidator regex from^(${ALLOWED_PREFIXES.join("|")})/[a-z0-9.-]+$to strict^(${ALLOWED_PREFIXES.join("|")})/([a-z0-9]+(?:-[a-z0-9]+)*)-([a-z0-9]+(?:-[a-z0-9]+)*)$.cjsinstead of.js(strict validator is canonical)Dead code removed: No (both validators remain;
.jsmay be used elsewhere)Testing
Unit Tests: ✅ All 38 tests pass
Validation Test Matrix:
release/v1.0.0chore/releasefeat/-dash-startfeat/my-feature-with-long-nameclaude/my-featurerelease/v1-0-0Verification
Risk & Rollback
Risk level: Low
release/v1.0.0; must userelease/v1-0-0Rollback plan: Revert commit (single commit; clean history)
Changelog
Changed
.cjsand.jsvalidators to enforce strict{type}/{scope}-{title}format.cjs(strict) validator instead of.js(permissive){type}/{scope}-{short-title}Fixed
release/v1.0.0,chore/release,feat/-dash-startChecklist (Global DoD / PR)
Phase: P1.1 of 6-phase remediation plan