Review gate: automated PR reviewer (acceptance parse, tests, verdicts) #5
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
The REVIEW GATE — the automated code reviewer that makes the SaaS a product (turns "lanes produce PRs" into "clients get verified, merged code"). Parses a PR's linked issue acceptance criteria, runs real checks (tests, build, diff hygiene), produces an evidence-based verdict.
Files allowed:
gitea_saas/reviewer.py,tests/test_reviewer.py. Do NOT modify anything else.Spec
Reviewer(repo_client, runner)whererepo_client= a git/GiteaClientseam andrunner= a subprocess seam.review_pr(repo, pr_number, linked_issue) -> Verdict:- [ ] ...lines, or## Acceptancesection). If empty, noteno_acceptancein verdict.scope_violationlist.runner.run(repo_dir, "python -m pytest -q")+ repo's build command if declared (configREVIEW_BUILD_CMD); capture exit code + tail of output. Timeouts (configREVIEW_TEST_TIMEOUT_S, default 300).git diff --checkvia worktree; secrets scan optional (configREVIEW_SECRET_SCAN, reuse simple regex list).REVIEW_MODEL,REVIEW_PROVIDER; default to the lane provider). Produce structured findings:[{file, line?, severity, evidence_quote, note}]. Must QUOTE the diff, never assert vaguely.Verdict={repo, pr, head_sha, acceptance: [...], tests: {exit, summary}, build: {...}, scope_violations: [...], findings: [...], verdict: APPROVE|BOUNCE|NEEDS_GUIDANCE, summary}.allow_test_failurein issue body)post_verdict(repo, pr, verdict)— posts a formatted comment[review-gate] VERDICT: ...with checklist + findings; FAIL-CLOSED: NEVER merge here (policy/merge is issue #7).Acceptance
tests: {exit: timed_out}Verification:
python -m pytest tests/test_reviewer.py -qall green, hermetic (no network, no real subprocess beyond the FakeRunner).