Documentation
¶
Overview ¶
Package prrow derives the row of a pull request from what the store, the gate and the turns say of it: the github provider of the read model.
Index ¶
- Constants
- func BookOf(in any) (turn.Book, bool)
- func BriefSummary(b brief.Summary) *api.BriefSummary
- func EventsOf(in any) []dinv.Event
- func FacetSpecs() []api.FacetSpec
- func IgnoreOf(cfg config.Config) []string
- func InScope(r api.Row) bool
- func LapsedMutes(k readmodel.Kept) []dinv.Override
- func MuteLapsed(pr dinv.PR, o dinv.Override, kind situation.Kind) bool
- func NeedsMe(r api.Row) bool
- func NudgeRefusal(ref github.Ref, who []string, why string, since time.Time, evs []dinv.Event, ...) string
- func NudgeTargets(r api.Row, author, viewer string, ignore []string) ([]string, string)
- func Override(o dinv.Override) api.Override
- func PROf(in any) (dinv.PR, bool)
- func SituationSpecs() []api.SituationSpec
- func Situations(k readmodel.Kept, at time.Time) []dinv.Situation
- func Started(facts map[github.Ref]TurnFact) bool
- func TurnFacts(books map[unit.Unit]turn.Book, reg *dintent.Registry) map[github.Ref]TurnFact
- func Unmuted(in any) any
- func ViewSpecs() []api.ViewSpec
- func Waiting(facts map[github.Ref]TurnFact, agents []turns.AgentObservation, agentsOK bool, ...)
- func Workspace(w dinv.Workspace) api.Workspace
- type Briefs
- type Deriver
- func (d Deriver) AddActivity(p *Payload, a inventory.Activity)
- func (d Deriver) Attention(r api.Row, in any) *api.Attention
- func (d Deriver) FactsOf(pr dinv.PR, evs []dinv.Event, o dinv.Override, r api.Row, p Payload, ...) catalog.Facts
- func (d Deriver) Notice(r api.Row, in any) (Notice, bool)
- func (d Deriver) Parts(pr dinv.PR, evs []dinv.Event, o dinv.Override) (api.Row, Payload)
- func (d Deriver) Row(pr dinv.PR, evs []dinv.Event, o dinv.Override) api.Row
- func (d Deriver) Seal(r api.Row, p Payload) api.Row
- func (d Deriver) UntrackedRow(c dgh.Candidate, o dinv.Override) api.Row
- type LastHuman
- type Mute
- type Notice
- type NoticeCase
- type Payload
- type Provider
- func (p *Provider) Derive(base readmodel.Base, in any, at time.Time) (api.Row, error)
- func (p *Provider) Facets() []api.FacetSpec
- func (p *Provider) Listed(ctx context.Context) ([]unit.Unit, error)
- func (p *Provider) Load(ctx context.Context, units []unit.Unit) (map[unit.Unit]any, error)
- func (p *Provider) Provider() unit.ProviderID
- func (p *Provider) Situations() []api.SituationSpec
- func (p *Provider) Views() []api.ViewSpec
- type Source
- type Store
- type TurnFact
Constants ¶
const ( ViewPlan = "plan" ViewDash = "dash" ViewExplore = "explore" ViewRecent = "recent" )
View ids the GitHub plugin serves besides api's core ids.
const ( FacetRepo = "repo" FacetAuthor = "author" FacetWait = "wait" FacetWaitsOn = "waits-on" FacetKind = "kind" FacetType = "type" FacetRisk = "risk" FacetSize = "size" FacetStatus = "status" FacetTag = "tag" FacetIs = "is" FacetCI = "ci" FacetOpened = "opened" FacetScope = "scope" FacetAge = "age" FacetLane = "lane" FacetDue = "due" )
Facet ids of the GitHub rows.
const NudgeMaintainers = "the maintainers (no reviewer requested)"
NudgeMaintainers is whom a nudge asks on the user's own pull request with no reviewer: the skill mentions nobody, or the one code owner.
const RenudgeAfter = 24 * time.Hour
RenudgeAfter is how long a wait that a nudge did not move stays nudged.
const SourceSession = "session"
SourceSession is the intake source of a request a managed session asked.
Variables ¶
This section is empty.
Functions ¶
func BriefSummary ¶
func BriefSummary(b brief.Summary) *api.BriefSummary
BriefSummary is the row's view of a brief.
func EventsOf ¶
EventsOf are the events a row's input holds, oldest first; the caller must not change them.
func LapsedMutes ¶
LapsedMutes are the stored overrides whose "mute until state change" lapsed: the rows of k show them unmuted.
func MuteLapsed ¶
MuteLapsed tells whether o's "mute until state change" lapsed: the pull request is open and its situation, kind, is no longer the muted one. The row then shows no mute, and the read model's keeper clears the stored one.
func NeedsMe ¶
NeedsMe is the exact needs-me predicate of Deriver.views, evaluated on UnmutedKind and UnmutedWaitingOn when the row is muted; views adds needs-me only when it holds and the row is not muted.
func NudgeRefusal ¶
func NudgeRefusal(ref github.Ref, who []string, why string, since time.Time, evs []dinv.Event, now time.Time) string
NudgeRefusal is the text a nudge is refused with now, "" when it would go.
func NudgeTargets ¶
NudgeTargets is who a nudge mentions, or why it mentions nobody: r's kind, waits-on and reason, author its pull request's author.
func SituationSpecs ¶
func SituationSpecs() []api.SituationSpec
SituationSpecs are the served situations of Situations.
func Situations ¶
Situations are the followed open pull requests whose row's situation, "<kind>:<waiting-on>", differs from their newest situation event, seen at at. A pull request whose started turn's session could not be read is left for a later snapshot, so a failed read never records it as working.
func TurnFacts ¶
TurnFacts reads every book's driving turn, with the session of a started one; whether that session waits is resolved by Waiting.
func Waiting ¶
func Waiting(facts map[github.Ref]TurnFact, agents []turns.AgentObservation, agentsOK bool, session func(handle string) (turn.Session, bool, error), logf func(string, ...any))
Waiting resolves each started turn against Orca's agents: session reads a session by handle. With agentsOK false every started turn is unread.
Types ¶
type Briefs ¶
type Briefs interface {
Briefed(ctx context.Context) (map[github.Ref]brief.Summary, map[github.Ref]dinv.BriefRecord, error)
// AttemptOf is the brief attempt a first turn of pr waits on.
AttemptOf(pr dinv.PR, rec dinv.BriefRecord) int
}
Briefs reads the brief records with their summaries.
type Deriver ¶
type Deriver struct {
Viewer string
Teams []string
Ignore []string
Now time.Time
Stalled config.Stalled
Pending map[unit.Unit]round.Pending
Turns map[github.Ref]TurnFact
// What the actions read besides the row.
Loaded *intentload.Loaded
Specs []api.ActionSpec // nil: catalog.Specs(Loaded)
Cfg config.Config
GateOn, BriefOn bool
Forceable func(unit.Unit) string
Intakes map[pr.Ref][]intake.Intake
SpecsVersion string
// Asked is the action a request asks for, whose inputs an open intake
// joins on; zero for a row served to a client.
Asked catalog.Asked
}
Deriver derives rows at one instant from what every row shares.
func DeriverAt ¶
DeriverAt is the deriver of a request: base and the settings, at the minute at, with no turn and no intake of any pull request.
func (Deriver) AddActivity ¶
AddActivity puts the pull request's turns, usage and brief retry in the payload's facts.
func (Deriver) Attention ¶
Attention is the notification of r, a row of needs-me derived from in, nil when it notifies nothing. A held round's id holds the day.
func (Deriver) FactsOf ¶
func (d Deriver) FactsOf(pr dinv.PR, evs []dinv.Event, o dinv.Override, r api.Row, p Payload, unmuted api.Row) catalog.Facts
FactsOf gathers the facts of a row of the inventory; unmuted is the situation without the user's mute, which a nudge reads.
func (Deriver) Notice ¶
Notice is what r, a row of this provider derived from in, notifies at d.Now; ok is false when it notifies nothing.
func (Deriver) Parts ¶
Parts derives a pull request's row and payload before Seal: a caller adds the brief, the intake and the activity in between.
type Notice ¶
type Notice struct {
Case NoticeCase
// Token lasts as long as what is notified: the pending round's since,
// the held day, the blocking reason, the question's record, the waiting
// episode.
Token string
// Record is the question's turn record.
Record int64
Attention api.Attention
}
Notice is what a needs-me row notifies; Attention carries no ID and no Category, which the caller keys.
type NoticeCase ¶
type NoticeCase string
NoticeCase is what a needs-me row notifies of.
const ( NoticeRound NoticeCase = "round" NoticeHeld NoticeCase = "held" NoticeBlocked NoticeCase = "blocked" NoticeQuestion NoticeCase = "question" NoticeWait NoticeCase = "wait" )
func (NoticeCase) Item ¶
func (c NoticeCase) Item() string
Item is the id prefix of the derived item whose entry carries the case's notification; "" for a question, which the turn's Inbox message carries.
type Payload ¶
type Payload struct {
Author string `json:"author"`
Repo string `json:"repo"`
Head string `json:"head"`
Approved bool `json:"approved"`
Reasons []string `json:"reasons"`
Workspace api.Workspace `json:"workspace"`
Override api.Override `json:"override,omitzero"`
Brief *api.BriefSummary `json:"brief,omitempty"`
Intake *api.Intake `json:"intake,omitempty"`
Facts *api.RowFacts `json:"facts,omitempty"`
Viewer string `json:"viewer"` // the deriver's viewer login
UnmutedKind string `json:"unmuted_kind,omitempty"` // the kind the row would have without its mute ("" when not muted)
UnmutedWaitingOn string `json:"unmuted_waiting_on,omitempty"` // the waiting-on the row would have without its mute
UnmutedReason string `json:"unmuted_reason,omitempty"` // the reason the row would have without its mute
LastHuman *LastHuman `json:"last_human,omitempty"` // newest human event on the PR not by the viewer; nil none
Mute *Mute `json:"mute,omitempty"` // the override's mute; nil when not muted
// contains filtered or unexported fields
}
Payload is the GitHub row's payload; JSON keys as today's Row, plus viewer, unmuted_kind, unmuted_waiting_on, last_human and mute.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is the github provider of the read model: one row per pull request of the inventory, but lapsed ones nobody adopted.
func (*Provider) Facets ¶
Facets are today's cockpit fields, in its order, plus the time facet due that the is flag "due" reads.
func (*Provider) Listed ¶
Listed lists every pull request of the inventory but the lapsed ones nobody adopted, the most recently updated first.
func (*Provider) Load ¶
Load reads what the rows of units derive from, in one query per kind of input.
func (*Provider) Provider ¶
func (p *Provider) Provider() unit.ProviderID
func (*Provider) Situations ¶
func (p *Provider) Situations() []api.SituationSpec
Situations are the GitHub kinds with their labels, ranked as the cockpit orders them.
type Source ¶
Source is where the provider reads rows from: the daemon's RowDeps, the inventory and the brief queue. Briefs may be nil: the brief off.
type Store ¶
type Store interface {
PRsWithOverrides(ctx context.Context) ([]dinv.PR, map[github.Ref]dinv.Override, error)
EventsByPR(ctx context.Context, refs []github.Ref) (map[github.Ref][]dinv.Event, error)
Activities(ctx context.Context) (map[github.Ref]inventory.Activity, error)
BriefRecords(ctx context.Context, refs ...github.Ref) (map[github.Ref]dinv.BriefRecord, error)
}
Store is what the rows read of the inventory.
type TurnFact ¶
type TurnFact struct {
Facts situation.TurnFacts
// Session is the handle of a started turn's session, "" otherwise.
Session string
Waiting bool
Unread bool // the session of a started turn could not be read
Question *api.QuestionView
}
TurnFact is what a row reads of its pull request's turn book.