Skip to content

refactor(validation): P1-P2 - Unified validators and agent branch guidance - #2302

Merged
ashleyshaw merged 5 commits into
developfrom
audit/validators-unified
Aug 22, 2026
Merged

refactor(validation): P1-P2 - Unified validators and agent branch guidance#2302
ashleyshaw merged 5 commits into
developfrom
audit/validators-unified

Conversation

@ashleyshaw

@ashleyshawashleyshaw commented Aug 22, 2026

Copy link
Copy Markdown
Member

Summary

Comprehensive branch naming validation remediation: unified divergent validators, fixed post-release sync naming, and added branch guidance to all agents with pre-creation validation.

Phases Delivered:

  • P1.1: Unified branch name validators (.cjs and .js) to enforce identical strict pattern
  • P1.2: Fixed post-release sync branch naming from chore/ to ops/ prefix
  • P2: Added branch naming guidance to all agents and safety gates with pre-creation validation

Problems Addressed

P1.1 - Validator Divergence:

  • .cjs validator enforced strict {type}/{scope}-{title} pattern
  • .js validator allowed permissive {type}/{anything} pattern with dots
  • Workflow used .js (permissive), allowing invalid branches to pass
  • Phase 2 testing showed: release/v1.0.0 failed .cjs but passed .js

P1.2 - Post-Release Sync Violation:

  • Post-release sync used forbidden chore/post-release-sync-main-to-develop prefix
  • Release pipeline violated branch naming governance
  • Changed to ops/post-release-sync-main-to-develop

P2 - Agent Branch Guidance Gaps:

  • 33 of 35 agents had ZERO branch naming guidance
  • Only 2 agents created/validated branches; 1 validated them
  • No portable instruction standard for agents
  • Pre-release validation missing

Changes

P1.1: Unified Validators

Files:

  • scripts/validation/validate-branch-name.js — Updated regex to strict pattern
  • scripts/validation/__tests__/validate-branch-name.test.js — Updated tests (38/38 passing)
  • .github/workflows/branch-name-validation.yml — Changed to use .cjs validator

Pattern Change:

Old: ^(${types})/[a-z0-9.-]+$ (permissive)
New: ^(${types})/([a-z0-9]+(?:-[a-z0-9]+)*)-([a-z0-9]+(?:-[a-z0-9]+)*)$ (strict)

P1.2: Post-Release Sync Naming

Files:

  • docs/ADRs/ADR-003-post-release-sync.md — Updated branch naming (lines 143, 145)
  • docs/BRANCHING_STRATEGY.md — Updated references (lines 400, 495)
  • docs/RELEASE_PROCESS.md — Updated naming (line 288)

Change:

chore/post-release-sync-main-to-develop ❌ (forbidden prefix)
ops/post-release-sync-main-to-develop ✓ (valid)

P2: Agent Guidance & Pre-Creation Validation

P2.1 - Agent Branch Guidance:

  • Added ## Branch Naming section to all 19 spec-based agents
  • Agents document whether they create/validate/reference branches
  • Links to standards documentation

P2.2 - Portable Instruction File:

  • Created instructions/branch-naming.instructions.md (8.9 KB)
  • Comprehensive guide: 31 prefixes, patterns, examples, validation, troubleshooting
  • Portable across all LightSpeedWP projects

P2.3 - Release Agent Pre-Creation Validation:

  • scripts/agents/release.agent.js — Import and validate before git checkout -b
  • Prevents invalid branch names from being created
  • Throws error with actionable message if invalid

P2.4 - 7-Layer Safety Gates:

  • agents/release/gates/release-gates.cjs — Gate 1 now validates release branch names
  • Fails fast if branch name would be invalid
  • Ensures all releases use valid patterns

P2.5 - Agent Spec Template:

  • .github/agents/template.agent.md — Updated with three options
    • Option A: Agents that create branches
    • Option B: Agents that validate branches
    • Option C: Agents that don't create/validate

Validation

Unit Tests

38 tests pass (validate-branch-name test suite)

Validation Test Matrix

BranchBeforeAfterStatus
release/v1.0.0✗ / ✓✗ / ✗Unified (dots rejected)
chore/release✗ / ✓✗ / ✗Unified (missing separator)
feat/-dash-start✗ / ✓✗ / ✗Unified (invalid format)
feat/my-feature✓ / ✓✓ / ✓Consistent ✓
release/v1-0-0✓ / ✓✓ / ✓Valid (hyphens)
ops/post-release-syncN/A✓ / ✓Now valid ✓

Files Changed

  • 22 files modified (28 total changes)
  • 468 additions, 15 deletions
  • 3 commits with clear separation of concerns

Summary of Changes

Agent Specs (19 files):

.github/agents/adr.agent.md
.github/agents/issues.agent.md
.github/agents/labeling.agent.md
.github/agents/linting.agent.md
... (19 total)

Validation & Release (3 files):

scripts/validation/validate-branch-name.js (regex pattern)
scripts/validation/__tests__/validate-branch-name.test.js (tests)
scripts/agents/release.agent.js (pre-creation validation)

Documentation (4 files):

