reviewrounds

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const Version = "v6"

Version is the one grammar this package reads.

Variables

View Source
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 Count

type Count struct {
	Section  Section
	Findings int
}

Count is how many findings a round's reviewers raised in one section.

type Duplicate

type Duplicate struct {
	Defect   string   `json:"defect"`
	Findings []string `json:"findings"`
}

Duplicate is a group of findings that describe one defect at one site.

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

type Outcome struct {
	Label  string
	Status string
	Why    string
}

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

func (r Round) Bodies() []string

Bodies is the body of each of the round's posts: its reviews, its synthesis and its round comment.

func (Round) Counts

func (r Round) Counts() []Count

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) Missed

func (r Round) Missed() []Outcome

func (Round) NoneRan

func (r Round) NoneRan() bool

NoneRan says the round comment names the round's reviewers and none of them ran.

func (Round) PostedAt

func (r Round) PostedAt() time.Time

PostedAt is when the round's newest post landed, and zero where none says when.

func (Round) Skipped

func (r Round) Skipped() []Outcome

Skipped is each reviewer the round comment names as skipped on purpose, and Missed each it names as not having run or not having posted. Both are empty before the round comment posts.

func (Round) Unread

func (r Round) Unread() []Review

Unread is each review whose findings block could not be read.

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

func (rs Rounds) FinishedAt() *time.Time

FinishedAt is when the newest round's comment posted, and nil where no round posted or the newest still runs.

func (Rounds) WholeIsNewest

func (rs Rounds) WholeIsNewest() bool

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

type Section struct {
	Name     string
	Heading  string
	Blocking bool
}

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.

func SectionOf

func SectionOf(name string) (Section, int)

SectionOf is the section named name and its place in Sections. A name Sections does not hold is headed by itself and placed after them all.

type Shape

type Shape struct {
	Number   string   `json:"number"`
	Section  string   `json:"section"`
	Explains []string `json:"explains"`
	Body     string   `json:"body"`
}

Shape is one cause several findings share, and the findings it explains.

type Synthesis

type Synthesis struct {
	At         *time.Time
	URL        string
	Shapes     []Shape
	Duplicates []Duplicate
	Unread     string
	Body       string
}

Synthesis is the review naming the causes the round's findings share.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL