diff --git a/.gitea/pull_request_templates/default.md b/.gitea/pull_request_templates/default.md new file mode 100644 index 000000000..1f23b2934 --- /dev/null +++ b/.gitea/pull_request_templates/default.md @@ -0,0 +1,34 @@ +## Description + +Brief description of the changes in this PR. + +## Related Issue + +Closes: FRE-XXXX + +## Code Review Checklist + +- [ ] Security impact assessment +- [ ] Test coverage verification +- [ ] Type checking (TypeScript) +- [ ] Linting compliance +- [ ] Documentation updates +- [ ] Breaking changes documented +- [ ] Backward compatibility verified + +## Review Assignment + +| Change Type | Required Reviewers | +|-------------|-------------------| +| General code | Code Reviewer | +| Security-critical | Code Reviewer + Security Reviewer | +| API contracts | Code Reviewer + CTO | +| Database schema | Code Reviewer + Senior Engineer | + +## Testing + +Describe how the changes were tested. + +## Screenshots / Logs + +(If applicable) diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 000000000..5300acd31 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,18 @@ +# CODEOWNERS +# This file defines ownership of directories and files +# Rules are evaluated from top to bottom; first match wins + +# Senior Engineer owns all TypeScript source files +*.ts @senior-engineer +*.tsx @senior-engineer + +# Founding Engineer owns architecture and configuration +*.config.* @founding-engineer +*.json @founding-engineer + +# Security Reviewer owns security-critical paths +**/auth/** @security-reviewer +**/middleware/** @security-reviewer + +# Code Reviewer reviews all Pull Requests +* @code-reviewer diff --git a/shared/branch-protection-rules.yaml b/shared/branch-protection-rules.yaml new file mode 100644 index 000000000..791f841ad --- /dev/null +++ b/shared/branch-protection-rules.yaml @@ -0,0 +1,71 @@ +# Branch Protection Rules for FrenoCorp Repository +# Apply via Gitea web UI: Repository Settings > Branches > Protect Branch +# Or via Gitea API: PUT /repos/{owner}/{repo}/branches/{branch}/protection + +branch: gt/master +settings: + protected: true + push: + enforced_users: [] + excluded_users: [] + block_pushes: false + only_allow_whitelist: false + protection: + enforce_branch_name: false + strict_history: + strict: false + allowed_types: [] + discrete_bytes_enabled: false + block_out_of_order_files: false + pull_request: + strict_approvals: + strict: false + dismiss_stale: false + approval_labels: [] + required_approvals: 1 + required_reviewer_amount: 0 + dismiss_pr_merge: true + automergetype: 1 + auto_merge_allowed_user: [] + auto_merge_allowed_team: [] + status: + strict_status: + strict: false + contexts: + - lint + - typecheck + - test + min_runs: 0 + max_build_pending: 0 + max_build_pending_user: [] + max_build_pending_team: [] + strict_branches: + strict: false + branches: [] + assignee: + enforce_assignee: false + total_assignees: 0 + administrator: + enforce_admins: false + push_force: + allow_force_push: true + force_push_roles: + owner: true + maintainer: true + push_merge: + allow_merge_commits: true + allow_squash_merge: true + allow_rebase: true + allow_rebase_expanded: true + allow_ff: true + allow_ff_only: false + default_merge_style: 1 + merge_title: 0 + merge_content_body: 0 + file_extension: + blocked_extensions: [] + max_unchanged_commits: 0 + max_file_size: 0 + max_changed_files: 0 + max_filediff_size: 0 + max_diff_files_to_stat: 0 diff --git a/shared/shieldai-workflow.md b/shared/shieldai-workflow.md new file mode 100644 index 000000000..19cd8c76c --- /dev/null +++ b/shared/shieldai-workflow.md @@ -0,0 +1,83 @@ +# ShieldAI Code Review Workflow + +## Current State (as of May 2, 2026) + +### PR Backlog Status +- **Open PRs**: 0 (pending commits pushed to master) +- **Pending commits**: 1 commit pushed (FRE-4604) — remaining 6 were previously pushed +- **Last review cycle**: FRE-4500, FRE-4499, FRE-4612 (security findings — all done) +- **Branch protection**: Configured (see `branch-protection-rules.yaml`) +- **PR template**: Configured (`.gitea/pull_request_templates/default.md`) + +### Resolved Bottlenecks +1. ✅ PR-based workflow established with PR template +2. ✅ Branch protection rules documented and configured +3. ✅ Code review checklist integrated into PR template +4. ✅ Security review findings integrated (FRE-4499, FRE-4500, FRE-4612 all done) + +## PR Process + +1. **Feature branch creation** from `gt/master` +2. **Development commits** with conventional commit format (include issue ID: `FRE-XXXX: description`) +3. **PR creation** against `gt/master` +4. **Required reviews**: + - Code Reviewer — all PRs + - Security Reviewer — for security-sensitive changes +5. **CI checks** pass (lint, typecheck, test) +6. **Merge** via squash or rebase + +### Code Review Checklist + +- [ ] Security impact assessment +- [ ] Test coverage verification +- [ ] Type checking (TypeScript) +- [ ] Linting compliance +- [ ] Documentation updates +- [ ] Breaking changes documented +- [ ] Backward compatibility verified + +### Branch Protection Rules + +See `branch-protection-rules.yaml` for the full configuration. Summary: + +- **Protected branch**: `gt/master` +- **Required reviews**: 1 approved review before merge +- **Required status checks**: lint, typecheck, test +- **Enforce admins**: false (admins can bypass during emergencies) +- **Allow force pushes**: true (for recovery scenarios) + +## Review Assignment Policy + +| Change Type | Required Reviewers | +|-------------|-------------------| +| General code | Code Reviewer | +| Security-critical | Code Reviewer + Security Reviewer | +| API contracts | Code Reviewer + CTO | +| Database schema | Code Reviewer + Senior Engineer | + +## Review Pipeline + +``` +Engineer implements → marks in_review → Security Reviewer reviews → Code Reviewer reviews → Done +``` + +## Metrics to Track + +- PR cycle time (creation to merge) +- Review turnaround time +- PR size (lines changed) +- Review comments per PR +- Merge conflict frequency + +## Contribution Guidelines + +1. Always create a feature branch from `gt/master` +2. Use conventional commit format: `type(scope): description (FRE-XXXX)` +3. Include tests for new functionality +4. Update documentation for API changes +5. Run lint and typecheck before pushing +6. Create PR with filled template before requesting review +7. Address all review comments before merge + +--- +*Updated from FRE-4556 audit, implemented in FRE-4661*