docs/ADRs/ADR-003-post-release-sync.md
docs/BRANCHING_STRATEGY.md
docs/RELEASE_PROCESS.md
instructions/branch-naming.instructions.md (new)

Safety Gates & Templates (3 files):

agents/release/gates/release-gates.cjs (Gate 1 validation)
.github/agents/release.agent.md (expanded guidance)
.github/agents/template.agent.md (template options)

Risk & Rollback

Risk Level: Low

  • Internal validation improvements
  • No breaking changes to user-facing APIs
  • Stricter pattern may reject previously-created branches with dots in versions
  • Validators now reject release/v1.0.0; must use release/v1-0-0

Rollback Plan: Single clean commit per phase; easy to revert if needed

Related Issues

Checklist

  • All phases complete (P1.1, P1.2, P2)
  • All tests passing (38/38)
  • Documentation updated
  • Agents updated with branch guidance
  • Pre-creation validation added
  • Safety gates enhanced
  • Ready for review

Effort: ~23 hours (P1.1: 3h, P1.2: 1.5h, P2: 18.5h estimated)
Status: Ready for code review and merge

@github-actions

Copy link
Copy Markdown
Contributor

❌ Branch Name Validation Failed

The branch name audit/validators-unified 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.

@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:21 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: 4a2a5cad-4da8-4c58-b992-835903b94ec0

📥 Commits

Reviewing files that changed from the base of the PR and between 11b2773 and e3e044a.

📒 Files selected for processing (51)
  • .github/agents/adr.agent.md
  • .github/agents/issues.agent.md
  • .github/agents/labeling.agent.md
  • .github/agents/linting.agent.md
  • .github/agents/meta.agent.md
  • .github/agents/metrics.agent.md
  • .github/agents/mode-demonstrate-understanding.agent.md
  • .github/agents/mode-document-reviewer.agent.md
  • .github/agents/mode-prd.agent.md
  • .github/agents/mode-thinking.agent.md
  • .github/agents/project-meta-sync.agent.md
  • .github/agents/prompt-engineer.agent.md
  • .github/agents/release.agent.md
  • .github/agents/reporting.agent.md
  • .github/agents/reviewer.agent.md
  • .github/agents/task-planner.agent.md
  • .github/agents/task-researcher.agent.md
  • .github/agents/template.agent.md
  • .github/agents/testing.agent.md
  • .github/projects/active/branch-naming-enforcement-2026-08-11/README.md
  • .github/workflows/branch-name-validation.yml
  • AGENTS.md
  • CLAUDE.md
  • agents/ai-readiness-estimator-agent/AGENT.md
  • agents/chat-closure-agent/AGENT.md
  • agents/client-website-discovery-assistant-agent/AGENT.md
  • agents/design-partner-agent/AGENT.md
  • agents/harvest-analytical-agent/AGENT.md
  • agents/linear-advisor-agent/AGENT.md
  • agents/pagespeed-agent/AGENT.md
  • agents/prd-agent/AGENT.md
  • agents/prd-factory-planner-agent/AGENT.md
  • agents/proposal-desk-agent/AGENT.md
  • agents/release/gates/release-gates.cjs
  • agents/task-planner-agent/AGENT.md
  • agents/task-researcher-agent/AGENT.md
  • agents/testing-agent/AGENT.md
  • agents/tour-operator-config-agent/AGENT.md
  • agents/website-content-strategist-agent/AGENT.md
  • agents/website-scope-estimator-agent/AGENT.md
  • agents/woo-config-agent/AGENT.md
  • agents/wp-config-agent/AGENT.md
  • agents/zendesk-support-agent/AGENT.md
  • docs/ADRs/ADR-003-post-release-sync.md
  • docs/BRANCHING_STRATEGY.md
  • docs/QUICK_REFERENCE_BRANCH_NAMING.md
  • docs/RELEASE_PROCESS.md
  • instructions/branch-naming.instructions.md
  • scripts/agents/release.agent.js
  • scripts/validation/__tests__/validate-branch-name.test.js
  • scripts/validation/validate-branch-name.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.

@mergify

mergifyBot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

⚠️ The sha of the head commit of this PR conflicts with #2300. Mergify cannot evaluate rules on this PR. Once #2300 is merged or closed, Mergify will resume processing this PR. ⚠️

@ashleyshaw
ashleyshawforce-pushed the audit/validators-unified branch from 140ad14 to a22e08fCompareAugust 22, 2026 12:37
@ashleyshawashleyshaw changed the title refactor(validation): P1.1 - Unify branch name validatorsrefactor(validation): P1-P2 - Unified validators and agent branch guidanceAug 22, 2026
@ashleyshaw
ashleyshaw marked this pull request as ready for review August 22, 2026 15:54
@github-actions

github-actionsBot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

⚠️ A merged PR reached develop without passing the template content guardrail.

Missing required section(s): Linked issues, Changelog, Global DoD checklist

This is a post-merge backstop for admin bypasses. Please review branch protection for develop.

