Documentation
¶
Overview ¶
Package reviewrounds reads the Claude review rounds a pull request carries. A round posts one review per reviewer, one synthesis review and one round comment, each opening with a marker that names its grammar's version and its round. Each review closes with a collapsed block holding its findings as JSON, which is what this package reads, never the markdown. A post whose marker names a version it does not read is kept whole rather than read wrong.
Index ¶
Constants ¶
const Version = "v6"
Version is the one grammar this package reads.
Variables ¶
var Sections = []Section{ {Name: "correctness", Heading: "Correctness", Blocking: true}, {Name: "design", Heading: "Design and architecture"}, {Name: "prose", Heading: "Prose"}, }
Sections are the finding sections in the order a review writes them.
Functions ¶
func IsRoundPost ¶ added in v0.15.0
func IsRoundPost(review pullrequests.Review) bool
IsRoundPost says the review opens with a round's marker, of any version, from an author a round posts as. A pull request carrying one was reviewed by a round, whichever grammar the round wrote in, so this reads no version where Read reads only Version.
Types ¶
type Finding ¶
type Finding struct {
Number string `json:"number"`
Section string `json:"section"`
Sites []string `json:"sites"`
Reach string `json:"reach"`
Body string `json:"body"`
}
Finding is one finding as the review's JSON block holds it. Reach is empty on a prose one.
type Finish ¶
type Finish struct {
At time.Time
URL string
// Reviewers is what became of each reviewer its round record names, in the record's order.
Reviewers []Outcome
// Unread is why its round record could not be read, where it could not.
Unread string
Body string
}
Finish is the round comment.
type Outcome ¶
Outcome is what became of one reviewer in a round, in the round record's words. Status is ran, skipped, not run or not posted, and Why says why where it did not run, or the status where the record gives no reason.
type Post ¶
type Post struct {
// Marker is its marker's name and version, such as pr-review v7, and Reviewer the label it
// names, where it names one.
Marker string
Reviewer string
Author string
At *time.Time
URL string
Body string
// Why is why no round took it.
Why string
// Outsider says its author is neither an app on the repo nor someone who can write to it,
// so the post says nothing about the pull request's rounds.
Outsider bool
}
Post is a review or comment carrying a round's marker that no round could take.
type Review ¶
type Review struct {
Reviewer string
Model string
Effort string
Head string
At *time.Time
URL string
Findings []Finding
// Unread is why its findings block could not be read, where it could not, and Body is then
// what shows.
Unread string
Body string
}
Review is one reviewer's review.
type Round ¶
type Round struct {
Number int
// Head is the commit the round comment names, or else the one its newest review read.
Head string
// Reviews are each reviewer's newest review, in the order they posted, the synthesis apart.
Reviews []Review
Synthesis *Synthesis
// Finish is the round comment, which posts once every reviewer has ended, so the round
// runs while it is nil.
Finish *Finish
}
Round is one round's posts.
func (Round) Bodies ¶
Bodies is the body of each of the round's posts: its reviews, its synthesis and its round comment.
func (Round) Counts ¶
Counts is how many findings the round's reviewers raised in each section, in Sections' order, then any other section a review names, by name. A section none raised is left out.
func (Round) NoneRan ¶
NoneRan says the round comment names the round's reviewers and none of them ran.
func (Round) PostedAt ¶
PostedAt is when the round's newest post landed, and zero where none says when.
type Rounds ¶
type Rounds struct {
// Newest is the round with the highest number, and nil where none posted.
Newest *Round
// Earlier are the other rounds, newest first.
Earlier []Round
// Whole are the posts no round could take, oldest first, each shown as it was written.
Whole []Post
// CommentsCut says the detail read holds only the newest of the pull request's comments,
// so a round comment older than those is not read, and a round lacking one may have
// finished.
CommentsCut bool
}
Rounds is every review round a pull request carries.
func Read ¶
func Read(detail pullrequests.Detail) Rounds
Read is every round the pull request's reviews and comments carry. A post with no marker is not a round's, and is left out. A marked post by an outsider is kept whole, because anyone who can comment can open a post with a round's marker.
func (Rounds) FinishedAt ¶
FinishedAt is when the newest round's comment posted, and nil where no round posted or the newest still runs.
func (Rounds) WholeIsNewest ¶
WholeIsNewest says a post no round could take, by someone other than an outsider, landed after every post of the newest round, so the newest review on the pull request is one this package cannot count.
type Section ¶
Section is one finding section: the name a finding gives it, the heading a review writes over it, and whether a finding in it is a defect the pull request should not merge with.