|
| 1 | +# Branch Protection Rules Configuration |
| 2 | + |
| 3 | +This document outlines the required branch protection settings for the main branch to ensure code quality and prevent breaking changes. |
| 4 | + |
| 5 | +## Required Settings for `main` branch: |
| 6 | + |
| 7 | +### 🔒 General Protection Rules |
| 8 | +- [x] **Restrict pushes that create files that exceed GitHub's file size limit** |
| 9 | +- [x] **Restrict pushes that create files that exceed this limit: 100 MB** |
| 10 | + |
| 11 | +### 🧪 Required Status Checks |
| 12 | +The following checks must pass before merging: |
| 13 | + |
| 14 | +- [x] **Require status checks to pass before merging** |
| 15 | +- [x] **Require branches to be up to date before merging** |
| 16 | + |
| 17 | +**Required Checks:** |
| 18 | +- `quality-gates` - Linting, type checking, and unit tests |
| 19 | +- `e2e-testing (ubuntu-latest, 18)` - Core E2E tests on primary platform |
| 20 | +- `performance-testing` - Performance benchmarks must pass |
| 21 | +- `security-scan` - Security vulnerability scanning |
| 22 | + |
| 23 | +**Optional Checks (recommended but not blocking):** |
| 24 | +- `e2e-testing (macos-latest, 18)` - macOS compatibility |
| 25 | +- `e2e-testing (windows-latest, 18)` - Windows compatibility |
| 26 | +- `e2e-testing (ubuntu-latest, 16)` - Node 16 compatibility |
| 27 | +- `e2e-testing (ubuntu-latest, 20)` - Node 20 compatibility |
| 28 | + |
| 29 | +### 👥 Pull Request Requirements |
| 30 | +- [x] **Require a pull request before merging** |
| 31 | +- [x] **Require approvals: 1** |
| 32 | +- [x] **Dismiss stale PR approvals when new commits are pushed** |
| 33 | +- [x] **Require review from code owners** (if CODEOWNERS file exists) |
| 34 | +- [x] **Restrict approvals to users with write permissions** |
| 35 | + |
| 36 | +### 🔐 Push Restrictions |
| 37 | +- [x] **Restrict pushes that create files** |
| 38 | +- [x] **Include administrators** - Even admins must follow the process |
| 39 | + |
| 40 | +### 📋 Additional Rules |
| 41 | +- [x] **Require signed commits** (recommended for security) |
| 42 | +- [x] **Require conversation resolution before merging** |
| 43 | +- [x] **Do not allow bypassing the above settings** |
| 44 | + |
| 45 | +## GitHub CLI Setup Commands |
| 46 | + |
| 47 | +To configure these settings automatically using GitHub CLI: |
| 48 | + |
| 49 | +```bash |
| 50 | +# Enable branch protection for main |
| 51 | +gh api repos/:owner/:repo/branches/main/protection \ |
| 52 | + --method PUT \ |
| 53 | + --field required_status_checks='{"strict":true,"contexts":["quality-gates","e2e-testing (ubuntu-latest, 18)","performance-testing","security-scan"]}' \ |
| 54 | + --field enforce_admins=true \ |
| 55 | + --field required_pull_request_reviews='{"dismiss_stale_reviews":true,"require_code_owner_reviews":true,"required_approving_review_count":1}' \ |
| 56 | + --field restrictions=null |
| 57 | + |
| 58 | +# Alternatively, use the web interface at: |
| 59 | +# https://github.com/YOUR_USERNAME/multi-agent-workflow/settings/branches |
| 60 | +``` |
| 61 | + |
| 62 | +## E2E Test Quality Gate |
| 63 | + |
| 64 | +The most critical quality gate is the **End-to-End Onboarding Flow Test** which validates: |
| 65 | + |
| 66 | +1. ✅ Project initialization completes successfully |
| 67 | +2. ✅ Configuration files are created correctly |
| 68 | +3. ✅ Launch command validates environment properly |
| 69 | +4. ✅ Agent orchestration works as expected |
| 70 | +5. ✅ Context generation produces valid output |
| 71 | +6. ✅ User experience flows work end-to-end |
| 72 | +7. ✅ Performance benchmarks meet thresholds |
| 73 | +8. ✅ Error handling works correctly |
| 74 | + |
| 75 | +If any of these fail, the PR cannot be merged to `main`. |
| 76 | + |
| 77 | +## Performance Thresholds |
| 78 | + |
| 79 | +The performance tests enforce these maximum response times: |
| 80 | +- **Initialization**: 15 seconds |
| 81 | +- **Launch Validation**: 10 seconds |
| 82 | +- **Status Commands**: 2 seconds |
| 83 | +- **Help Commands**: 1 second |
| 84 | + |
| 85 | +Exceeding these thresholds will fail the build. |
| 86 | + |
| 87 | +## Security Requirements |
| 88 | + |
| 89 | +Security scanning includes: |
| 90 | +- npm audit for dependency vulnerabilities |
| 91 | +- OWASP dependency check |
| 92 | +- Static code analysis for security patterns |
| 93 | +- No secrets or credentials in code |
| 94 | + |
| 95 | +## Manual Override Process |
| 96 | + |
| 97 | +In emergency situations, administrators can: |
| 98 | +1. Create a hotfix branch from `main` |
| 99 | +2. Apply critical fixes |
| 100 | +3. Create emergency PR with detailed justification |
| 101 | +4. Temporarily disable specific checks if needed |
| 102 | +5. Merge with admin override (with full audit trail) |
| 103 | +6. Immediately re-enable all protections |
| 104 | +7. Schedule follow-up to address any skipped checks |
0 commit comments