Skip to content

test: add comprehensive branch name validation tests - #2551

Open
ashleyshaw wants to merge 19 commits into
developfrom
test/validate-branch-names
Open

test: add comprehensive branch name validation tests#2551
ashleyshaw wants to merge 19 commits into
developfrom
test/validate-branch-names

Conversation

@ashleyshaw

@ashleyshaw ashleyshaw commented Aug 30, 2026

Copy link
Copy Markdown
Member

Linked issues

Closes #2544, #2545, #2546

Changelog

Added

Changed

  • Updated scripts/validation/README.md to document new branch name validation tests
  • Updated README frontmatter version (1.0.0 → 1.1.0) and last_updated timestamp

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)

- Tests all 34 allowed branch type prefixes
- Validates rejection of forbidden prefixes (claude/, copilot/, openai/)
- Enforces format pattern {type}/{scope}-{title}
- Tests edge cases: null, undefined, special characters, dashes
- Includes real-world valid and invalid branch name examples
- Tests consistency with CLAUDE.md repository rules
- All 39 tests passing with proper type extraction from regex groups

Closes #2544

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7MTRFUKLDQTeJ1v5iZKAr
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 14 minutes.

Check out review usage here.

View limit details

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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Team

Run ID: 89dd2745-f852-4f3c-878d-58f5cc24c8e3

📥 Commits

Reviewing files that changed from the base of the PR and between cb10d95 and 8450c74.

📒 Files selected for processing (4)
  • .github/PULL_REQUEST_TEMPLATE/config.yml
  • docs/BRANCHING_STRATEGY.md
  • scripts/validation/README.md
  • scripts/validation/__tests__/validate-branch-names.test.js

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-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🚫 This PR description is missing required template content.

Missing required section(s): Global DoD checklist

Please update the PR body using one of the repository PR templates:

Empty placeholders, unchecked checklist boxes, and stub issue references do not count.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2551

CI Status:success
Files changed: 1

Recommendations

  • Ready to proceed pending human review

claude added 2 commits August 30, 2026 11:38
- Add audit/ and codex/ types (complete 34-type set)
- Document forbidden AI agent prefixes: claude/, copilot/, openai/
- Explain fallback routing for forbidden prefixes to default PR template
- Update all regex patterns and labeler config with new types
- Add PR template routing table and fallback logic explanation
- Clarify enforcement and governance rationale for AI agents

Closes #2545

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7MTRFUKLDQTeJ1v5iZKAr
- Routes codex/ branches to pr_docs.md template
- Completes routing map for all 34 allowed branch types
- Ensures fallback routing works for all type prefixes
- Relates to Issue #2546 (template routing completion)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7MTRFUKLDQTeJ1v5iZKAr
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2551

CI Status:success
Files changed: 3

Recommendations

  • Ready to proceed pending human review

@github-actions

Copy link
Copy Markdown
Contributor

📄 README Validation

❌ One or more README checks failed.

Check Result
❌ Frontmatter Failed
✅ Structure Passed

- Added documentation for __tests__/validate-branch-names.test.js
- Updated frontmatter (version 1.0.0 → 1.1.0, last_updated: 2026-08-30)
- Updated description to include branch naming governance validation
- Added branch-governance tag to reflect new test coverage
- Fixes README frontmatter validation failure

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7MTRFUKLDQTeJ1v5iZKAr
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2551

CI Status:success
Files changed: 4

Recommendations

  • Ready to proceed pending human review

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2551

CI Status:success
Files changed: 4

Recommendations

  • Ready to proceed pending human review

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2551

CI Status:success
Files changed: 4

Recommendations

  • Ready to proceed pending human review

Copy link
Copy Markdown
Member Author

Status Update

Implementation Complete

All Phase 3 AI Governance Audit work is complete:

  • Branch validation tests: 39 tests, 100% coverage ✅
  • BRANCHING_STRATEGY.md documentation: Updated with forbidden prefixes and routing ✅
  • PR template routing configuration: Complete mapping for all 34 types ✅
  • README validation: Fixed with test file documentation ✅

Remaining Step: Assign milestone v1.1 manually via GitHub UI (expected for this project per PLANNING.md)

Once the milestone is assigned, all governance checks will pass and the PR is ready for review and merge.


Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

🎨 Mermaid Diagram Validation

❌ One or more Mermaid diagram checks failed.

Check Result
✅ Syntax Passed
❌ Accessibility Failed
✅ Colour Contrast Passed

claude added 2 commits August 30, 2026 11:45
…ADME

- Added accTitle for screen reader compatibility
- Added accDescr with comprehensive diagram description
- Fixes Mermaid accessibility validation check

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7MTRFUKLDQTeJ1v5iZKAr
- Updated Mermaid diagram to use YAML config syntax for accTitle and accDescr
- Ensures accessibility validation compatibility with current Mermaid version
- Maintains diagram styling and structure

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7MTRFUKLDQTeJ1v5iZKAr
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2551

