reviews

package
v0.65.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 26 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 reviews reads and settles the reviews on a task's request: the host reviewer, the request a branch or task names, and the findings rounds.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoReview = errors.New("no review")

ErrNoReview is pick finding nothing to return: no review by the reviewer, or none left unhandled. wait keeps polling on it and nothing else.

View Source
var ErrReviewChanged = errors.New("the review changed since it was read")

ErrReviewChanged is settle refusing a review rewritten since it was read: a sticky comment edited by a re-review is a new, unread review.

Functions

func BranchTask

func BranchTask(ctx context.Context, t *target.Target, main, branch string) *ref.Ref

BranchTask is the task a PR's head branch belongs to: its link, else the id in its name; nil when neither names one the tracker resolves.

func CapturedHead

func CapturedHead(ctx context.Context, dir string) (string, error)

CapturedHead is HEAD with the tracked work in the tree on top, as a commit no ref points at: `git stash create` touches neither the stash list nor the index, and prints nothing for a clean tree.

func LastPullOf

func LastPullOf(ctx context.Context, t *target.Target, branch string) (forge.PR, error)

LastPullOf is the newest request of any state whose head is branch, or 0; a checkout with no host CLI has none.

func MergedTree

func MergedTree(ctx context.Context, dir, head, base string) (string, string, error)

MergedTree is head merged in memory into the newer of base's local and origin refs, and that ref. Diffed against the ref it holds only what main lacks, which a merge base misses once the branch's earlier PR was squashed.

func OpenPullOf

func OpenPullOf(ctx context.Context, t *target.Target, branch string) (forge.PR, error)

OpenPullOf is the newest open request whose head is branch, or 0: a merged or closed one is history, not the change's request. A checkout with no host CLI has no requests, and still diffs.

func OpenReviews

func OpenReviews(ctx context.Context, t *target.Target, explicit string, warn io.Writer) (string, roundSeries, error)

OpenReviews is the findings directory review round and lore change both read, and what the branch says about its series. A branch checked out elsewhere, or a subject that does not resolve, gets no series read, so a closed one is archived only where its branch lives.

func PullNumberOf

func PullNumberOf(token string) int

PullNumberOf is the request a token names, or 0: a url, #n, !n, or a bare number, always a request here; a task is named with its prefix or url.

func ResolvePRSubject

func ResolvePRSubject(ctx context.Context, t *target.Target, token string) (prSubject, error)

ResolvePRSubject turns a PR, a task id or nothing (the current branch) into a subject, with the branch's open request looked up on the host, whose target then wins over the base git records.

Types

type RemoteReview

type RemoteReview struct {
	ID        string    `json:"id"`
	Kind      string    `json:"kind"`
	URL       string    `json:"url"`
	Author    string    `json:"author"`
	Body      string    `json:"body"`
	SHA       string    `json:"sha,omitempty"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	Done      bool      `json:"done"`
	Handled   bool      `json:"handled"`
	Settled   bool      `json:"settled"`
	Stale     bool      `json:"stale"` // commits landed on the request after the sha it reviewed

	// Triggerable says `f10 review trigger` can perform the declared trigger:
	// the step offers a new review only when it is true.
	Triggerable bool   `json:"triggerable"`
	Revision    string `json:"revision"`

	// Host is the review as the host keeps it, which every write goes back
	// through; its Stored is the text an ack edits, since Body folds an
	// inline review's comments in and writing that back would copy them
	Host forge.Note `json:"-"`
}

A RemoteReview is one review normalized across the three arrival kinds and both CLIs; the exported fields are the --json output, the rest is for ack.

type Reviewer

type Reviewer struct {
	H     hostops.Host
	Facts facts.Review
	// contains filtered or unexported fields
}

func NewReviewer

func NewReviewer(ctx context.Context, h hostops.Host, f facts.Review, number string) (*Reviewer, error)

func (*Reviewer) Ack

func (rv *Reviewer) Ack(ctx context.Context, r RemoteReview) (string, error)

Ack confirms an already handled review rather than posting twice.

func (*Reviewer) AckTarget

func (rv *Reviewer) AckTarget(ctx context.Context, id string) (RemoteReview, error)

AckTarget is the review id names, else pick's, else with every review handled the newest, which ack confirms rather than marks twice.

func (*Reviewer) Candidates

func (rv *Reviewer) Candidates(ctx context.Context) ([]RemoteReview, error)

Candidates lists every review, newest update first. A settled one counts as handled: the settled marker is an edit, which would otherwise make the earlier handled reaction read as stale.

func (*Reviewer) Latest

func (rv *Reviewer) Latest(ctx context.Context) (RemoteReview, error)

Latest is the newest review whatever its state: the one resolve reads.

func (*Reviewer) ManualHint

func (rv *Reviewer) ManualHint() string

func (*Reviewer) Pick

func (rv *Reviewer) Pick(ctx context.Context) (RemoteReview, error)

Pick is the newest review the reviewer left that nobody handled yet.

func (*Reviewer) Revision

func (rv *Reviewer) Revision(r RemoteReview) string

Revision fingerprints the text without f10's marks: a sticky comment rewritten by a re-review keeps its id and first sha, so only its text tells the new review apart.

func (*Reviewer) Settle

func (rv *Reviewer) Settle(ctx context.Context, r RemoteReview) (string, error)

Settle leaves the declared settled mark: resolve's word that every finding has a verdict.

func (*Reviewer) SettleTarget

func (rv *Reviewer) SettleTarget(ctx context.Context, id, revision string) (RemoteReview, error)

SettleTarget refuses a review now at another revision: a re-review rewrote it, and marking it would settle findings nobody read.

func (*Reviewer) Trigger

func (rv *Reviewer) Trigger(ctx context.Context) (string, string, time.Time, error)

Trigger returns what it did, where, and the host's time for it, which a new review must postdate.

Jump to

Keyboard shortcuts

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