factsgithub

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 33 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 factsgithub is the github source's workflow facts: the pull requests a sweep plans over, as automation.Units, and their author facts, as views.Facts. It reads the store, the workspace snapshot and the local checkouts; only Moved asks GitHub.

Index

Constants

View Source
const (
	RoundFollowup = "follow-up"
	RoundFirst    = "first"
	RoundAddress  = "address"
)

The rounds a Candidate names.

Variables

This section is empty.

Functions

func InventoryInputs

func InventoryInputs(st *inventory.Store) sweep.Inputs

InventoryInputs are the planning inputs as the inventory stores them.

func LocalGit

func LocalGit(g gitx.Git) sweep.LocalGit

LocalGit reads the checkouts through git.

func SnapshotOf

func SnapshotOf(set *workspace.Set) sweep.Snapshot

SnapshotOf is the snapshot merged from every manager of set; nil when one keeps none.

Types

type Branches

type Branches interface {
	LocalBranchTip(ctx context.Context, dir, branch string) (string, error)
	CheckedOutAt(ctx context.Context, dir, branch string) (string, error)
	HasCommit(ctx context.Context, dir, oid string) (bool, error)
	IsAncestor(ctx context.Context, dir, ancestor, commit string) (bool, error)
}

Branches reads what a first round's review workspace would find of the pull request's head branch in the local checkout.

type Candidate

type Candidate struct {
	Round        string
	Workspace    wsdomain.Workspace
	Facts        sweep.Facts
	Fingerprint  string
	ChecksHead   string
	LastReviewAt time.Time
	Observed     bool
}

Candidate is what a round is planned with.

type Deps

type Deps struct {
	Inputs   sweep.Inputs
	Store    Store
	Snapshot sweep.Snapshot
	Books    sweep.Books
	Rounds   sweep.Rounds
	Git      sweep.LocalGit
	Branches Branches
	Stubs    StubReader
	Cfg      func() config.Config
	// Sink is the view sink whose columns the workspaces report as statuses.
	Sink    string
	Clock   port.Clock
	Changes port.Changes
	Teams   func(ctx context.Context) ([]string, error)
	// Agents are the agents by name, for the answer a start block waits on.
	Agents  map[string]turns.Agent
	Intents func() *dintent.Registry
}

Deps are what the provider reads. Changes, Teams, Agents and Intents may be nil: without Changes every call reads the store again.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider is the github source's facts.

func New

func New(d Deps) *Provider

func (*Provider) Author

func (p *Provider) Author(ctx context.Context, u unit.Unit, needLocal bool) (*dview.AuthorFacts, error)

Author is what the views read of u's pull request to project its author card; with needLocal, also its author workspace's checkout, as far as dview.AuthorColumn may need it. Nil when the store holds no such pull request.

func (*Provider) Candidate

func (p *Provider) Candidate(ctx context.Context, u unit.Unit, round string) (Candidate, bool, error)

Candidate is the round of u the facts plan, with what its turn is sent with; false when that round is not due.

func (*Provider) Carded

func (p *Provider) Carded(ctx context.Context) ([]unit.Unit, error)

Carded lists, in order, the pull requests a workspace on the user's board targets: those whose cards the facts move without a turn.

func (*Provider) Due

func (p *Provider) Due() time.Time

Due is the earliest instant after now a decision of the last evaluation changes with no input changing.

func (*Provider) Facts

func (p *Provider) Facts(ctx context.Context, u unit.Unit) (workflow.Facts, error)

Facts are the pr facts of u; a pull request the store does not hold yet has those that need no row.

func (*Provider) List

func (p *Provider) List(ctx context.Context, id unit.ProviderID) ([]unit.Unit, error)

List is every unit a workflow over pull requests may act on: those a sweep plans over, the open ones nothing lapsed, the ones with an open turn and the ones with an answer waiting.

func (*Provider) Moved

func (p *Provider) Moved(ctx context.Context, units []unit.Unit) ([]unit.Unit, error)

Moved reads, in one batched read before the loop lock, the stub of each unit's pull request and returns those GitHub shows closed or moved since the inventory row the plan read: under the lock a round asks GitHub nothing. A failed read moves them all. Units are planned again after the next fast run. A unit whose rounds are all observed is not read, as no round of it would go out.

func (*Provider) Prefetch

func (p *Provider) Prefetch(ctx context.Context, units []unit.Unit) error

Prefetch reads the facts of units in one query, for the Author calls that follow on the same view.

func (*Provider) Refresh

func (p *Provider) Refresh(ctx context.Context) error

Refresh records, before the plan, the start blocks the agent home answered: a round they held may then be planned in the same sweep.

func (*Provider) Settle

func (p *Provider) Settle(ctx context.Context, st automation.State) error

Settle writes, after the steps, what planning leaves behind: the fingerprint a review stored without its head gets, the first round skip a review workspace clears, and the first rounds' block and unblock events. st is the sweep's round state; Settle edits it and the sweep saves it.

type RoundState

type RoundState interface {
	automation.State
	Rounds() *round.Store
}

RoundState is the sweep's round state as Settle receives it.

type Store

type Store interface {
	Overrides(ctx context.Context) (map[pr.Ref]dinv.Override, error)
	// FirstRoundBlocks maps each unit whose round is blocked to its
	// round_blocked event.
	FirstRoundBlocks(ctx context.Context) (map[unit.Unit]port.Event, error)
	EventsByPR(ctx context.Context, refs []pr.Ref) (map[pr.Ref][]dinv.Event, error)
	RecordEvent(ctx context.Context, ev dinv.Event) error
}

Store is what the facts read of the inventory besides the planning inputs, and the events Refresh and Settle record.

type StubReader

type StubReader interface {
	StubsByRef(ctx context.Context, refs []github.Ref) (map[github.Ref]github.Stub, map[github.Ref]error, error)
}

StubReader reads pull requests' stubs from GitHub in one batched read.

Jump to

Keyboard shortcuts

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