Add version hierarchy validation and CI improvements for version management #28

Merged
Copilot merged 5 commits from copilot/prevent-version-creation-errors into main 2026-01-04 01:30:13 +00:00
Copilot commented 2026-01-03 23:38:28 +00:00 (Migrated from github.com)

Pull Request

Purpose

Implements version hierarchy validation in the GitHub Actions workflow to prevent creating version numbers in lower priority branches when they already exist in higher priority branches. Additionally adds comprehensive CI scripts and tools for version management and validation.

Change Summary

Added validation logic to the version_branch.yml workflow that enforces a three-tier version hierarchy:

  • version/X.Y.Z - production/stable versions (highest priority)
  • rc/X.Y.Z - release candidate versions (medium priority)
  • dev/X.Y.Z - development versions (lowest priority)

Rules enforced:

  1. If creating rc/X.Y.Z, workflow blocks if version/X.Y.Z already exists
  2. If creating dev/X.Y.Z, workflow blocks if version/X.Y.Z or rc/X.Y.Z already exists
  3. Creating version/X.Y.Z is always allowed (highest priority)

Workflow changes:

  • Added branch_prefix input parameter with options: dev/, rc/, version/ (defaults to dev/)
  • Added "Validate version hierarchy" workflow step that checks remote branches before creation
  • Updated input validation to accept all three branch prefixes (previously locked to dev/ only)
  • Updated namespace collision defense to recognize all three prefixes

New CI scripts added:

  1. scripts/validate/version_hierarchy.sh - Validates version hierarchy across all branch prefixes, detecting conflicts between dev/, rc/, and version/ branches
  2. scripts/validate/workflows.sh - Validates GitHub Actions workflow YAML files for syntax errors, tabs, and proper structure
  3. scripts/run/list_versions.sh - Lists all version branches organized by prefix with visual indicators and sorted output
  4. scripts/run/check_version.sh - Interactive tool to check if a version can be created safely in a specific branch prefix before attempting creation

CI workflow enhancements:

  • Added workflows.sh to required validations (ensures workflow YAML is always valid)
  • Added version_hierarchy.sh to optional validations (catches version conflicts early in CI)
  • Updated scripts/README.md with comprehensive documentation for all new scripts

Testing Evidence

  • YAML syntax validation passes for all workflows
  • No tab or control character issues detected
  • CodeQL security scan completed (0 alerts)
  • Created test script demonstrating validation logic works correctly for all scenarios
  • Manual verification of workflow structure and logic
  • All new scripts tested individually and working correctly

Test scenarios validated:

  • Creating stable version → allowed (no checks)
  • Creating RC when version exists in stable → blocked ✓
  • Creating RC when version doesn't exist in stable → allowed ✓
  • Creating dev when version exists in stable → blocked ✓
  • Creating dev when version exists in RC → blocked ✓
  • Creating dev when version doesn't exist in higher priority branches → allowed ✓
  • Workflow YAML validation detects syntax errors ✓
  • Version hierarchy validation detects conflicts across branches ✓
  • List versions script displays all branches correctly ✓
  • Check version script correctly validates creation eligibility ✓

Risk and Rollback

Risk Level: Low

  • Changes are additive and non-breaking
  • Default behavior remains dev/ prefix for backward compatibility
  • Validation runs before branch creation, so no orphaned branches are created
  • Existing workflows continue to function without modification
  • New scripts follow enterprise standards and include proper error handling

Rollback Plan:

  • Revert commits 2534fd3, d89744d, de6b404 and d09cf9c
  • Workflow will return to previous behavior (dev/ only, no hierarchy checks)
  • Remove new validation scripts from CI workflow if needed

Checklist

  • Follows Conventional Commits
  • Tests added or updated
  • Documentation updated if required
  • License header present where applicable
  • Linked issue(s) referenced

Reviewer Notes

The workflow now prevents duplicate version numbers across different branch prefixes, addressing the requirement: "if a version number exists in version/ do not create in rc or /dev and if version number exists in rc do not create in dev/"

Users can now select which branch prefix to use when triggering the workflow via the new branch_prefix dropdown input, enabling proper version progression through the development lifecycle: dev → rc → version.

Additionally, four new enterprise-standard scripts provide comprehensive version management capabilities:

  • Validation of version hierarchy in CI to catch conflicts early
  • Workflow YAML validation to prevent syntax errors
  • Tools to list all versions and check if a new version can be created safely
  • Complete documentation for all new functionality

All new scripts include proper error handling, follow bash best practices, and are optimized for performance (using bash built-ins where appropriate).

