From c889724dda61ee4e67bf4cbb47436ab8c6d4d91c Mon Sep 17 00:00:00 2001 From: claw Date: Tue, 12 May 2026 12:00:30 -0700 Subject: [PATCH] fix(vcs): address Phase 1 review findings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename PullRequest.Head.Sha → SHA (Go acronym convention) - Add typed ReviewEvent alias with exported constants - Remove duplicate package doc from types.go (kept in interfaces.go) - Fix misleading comment in check.go --- vcs/check.go | 2 +- vcs/types.go | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/vcs/check.go b/vcs/check.go index 4989eac..0e39af7 100644 --- a/vcs/check.go +++ b/vcs/check.go @@ -1,7 +1,7 @@ //go:build ignore // This file is excluded from normal builds. -// Run `go build -v .` inside this file to see the documented gaps between +// Remove the //go:build ignore tag and run `go build ./vcs/` to see the documented gaps between // gitea.Client and vcs.Client that Phase 2 (Gitea adapter) must bridge. // // Known gaps (as of Phase 1): diff --git a/vcs/types.go b/vcs/types.go index 82f0ec1..2b43985 100644 --- a/vcs/types.go +++ b/vcs/types.go @@ -1,14 +1,23 @@ -// Package vcs defines the shared interface and types for VCS platform clients. -// Adapters (gitea, github) implement these interfaces; the core review logic -// uses them without knowing the underlying platform. package vcs +// ReviewEvent is the event type for a pull request review action. +type ReviewEvent string + +const ( + // ReviewEventApprove approves the pull request. + ReviewEventApprove ReviewEvent = "APPROVED" + // ReviewEventRequestChanges requests changes to the pull request. + ReviewEventRequestChanges ReviewEvent = "REQUEST_CHANGES" + // ReviewEventComment posts a review comment without approval or rejection. + ReviewEventComment ReviewEvent = "COMMENT" +) + // PullRequest holds relevant PR metadata. type PullRequest struct { Title string `json:"title"` Body string `json:"body"` Head struct { - Sha string `json:"sha"` + SHA string `json:"sha"` Ref string `json:"ref"` } `json:"head"` } @@ -56,7 +65,7 @@ type ReviewComment struct { type ReviewRequest struct { // Body is the top-level review comment. Body string `json:"body"` - // Event is "APPROVED" or "REQUEST_CHANGES". - Event string `json:"event"` + // Event is the review action (approve, request changes, or comment). + Event ReviewEvent `json:"event"` Comments []ReviewComment `json:"comments,omitempty"` }