ashleyshaw pushed a commit that referenced this pull request Aug 22, 2026
…status
- Updated project status from 'Launching' to 'Phase 1-3 Complete'
- Added detailed timeline showing completion dates for P1.1, P1.2, P2, P3
- Added comprehensive summary of completed work across all three phases
- Linked PR #2302 containing all Phase 1-3 changes
- Added file count and categories for Phase 1-3 changes
- Updated key documentation references with new/updated files
- Documented 40+ files now containing branch naming guidance
Phase completion dates: P1 (2026-08-11), P1.1-P1.2 (2026-08-22), P2 (2026-08-22), P3 (2026-08-22)
auto-merge was automatically disabled August 22, 2026 16:24

Pull request was closed

@ashleyshawashleyshaw reopened this Aug 22, 2026
@ashleyshawashleyshaw reopened this Aug 22, 2026
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
Update post-release sync automation documentation to use ops/ prefix
instead of chore/ for post-release operations. This aligns the branch
naming with semantic categorization of operational maintenance tasks.
Changes:
- ADR-003: Updated branch naming and PR naming references
- BRANCHING_STRATEGY: Updated post-release sync branch references
- RELEASE_PROCESS: Updated post-release sync branch naming
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011NVnti4DjcBkz59RmSWZKh
P2.1: Add branch guidance to all 19 spec-based agents
- Added 'Branch Naming' section to each agent specification
- Agents that create branches document their patterns
- Agents that don't create/validate document the restriction
- Links to canonical branch naming standards
P2.2: Create portable branch naming instruction file
- New file: instructions/branch-naming.instructions.md
- Comprehensive guide for agents and developers
- Covers all 31 allowed prefixes, forbidden prefixes, examples
- Includes validation scripts and troubleshooting
P2.3: Add pre-creation validation to release agent
- Import validateBranchName from validate-branch-name.cjs
- Validate release branch name before 'git checkout -b'
- Throws error if branch name is invalid
- Prevents invalid branches from being created
P2.4: Add branch name validation to 7-layer safety gates
- Gate 1 (pre-flight checks) now validates release branch name
- Checks 'release/vX-Y-Z' pattern before release automation
- Fails fast if branch name would be invalid
- Ensures all releases use valid branch names
P2.5: Update agent spec template with branch naming
- Added three options for agent types:
* Option A: Agents that create branches
* Option B: Agents that validate branches
* Option C: Agents that don't create/validate
- New agents will include proper branch guidance
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011NVnti4DjcBkz59RmSWZKh
…ded documentation, and validation setup links
P3.1: Create quick reference guide
- New file: docs/QUICK_REFERENCE_BRANCH_NAMING.md
- One-page summary with pattern, allowed types table, valid/invalid examples
- Quick rules, validation procedure, special cases, and before-push checklist
P3.2: Expand CLAUDE.md with comprehensive validation checklist
- Renamed section to "Before Every Push — Branch Naming Checklist"
- Added 7-step detailed checklist with pattern requirements, character rules
- Included forbidden prefixes check and validation command
- Added quick reference table with valid/invalid examples
P3.3: Significantly expand AGENTS.md Branch Governance section
- Comprehensive branch pattern explanation with 31 prefixes organized by category
- Valid examples (feat, fix, hotfix, release, docs, a11y, ops, etc.)
- Invalid examples with fixes showing common mistakes
- Validation & setup section with `npm run validate:branch-name` command
- Pre-push checklist and post-merge cleanup procedures
- Key documentation links with brief descriptions
P3.4: Add branch naming guidance to all 19 portable agent AGENT.md files
- Added "## Branch Naming" section to each agent in agents/{agent}/AGENT.md
- Documents that agents don't create/validate branches
- Links to portable instructions and branching strategy documentation
- Ensures comprehensive coverage across all agent implementations
P3.5: Add validation setup links to key documentation
- Enhanced CLAUDE.md with links to setup guide, quick reference, full strategy
- Enhanced AGENTS.md with validation setup section and troubleshooting links
- All major documentation now cross-references validation procedures
- Improved discoverability of branch naming validation setup (npm run, hooks, git)
Total coverage: Branch naming guidance now in 40+ files (19 .agent.md + 19 AGENT.md + 2 core docs + quick ref)
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011NVnti4DjcBkz59RmSWZKh
…status
- Updated project status from 'Launching' to 'Phase 1-3 Complete'
- Added detailed timeline showing completion dates for P1.1, P1.2, P2, P3
- Added comprehensive summary of completed work across all three phases
- Linked PR #2302 containing all Phase 1-3 changes
- Added file count and categories for Phase 1-3 changes
- Updated key documentation references with new/updated files
- Documented 40+ files now containing branch naming guidance
Phase completion dates: P1 (2026-08-11), P1.1-P1.2 (2026-08-22), P2 (2026-08-22), P3 (2026-08-22)
@ashleyshaw
ashleyshawforce-pushed the audit/validators-unified branch from 0e2913f to e3e044aCompareAugust 22, 2026 16:33
@ashleyshaw
ashleyshaw merged commit 34794e3 into developAug 22, 2026
17 of 40 checks passed
@ashleyshaw
ashleyshaw deleted the audit/validators-unified branch August 22, 2026 16:34
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