Review and Approval

Awaiting review and approval.

Original prompt

if a version number exists in version/ do not create in rc or /dev and if version number exists in rc do not create in dev/


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

# Pull Request ## Purpose Implements version hierarchy validation in the GitHub Actions workflow to prevent creating version numbers in lower priority branches when they already exist in higher priority branches. Additionally adds comprehensive CI scripts and tools for version management and validation. ## Change Summary Added validation logic to the `version_branch.yml` workflow that enforces a three-tier version hierarchy: - **version/X.Y.Z** - production/stable versions (highest priority) - **rc/X.Y.Z** - release candidate versions (medium priority) - **dev/X.Y.Z** - development versions (lowest priority) **Rules enforced:** 1. If creating `rc/X.Y.Z`, workflow blocks if `version/X.Y.Z` already exists 2. If creating `dev/X.Y.Z`, workflow blocks if `version/X.Y.Z` or `rc/X.Y.Z` already exists 3. Creating `version/X.Y.Z` is always allowed (highest priority) **Workflow changes:** - Added `branch_prefix` input parameter with options: `dev/`, `rc/`, `version/` (defaults to `dev/`) - Added "Validate version hierarchy" workflow step that checks remote branches before creation - Updated input validation to accept all three branch prefixes (previously locked to `dev/` only) - Updated namespace collision defense to recognize all three prefixes **New CI scripts added:** 1. **`scripts/validate/version_hierarchy.sh`** - Validates version hierarchy across all branch prefixes, detecting conflicts between dev/, rc/, and version/ branches 2. **`scripts/validate/workflows.sh`** - Validates GitHub Actions workflow YAML files for syntax errors, tabs, and proper structure 3. **`scripts/run/list_versions.sh`** - Lists all version branches organized by prefix with visual indicators and sorted output 4. **`scripts/run/check_version.sh`** - Interactive tool to check if a version can be created safely in a specific branch prefix before attempting creation **CI workflow enhancements:** - Added `workflows.sh` to required validations (ensures workflow YAML is always valid) - Added `version_hierarchy.sh` to optional validations (catches version conflicts early in CI) - Updated `scripts/README.md` with comprehensive documentation for all new scripts ## Testing Evidence - ✅ YAML syntax validation passes for all workflows - ✅ No tab or control character issues detected - ✅ CodeQL security scan completed (0 alerts) - ✅ Created test script demonstrating validation logic works correctly for all scenarios - ✅ Manual verification of workflow structure and logic - ✅ All new scripts tested individually and working correctly Test scenarios validated: - Creating stable version → allowed (no checks) - Creating RC when version exists in stable → blocked ✓ - Creating RC when version doesn't exist in stable → allowed ✓ - Creating dev when version exists in stable → blocked ✓ - Creating dev when version exists in RC → blocked ✓ - Creating dev when version doesn't exist in higher priority branches → allowed ✓ - Workflow YAML validation detects syntax errors ✓ - Version hierarchy validation detects conflicts across branches ✓ - List versions script displays all branches correctly ✓ - Check version script correctly validates creation eligibility ✓ ## Risk and Rollback **Risk Level:** Low - Changes are additive and non-breaking - Default behavior remains `dev/` prefix for backward compatibility - Validation runs before branch creation, so no orphaned branches are created - Existing workflows continue to function without modification - New scripts follow enterprise standards and include proper error handling **Rollback Plan:** - Revert commits 2534fd3, d89744d, de6b404 and d09cf9c - Workflow will return to previous behavior (dev/ only, no hierarchy checks) - Remove new validation scripts from CI workflow if needed ## Checklist - [x] Follows Conventional Commits - [x] Tests added or updated - [x] Documentation updated if required - [x] License header present where applicable - [ ] Linked issue(s) referenced ## Reviewer Notes The workflow now prevents duplicate version numbers across different branch prefixes, addressing the requirement: "if a version number exists in version/ do not create in rc or /dev and if version number exists in rc do not create in dev/" Users can now select which branch prefix to use when triggering the workflow via the new `branch_prefix` dropdown input, enabling proper version progression through the development lifecycle: dev → rc → version. Additionally, four new enterprise-standard scripts provide comprehensive version management capabilities: - Validation of version hierarchy in CI to catch conflicts early - Workflow YAML validation to prevent syntax errors - Tools to list all versions and check if a new version can be created safely - Complete documentation for all new functionality All new scripts include proper error handling, follow bash best practices, and are optimized for performance (using bash built-ins where appropriate). ## Review and Approval Awaiting review and approval. <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > if a version number exists in version/ do not create in rc or /dev and if version number exists in rc do not create in dev/ </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
jmiller-moko (Migrated from github.com) reviewed 2026-01-03 23:38:28 +00:00
jmiller-moko commented 2026-01-04 00:41:44 +00:00 (Migrated from github.com)

