Files
timmy-config/docs/QUALITY_GATES.md
Timmy Time 11dbd93a03
Some checks failed
Architecture Lint / Linter Tests (pull_request) Successful in 25s
Smoke Test / smoke (pull_request) Failing after 21s
Validate Config / YAML Lint (pull_request) Failing after 14s
Validate Config / JSON Validate (pull_request) Successful in 17s
Validate Config / Python Syntax & Import Check (pull_request) Failing after 54s
Validate Config / Python Test Suite (pull_request) Has been skipped
Validate Config / Cron Syntax Check (pull_request) Successful in 11s
Validate Config / Deploy Script Dry Run (pull_request) Successful in 10s
Validate Config / Playbook Schema Validation (pull_request) Successful in 21s
Validate Config / Shell Script Lint (pull_request) Failing after 54s
Architecture Lint / Lint Repository (pull_request) Failing after 14s
PR Checklist / pr-checklist (pull_request) Successful in 3m28s
feat(quality): establish Perplexity as standing quality gate
- bin/perplexity-quality-gate.sh: branch protection setter
- bin/perplexity-coverage.sh: coverage tracking + JSONL logs
- docs/QUALITY_GATES.md: full policy + usage
- agent-lanes.json: adds quality gate skill to Perplexity lane

Acceptance criteria:
1) Add branch protection requiring ≥1 review — quality-gate.sh
2) Configure Perplexity as default reviewer — same script sets required_reviewers
3) Track review coverage rate — coverage.sh + logs/
4) Document review standard — QUALITY_GATES.md refs #387

Closes #477
2026-04-26 06:11:04 -04:00

106 lines
3.3 KiB
Markdown

# Quality Gates — PR Review Standards
## Overview
All pull requests across the Timmy Foundation organization **must** be reviewed by Perplexity before merge. This standing quality gate leverages Perplexity's demonstrated A+ quality and reliability rating (audit #477).
## Policy
- **Required reviewer:** `perplexity` (Gitea user ID 7)
- **Minimum approvals:** 1
- **Scope:** All repositories under `Timmy_Foundation/`
- **Enforcement:** Branch protection on default branch (main)
### What This Means
Every PR must receive at least one approving review from Perplexity. No PR may be merged without this approval.
## Implementation
### 1. Branch Protection Rules
Run the setup script once per repo (or across all core repos):
```bash
cd timmy-config
./bin/perplexity-quality-gate.sh
```
The script:
- Determines each repo's default branch
- Sets Gitea branch protection with:
- `required_approving_review_count = 1`
- `required_reviewers = [{type: "User", id: 7}]` (Perplexity)
- `enforce_admins = true`
- Creates or updates the protection rule
> **Prerequisite:** `~/.config/gitea/token` must have admin rights on target repos.
### 2. Default Reviewer Assignment
Perplexity is set as a **required reviewer** at the branch-protection level. This standing assignment applies automatically to every PR on protected branches.
### 3. Review Coverage Tracking
Track compliance with the coverage script:
```bash
./bin/perplexity-coverage.sh 30 # last 30 days
```
Outputs:
- Per-repo merged PR count with/without Perplexity approval
- Org-wide coverage percentage
- Logs daily snapshot to `logs/perplexity-coverage-YYYY-MM-DD.jsonl`
Target: **100%**
### 4. Review Standard
Perplexity follows the PR review template in `.gitea/PULL_REQUEST_TEMPLATE.md` and issue #387 (PERPLEXITY-02).
Key checklist:
- Correctness — does the change do what the issue asks?
- Security — no secrets, unsafe execution paths, permission drift
- Tests & verification — does the author prove the change?
- Scope — PR matches issue, no scope creep
- Governance — boundary changes require Timmy approval
- Workflow fit — reduces drift, duplication, hidden operational risk
Low-risk, clear-verification, green-CI PRs → `APPROVED` quickly.
Uncertain, missing proof, or risky changes → `REQUEST_CHANGES` with actionable feedback.
## Running the Setup
```bash
# 1. Configure Gitea token (once)
export GITEA_URL=https://forge.alexanderwhitestone.com
# token stored at ~/.config/gitea/token
# 2. Apply protections to all core repos
./bin/perplexity-quality-gate.sh
# 3. Verify
# Visit each repo → Settings → Branch Protection → review the rule.
# Or use the Gitea API:
curl -H "Authorization: token $(cat ~/.config/gitea/token)" "$GITEA_URL/api/v1/repos/Timmy_Foundation/<repo>/branch-protection/main"
```
## Monitoring & Ops
- Daily run: `ops-perplexity-coverage` (add to ops panel)
- Alert when coverage drops below 100%
- Periodic audit: ensure Perplexity user (ID 7) remains active
## Related
- Issue: #477 — Establish Perplexity as standing quality gate
- Reference: #387 — Code review standard
- Audit: #174 — Quality enforcement
- Agent lane: `playbooks/agent-lanes.json``perplexity`
- Scripts:
- `bin/perplexity-quality-gate.sh` — apply protections
- `bin/perplexity-coverage.sh` — track coverage
- Workflow: `.gitea/workflows/pr-checklist.yml`