present

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 30 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 present is the GitHub plugin's source logic the daemon reaches through Action and View: the user's mutes, the rows of pull requests the read model does not list, the detail, the checks, Explore and the timings; and its bookkeeping on each snapshot of the rows.

Index

Constants

View Source
const (
	ViewExplore       = "explore"
	ViewExploreRecent = "explore.recent"
)

The views the plugin serves besides the daemon's unit views.

View Source
const (
	ActionMute         = "mute"
	ActionUnmute       = "unmute"
	ActionNudgePrepare = "nudge.prepare"
)

The actions the plugin runs.

View Source
const FailureDays = 14

FailureDays is how long after a merge a fix or a revert of the same files counts as that change failing.

Variables

This section is empty.

Functions

func Repo

func Repo(_ context.Context, u unit.Unit) (string, error)

Repo is the repository of a pull request, owner/name; "" for any other unit.

func WireBriefView

func WireBriefView(v *brief.View) *api.BriefView

WireBriefView is v as clients read it; nil for none.

Types

type BriefQueue

type BriefQueue struct{ Q Queue }

BriefQueue is a brief queue keyed by unit, as the daemon runs it; a unit that is no pull request has no brief.

func (BriefQueue) Attempt

func (b BriefQueue) Attempt(ctx context.Context, u unit.Unit) (int, error)

func (BriefQueue) Due

func (b BriefQueue) Due() <-chan struct{}

func (BriefQueue) Forget

func (b BriefQueue) Forget(ctx context.Context, u unit.Unit) error

func (BriefQueue) Run

func (b BriefQueue) Run(ctx context.Context) (string, error)

func (BriefQueue) Touched

func (b BriefQueue) Touched(units []unit.Unit)

type Briefs

type Briefs interface {
	Views(ctx context.Context, prs ...dinv.PR) (map[pr.Ref]*brief.View, error)
	RefreshIfStale(ctx context.Context, p dinv.PR) error
}

Briefs are the brief queue's views of pull requests.

type Deps

type Deps struct {
	Store *inventory.Store
	// Reports are what the GitHub plugin last reported of its pull
	// requests, which a row derives from.
	Reports readmodel.Reports
	// Host is the broker: the host's overrides, round state and wakes.
	Host src.Host
	// Briefs nil shows no brief.
	Briefs Briefs
	// Mutes are the user's mutes of pull requests, their tasks' wakes;
	// nil mutes none.
	Mutes readmodel.Mutes
	// Plugin runs an action of the running GitHub plugin, which serves the
	// nudge's prepare; nil serves none.
	Plugin func(ctx context.Context, req src.ActionRequest) (json.RawMessage, error)
	// View reads a view of the running GitHub plugin, which searches for
	// Explore and reads the failed steps of the checks; nil serves none.
	View func(ctx context.Context, req src.ViewRequest) (json.RawMessage, error)
}

Deps are what the presenter reads and writes: the plugin's store, the broker the host serves it, and GitHub.

type Host

type Host struct {
	Model    *readmodel.Model
	Settings func() readmodel.RowSettings
	BriefOn  bool
	Intakes  func(ctx context.Context) (map[unit.Unit][]intake.Intake, error)
	Books    func(ctx context.Context, units ...unit.Unit) (map[unit.Unit]turn.Book, error)
	Viewer   func(ctx context.Context) (src.Identity, error)
	Units    *unit.Registry
	Now      func() time.Time
	Logf     func(format string, args ...any)
}

Host is what the daemon serves the presenter beside the broker: the rows as its read model derives them.

type Presenter

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

Presenter is the GitHub plugin's Action, View and bookkeeping.

func New

func New(d Deps, h Host) *Presenter

New is the presenter over d, served by the host h.

func (*Presenter) Action

func (p *Presenter) Action(ctx context.Context, req src.ActionRequest) (json.RawMessage, error)

Action runs one of the plugin's actions on a pull request.

func (*Presenter) Keep

func (p *Presenter) Keep(ctx context.Context, k readmodel.Kept) error

Keep is the plugin's bookkeeping on each new snapshot of the rows: the situations that changed.

func (*Presenter) View

View serves one of the plugin's views.

type Queue

type Queue interface {
	Run(ctx context.Context) (string, error)
	Touched(refs []pr.Ref)
	Due() <-chan struct{}
	Forget(ctx context.Context, ref pr.Ref) error
	Attempt(ctx context.Context, ref pr.Ref) (int, error)
}

Queue is the brief queue keyed by pull request.

type Records

type Records struct{ Store *inventory.Store }

Records are the store's turns, briefs and unitless events as the daemon reads them.

func (Records) Brief

func (r Records) Brief(ctx context.Context, u unit.Unit) (intake.StoredBrief, bool, error)

Brief is u's stored brief, with how long its last run took.

func (Records) Turn

func (r Records) Turn(ctx context.Context, id string) (port.SentText, bool, error)

func (Records) UnitlessEvents

func (r Records) UnitlessEvents(ctx context.Context) ([]port.Event, error)

Jump to

Keyboard shortcuts

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