@copilot continue

@copilot continue
jmiller-moko commented 2026-01-04 00:58:46 +00:00 (Migrated from github.com)

@copilot search is satlling with error
$ cd /home/runner/work/moko-cassiopeia/moko-cassiopeia && find . -type f -name "*.sh" | xargs grep -l "version" | grep -E "(release|fix)" | head -10 ./scripts/release/update_changelog.sh ./scripts/release/update_dates.sh ./scripts/fix/tabs.sh ./scripts/fix/paths.sh ./scripts/fix/versions.sh <exited with exit code 0>

@copilot search is satlling with error $ cd /home/runner/work/moko-cassiopeia/moko-cassiopeia && find . -type f -name "*.sh" | xargs grep -l "version" | grep -E "(release|fix)" | head -10 ./scripts/release/update_changelog.sh ./scripts/release/update_dates.sh ./scripts/fix/tabs.sh ./scripts/fix/paths.sh ./scripts/fix/versions.sh <exited with exit code 0>
Copilot commented 2026-01-04 01:08:33 +00:00 (Migrated from github.com)

@copilot search is satlling with error
$ cd /home/runner/work/moko-cassiopeia/moko-cassiopeia && find . -type f -name "*.sh" | xargs grep -l "version" | grep -E "(release|fix)" | head -10 ./scripts/re...

The implementation is complete. I've added version hierarchy validation to the workflow in commit d09cf9c.

The changes enforce these rules:

  • version/X.Y.Z (stable) → always allowed, highest priority
  • rc/X.Y.Z (RC) → blocked if version/X.Y.Z exists
  • dev/X.Y.Z (dev) → blocked if version/X.Y.Z or rc/X.Y.Z exists

The workflow now accepts a branch_prefix input parameter (dev/, rc/, or version/) and validates the version hierarchy before creating the branch.

> @copilot search is satlling with error > $ cd /home/runner/work/moko-cassiopeia/moko-cassiopeia && find . -type f -name "*.sh" | xargs grep -l "version" | grep -E "(release|fix)" | head -10 ./scripts/re... The implementation is complete. I've added version hierarchy validation to the workflow in commit d09cf9c. The changes enforce these rules: - **version/X.Y.Z** (stable) → always allowed, highest priority - **rc/X.Y.Z** (RC) → blocked if version/X.Y.Z exists - **dev/X.Y.Z** (dev) → blocked if version/X.Y.Z or rc/X.Y.Z exists The workflow now accepts a `branch_prefix` input parameter (dev/, rc/, or version/) and validates the version hierarchy before creating the branch.
jmiller-moko commented 2026-01-04 01:19:25 +00:00 (Migrated from github.com)

@copilot add other improvements and additonal ci scripts

@copilot add other improvements and additonal ci scripts
Copilot commented 2026-01-04 01:27:05 +00:00 (Migrated from github.com)

@copilot add other improvements and additonal ci scripts

Added CI improvements and version management scripts in commits d89744d and 2534fd3.

New features:

  • 4 new scripts for version management and validation
  • Enhanced CI workflow with workflow YAML validation
  • Version hierarchy validation integrated into CI
  • Comprehensive documentation for all new scripts

The improvements include:

  • scripts/validate/version_hierarchy.sh - validates no version conflicts across branches
  • scripts/validate/workflows.sh - validates workflow YAML syntax
  • scripts/run/list_versions.sh - lists all version branches by prefix
  • scripts/run/check_version.sh - checks if a version can be created safely

All scripts tested and follow enterprise standards.

> @copilot add other improvements and additonal ci scripts Added CI improvements and version management scripts in commits d89744d and 2534fd3. **New features:** - 4 new scripts for version management and validation - Enhanced CI workflow with workflow YAML validation - Version hierarchy validation integrated into CI - Comprehensive documentation for all new scripts The improvements include: - `scripts/validate/version_hierarchy.sh` - validates no version conflicts across branches - `scripts/validate/workflows.sh` - validates workflow YAML syntax - `scripts/run/list_versions.sh` - lists all version branches by prefix - `scripts/run/check_version.sh` - checks if a version can be created safely All scripts tested and follow enterprise standards.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoCassiopeia#28