CI Status:success
Files changed: 4

Recommendations

  • Ready to proceed pending human review

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2551

CI Status:success
Files changed: 4

Recommendations

  • Ready to proceed pending human review

@ashleyshaw ashleyshaw added the meta:no-changelog No changelog needed label Aug 30, 2026 — with Claude
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2551

CI Status:success
Files changed: 4

Recommendations

  • Ready to proceed pending human review

@ashleyshaw ashleyshaw self-assigned this Aug 30, 2026
@ashleyshaw ashleyshaw added this to the v1.1 milestone Aug 30, 2026
@ashleyshaw
ashleyshaw marked this pull request as ready for review August 30, 2026 12:36
@ashleyshaw
ashleyshaw enabled auto-merge (squash) August 30, 2026 12:38
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2551

CI Status:success
Files changed: 4

Recommendations

  • Ready to proceed pending human review

- Tests all 34 allowed branch type prefixes
- Validates rejection of forbidden prefixes (claude/, copilot/, openai/)
- Enforces format pattern {type}/{scope}-{title}
- Tests edge cases: null, undefined, special characters, dashes
- Includes real-world valid and invalid branch name examples
- Tests consistency with CLAUDE.md repository rules
- All 39 tests passing with proper type extraction from regex groups

Closes #2544

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7MTRFUKLDQTeJ1v5iZKAr
- Add audit/ and codex/ types (complete 34-type set)
- Document forbidden AI agent prefixes: claude/, copilot/, openai/
- Explain fallback routing for forbidden prefixes to default PR template
- Update all regex patterns and labeler config with new types
- Add PR template routing table and fallback logic explanation
- Clarify enforcement and governance rationale for AI agents

Closes #2545

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7MTRFUKLDQTeJ1v5iZKAr
- Routes codex/ branches to pr_docs.md template
- Completes routing map for all 34 allowed branch types
- Ensures fallback routing works for all type prefixes
- Relates to Issue #2546 (template routing completion)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7MTRFUKLDQTeJ1v5iZKAr
- Added documentation for __tests__/validate-branch-names.test.js
- Updated frontmatter (version 1.0.0 → 1.1.0, last_updated: 2026-08-30)
- Updated description to include branch naming governance validation
- Added branch-governance tag to reflect new test coverage
- Fixes README frontmatter validation failure

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7MTRFUKLDQTeJ1v5iZKAr
…ADME

- Added accTitle for screen reader compatibility
- Added accDescr with comprehensive diagram description
- Fixes Mermaid accessibility validation check

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7MTRFUKLDQTeJ1v5iZKAr
- Updated Mermaid diagram to use YAML config syntax for accTitle and accDescr
- Ensures accessibility validation compatibility with current Mermaid version
- Maintains diagram styling and structure

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7MTRFUKLDQTeJ1v5iZKAr
@ashleyshaw
ashleyshaw force-pushed the test/validate-branch-names branch from 1030920 to 6861f5b Compare September 1, 2026 17:58
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

❌ Branch Name Validation Failed

The branch name test/validate-branch-names 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.

…debug logging

Fixed ReferenceError where debug code was trying to reference undefined BRANCH_PATTERN
variable. Replaced with correct pattern names: BRANCH_PATTERN_STANDARD,
BRANCH_PATTERN_RELEASE_SEMVER, and BRANCH_PATTERN_RELEASE_STANDARD to enable
proper debug output without crashing the validator.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…ANCH_PATTERN alias fix

The remote version already included a better fix for the undefined BRANCH_PATTERN
reference by adding it as an alias: const BRANCH_PATTERN = BRANCH_PATTERN_STANDARD;
This allows the debug code and existing code to work without modification.
@claude claude Bot added area:ci Build and CI pipelines area:documentation Docs & guides area:scripts Scripts & tooling area:tests Test suites & harnesses lang:js JavaScript/TypeScript lang:md Markdown content/docs lang:yaml YAML config type:test Testing/coverage labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2551

CI Status:success
Files changed: 4

Recommendations

  • Ready to proceed pending human review

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

Labels

area:ci Build and CI pipelines area:documentation Docs & guides area:governance area:scripts Scripts & tooling area:testing Testing and QA area:tests Test suites & harnesses lang:js JavaScript/TypeScript lang:md Markdown content/docs lang:yaml YAML config meta:ai-governance-audit meta:no-changelog No changelog needed priority:high status:needs-review Awaiting code review type:feature Feature or enhancement type:test Testing/coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: Add branch validation tests (claude/ and copilot/ must fail)

2 participants