round

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 4 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 round holds the values of the loop's automatic rounds.

Index

Constants

View Source
const (
	// Reviewed is my last review and the head on a PR I review.
	Reviewed = "reviewed"
	// AddressedReviews is the newest review triaged on a PR I develop.
	AddressedReviews = "addressed.reviews"
	// AddressedChecks is the head whose failing checks a triage round covered.
	AddressedChecks = "addressed.checks"
	// AddressedConflict is the head whose conflict with the base a triage
	// round covered.
	AddressedConflict = "addressed.conflict"
)

The marks the rounds of a pull request write, by what they covered.

View Source
const (
	NoteCap  = "cap"
	NoteText = "note"
)

The kinds of a Note.

View Source
const CapReached = "turns.per_unit_per_day reached"

CapReached starts the refusal of a unit whose turns.per_unit_per_day is spent.

Variables

This section is empty.

Functions

func DayKey

func DayKey(t time.Time) string

DayKey is the local calendar date: a cap that resets at midnight UTC would reset mid-evening in America/Sao_Paulo.

Types

type Changes

type Changes struct {
	PRs map[string]Fields
	// Marks are the marks set or removed, by PR.
	Marks  map[string]map[string]bool
	Counts []Count
	Notes  []Note
}

Changes are what the setters changed since the store was loaded or last saved: a repository writes only these, so two snapshots that change different fields of one PR both keep their change.

type Count

type Count struct{ Day, Key string }

Count is one round counted against the caps of Day.

type Day

type Day struct {
	Total int
	PerPR map[string]int
	// CapLogged lists PRs whose cap hit was already printed today.
	CapLogged []string
	// Noted lists the notes already printed today.
	Noted []string
}

type Fields

type Fields uint8

Fields names the fields of a PR that a setter changed.

const (
	FieldSentAt Fields = 1 << iota
	FieldAgentHome
	FieldFirstRoundSkipped
)

type Note

type Note struct{ Day, Kind, Text string }

type PR

type PR struct {
	// Marks are what the rounds covered, by mark name; see mark.Handled.
	Marks  map[string]string
	SentAt time.Time
	// AgentHome is the agent home of the session that asked for the review,
	// reused by the rounds the watch starts.
	AgentHome string
	// FirstRoundSkipped is set when the user skipped the automatic first
	// round; the sweep does not plan another one.
	FirstRoundSkipped bool
}

type Pause

type Pause struct {
	On    bool
	Repos []string // owner/repo
	At    time.Time
	Why   string
}

Pause holds every workflow that does not observe and board moves everywhere when On, else on the repositories in Repos. A pull request's own pause is its override's Hold.

func (Pause) Any

func (p Pause) Any() bool

Any says whether the pause holds anything.

func (Pause) Holds

func (p Pause) Holds(owner, repo string) bool

func (Pause) HoldsRepo

func (p Pause) HoldsRepo(name string) bool

HoldsRepo says whether Repos names the owner/repo, under any case.

type Pending

type Pending struct {
	Intent   string
	Reason   string
	Since    time.Time
	Deadline time.Time
}

Pending is an automatic round that waits for the user's answer until Deadline, then runs.

type Store

type Store struct {
	PRs  map[string]PR
	Days map[string]Day
	// contains filtered or unexported fields
}

Store remembers which reviews already got their follow-up and how many follow-ups each day sent.

func New

func New() *Store

func (*Store) AgentHome

func (s *Store) AgentHome(key string) string

func (*Store) CapReason

func (s *Store) CapReason(key string, now time.Time, perPR int) string

CapReason returns why an automated round for key may not run today, or "".

func (*Store) Changes

func (s *Store) Changes() Changes

func (*Store) ClearFirstRoundSkipped

func (s *Store) ClearFirstRoundSkipped(key string)

func (*Store) Count added in v0.2.0

func (s *Store) Count(key string, now time.Time)

Count spends one of key's turns of now's day, which CapReason reads.

func (*Store) FirstCapHit

func (s *Store) FirstCapHit(key string, now time.Time) bool

FirstCapHit records that the cap hit for key was printed today and reports whether this is the first time.

func (*Store) FirstNote

func (s *Store) FirstNote(note string, now time.Time) bool

FirstNote records that note was printed today and reports whether this is the first time.

func (*Store) FirstRoundSkipped

func (s *Store) FirstRoundSkipped(key string) bool

func (*Store) HeldToday

func (s *Store) HeldToday(now time.Time) []string

HeldToday lists the PRs a cap held back today.

func (*Store) Mark added in v0.2.0

func (s *Store) Mark(key, name string) string

Mark is key's mark name; empty when none.

func (*Store) RecordSent added in v0.2.0

func (s *Store) RecordSent(key, mark, fingerprint string, now time.Time)

RecordSent notes an automated round sent, spends one of key's turns of now's day, and sets its mark to fingerprint; an empty fingerprint keeps the mark as it was, for a round no review started.

func (*Store) Saved

func (s *Store) Saved()

Saved forgets the changes once a repository wrote them.

func (*Store) SetAgentHome

func (s *Store) SetAgentHome(key, dir string)

func (*Store) SetHeads added in v0.2.0

func (s *Store) SetHeads(key, checksHead, conflictHead string)

SetHeads marks the failing checks and the conflict of the heads an address round covered; an empty head leaves its mark as it was.

func (*Store) SetMark added in v0.2.0

func (s *Store) SetMark(key, name, value string)

SetMark sets key's mark name; an empty value removes it.

func (*Store) SkipFirstRound

func (s *Store) SkipFirstRound(key string)

Jump to

Keyboard shortcuts

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