lib/gitea/pr.sx: PRs as kv records sharing the per-repo number counter with issues. Diffs are LIVE, computed from the merge base of the current branch heads to the source head via sx-git (no spurious deletions when the target moves on). Reviews: latest verdict per reviewer wins; authors cannot review their own PR; approved? = some approve and no outstanding request-changes. Lifecycle is a lib/flow durable workflow (deterministic-replay suspend): open -(approval)-> approved -(merge)-> merged; review! resumes the approval suspend when the verdict set first approves, merge! resumes the rest, close! cancels, reopen! starts a fresh flow. The flow env lives in the forge handle; the record's :state stays the source of truth. Merge via git/merge-commits over the merge base: up-to-date, fast- forward (ref move only), true two-parent merge commit, or conflicts with the conflicting paths. Every ref move is branch-cas! — concurrent pushes surface as 'stale'. Merge queue: approved PRs merge in order, failures stay queued. Web: pulls list + PR page (body html, reviews, lifecycle, unified diff), JSON API for create/review/merge (409 on conflicts/stale)/close (author or write)/enqueue/queue-process. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
266 B
266 B