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 BriefState(rec dinv.BriefRecord, found bool) intake.BriefState
- func BriefSummary(b brief.Summary) *api.BriefSummary
- func EventsOf(in any) []dinv.Event
- func ExtraFacetSpecs(reg *dintent.Registry) []api.FacetSpec
- func IgnoreOf(cfg config.Config) []string
- func InScope(r api.Row) 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 Signals(r api.Row) map[string]bool
- func SituationOf(r Report, f *TurnFact, m overlay.Mute, evs []dinv.Event, now time.Time) (res, unmuted overlay.Situation)
- 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 Unstarted(b turn.Book) map[string]bool
- func Waiting(facts map[github.Ref]TurnFact, agents []turns.AgentObservation, agentsOK bool, ...)
- func Workspace(w dinv.Workspace) api.Workspace
- type Board
- type Briefs
- type Checkout
- type Deriver
- func (d Deriver) AddActivity(p *Payload, a turn.Activity)
- func (d Deriver) Attention(r api.Row, in any) *api.Attention
- func (d Deriver) FactsOf(pr dinv.PR, evs []dinv.Event, m overlay.Mute, r api.Row, p Payload, ...) catalog.Facts
- func (d Deriver) Notice(r api.Row, in any) (Notice, bool)
- func (d Deriver) Parts(rep Report, evs []dinv.Event, o dinv.Override) (api.Row, Payload)
- func (d Deriver) Row(rep Report, 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 Plan
- type Provider
- func (p *Provider) Book(in any) (turn.Book, bool)
- func (p *Provider) CardSignals() []api.SignalSpec
- func (p *Provider) Derive(base readmodel.Base, in any, at time.Time) (api.Row, error)
- func (p *Provider) Details() []api.DetailSpec
- func (p *Provider) Events() []api.EventSpec
- func (p *Provider) Facets() []api.FacetSpec
- func (p *Provider) Lens() api.ProviderWords
- 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) Notice(base readmodel.Base, row api.Row, in any, at time.Time) (readmodel.Notice, bool)
- func (p *Provider) Provider() unit.ProviderID
- func (p *Provider) Reasons() api.ProviderWords
- func (p *Provider) Signals(_ readmodel.Base, row api.Row, _ any, _ time.Time) map[string]bool
- func (p *Provider) Situations() []api.SituationSpec
- func (p *Provider) Unmuted(in any) any
- func (p *Provider) Views() []api.ViewSpec
- type Rank
- type Report
- type ReportedData
- type ReportedPRs
- func (r ReportedPRs) Data(ctx context.Context, units []unit.Unit) (map[unit.Unit]ReportedData, error)
- func (r ReportedPRs) Details(ctx context.Context, refs []pr.Ref) (map[pr.Ref]inventory.Detail, error)
- func (r ReportedPRs) List(ctx context.Context, open bool) ([]dinv.PR, error)
- func (r ReportedPRs) PR(ctx context.Context, ref pr.Ref) (dinv.PR, bool, error)
- func (r ReportedPRs) PRs(ctx context.Context, refs []pr.Ref) (map[pr.Ref]dinv.PR, error)
- type Source
- type Store
- type TurnFact
Constants ¶
const ( FacetWhere = "where" 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 FacetExtra = "extra."
FacetExtra prefixes the facet of an enum field of the brief intent's extra: extra.<name>.
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.
Variables ¶
This section is empty.
Functions ¶
func BriefState ¶ added in v0.3.0
func BriefState(rec dinv.BriefRecord, found bool) intake.BriefState
BriefState is what an intake shows of the brief record rec, found false for none.
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 ExtraFacetSpecs ¶ added in v0.2.0
ExtraFacetSpecs are the facets of the brief intent's enum extras, their values in the schema's order.
func NeedsMe ¶
NeedsMe is the needs-me predicate of the row's situation, evaluated on UnmutedKind and UnmutedWaitingOn when the row is muted; the row's needs-me flag holds 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, unstarted map[string]bool, now time.Time) string
NudgeRefusal is the text a nudge is refused with now, "" when it would go; unstarted are the turns that ended before their agent started them, whose nudged events do not count.
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 Signals ¶ added in v0.3.0
Signals are the link signals of r, a GitHub row derived under the host's overlays: stalled, an open pull request in scope whose situation lasted past its threshold; in_loop, an open one a review workspace holds; ready, an open one whose work is approved and no host state overlays; workspace, one a workspace of which remains, open or not. None of another provider's row.
func SituationOf ¶ added in v0.3.0
func SituationOf(r Report, f *TurnFact, m overlay.Mute, evs []dinv.Event, now time.Time) (res, unmuted overlay.Situation)
SituationOf is the situation of the report at now under the host's overlays: the run that drives its row, then the user's mute m, whose time is its newest muted event among evs; unmuted is it without the mute.
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 Unstarted ¶ added in v0.3.0
Unstarted are the ids of b's turns that ended before their agent started them, which posted nothing.
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 Board ¶ added in v0.3.0
type Board struct {
Carded bool `json:"carded,omitempty"`
ReviewWorkspace bool `json:"review_workspace,omitempty"`
AuthorWorkspace bool `json:"author_workspace,omitempty"`
Checkout *Checkout `json:"checkout,omitempty"`
}
Board is what the board reads of a pull request's workspaces: whether a workspace targets it, a review one or an author one free of an address round, and the author workspace an author card reads its checkout from.
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
// Plans are the automatic rounds the open plan gates hold, by unit.
Plans map[unit.Unit]overlay.Pending
// Mutes are the user's mutes of pull requests, their tasks' wakes.
Mutes map[unit.Unit]overlay.Mute
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
// Reasons are the plugin's words of the reasons its rows name, by key, which a notification says.
Reasons map[string]string
}
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, m overlay.Mute, 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. evs are the host's events of the pull request and o its overrides there.
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) Gate ¶ added in v0.3.0
func (c NoticeCase) Gate() gate.Kind
Gate is the kind of the gate the case stands for: a plan gate holds a pending or held round, a trust gate a blocked one; "" for the others.
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 mute its task's wake holds; 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 the GitHub plugin reported, but lapsed ones nobody adopted.
func (*Provider) Book ¶ added in v0.3.0
Book is the turn book of the input's pull request, when it has one.
func (*Provider) CardSignals ¶ added in v0.4.0
func (p *Provider) CardSignals() []api.SignalSpec
CardSignals are the GitHub plugin's words of its cards' signals.
func (*Provider) Details ¶ added in v0.3.0
func (p *Provider) Details() []api.DetailSpec
Details are the words of the GitHub plugin's detail fields.
func (*Provider) Facets ¶
Facets are the GitHub plugin's facets, as its manifest declares them, then the brief intent's enum extras.
func (*Provider) Lens ¶ added in v0.4.0
func (p *Provider) Lens() api.ProviderWords
Lens are the GitHub plugin's own row words.
func (*Provider) Listed ¶
Listed lists every pull request the plugin reported 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) Notice ¶ added in v0.3.0
func (p *Provider) Notice(base readmodel.Base, row api.Row, in any, at time.Time) (readmodel.Notice, bool)
Notice is what row, a row of this provider derived from in, notifies at the minute at.
func (*Provider) Provider ¶
func (p *Provider) Provider() unit.ProviderID
func (*Provider) Reasons ¶ added in v0.4.0
func (p *Provider) Reasons() api.ProviderWords
Reasons are the GitHub plugin's words of the reasons its rows name.
func (*Provider) Situations ¶
func (p *Provider) Situations() []api.SituationSpec
Situations are the GitHub kinds with their labels, ranked as the cockpit orders them.
type Rank ¶ added in v0.3.0
type Rank struct {
Path int `json:"path"`
At time.Time `json:"at,omitzero"`
Idx int `json:"idx,omitempty"`
}
Rank orders units as the planner plans their rounds, lowest first.
type Report ¶ added in v0.3.0
type Report struct {
PR dinv.PR
Situation src.Situation
Payload Payload
Views []string
Facets map[string][]string
Card *src.Card
Items []src.Item
// Facts are the workflow facts that read the pull request alone, and
// the planner's.
Facts []src.Fact
// Plan is the planner's rank of the pull request and what the board
// reads of its workspaces.
Plan Plan
}
Report is what the GitHub plugin last reported of a pull request, as its row reads it: the pull request, its situation from the source alone, and the source part of its payload, views and facets.
type ReportedData ¶ added in v0.3.0
type ReportedData struct {
PR dinv.PR `json:"pr"`
Detail *inventory.Detail `json:"detail"`
DetailVersion int `json:"detail_version"`
DetailReadAt time.Time `json:"detail_read_at"`
Tracked bool `json:"tracked"`
Adopted bool `json:"adopted"`
}
ReportedData is the data of the GitHub plugin's snapshot of a pull request that the host reads: the pull request, its full read and its overrides.
type ReportedPRs ¶ added in v0.3.0
ReportedPRs are the pull requests the GitHub plugin last reported, as the host reads them; the host keeps no copy of them.
func (ReportedPRs) Data ¶ added in v0.3.0
func (r ReportedPRs) Data(ctx context.Context, units []unit.Unit) (map[unit.Unit]ReportedData, error)
Data are the reported data of units, of every reported unit when nil; a unit with no pull request is absent.
func (ReportedPRs) Details ¶ added in v0.3.0
func (r ReportedPRs) Details(ctx context.Context, refs []pr.Ref) (map[pr.Ref]inventory.Detail, error)
Details are the full reads of refs as reported; a ref with none is absent.
func (ReportedPRs) List ¶ added in v0.3.0
List are every reported pull request, the open ones alone when open, the last updated first.
type Source ¶
type Source struct {
readmodel.RowDeps
Reports readmodel.Reports
Store Store
Briefs Briefs
// Catalog is the plugin's views, facets and situations; nil serves
// none.
Catalog readmodel.Presenter
// Mutes are the user's mutes of pull requests; nil mutes none.
Mutes readmodel.Mutes
}
Source is where the provider reads rows from: the daemon's RowDeps, the GitHub plugin's reports, the host's state of pull requests and the brief queue. Briefs may be nil: the brief off.
type Store ¶
type Store interface {
Overrides(ctx context.Context) (map[github.Ref]dinv.Override, error)
EventsByPR(ctx context.Context, refs []github.Ref) (map[github.Ref][]dinv.Event, error)
BriefRecords(ctx context.Context, refs ...github.Ref) (map[github.Ref]dinv.BriefRecord, error)
}
Store is what the rows read of the host's own state of pull requests: their overrides, events and brief records.
type TurnFact ¶
type TurnFact struct {
Facts overlay.Turn
// 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
// Unstarted are the ids of the turns that ended before their agent
// started them.
Unstarted map[string]bool
}
TurnFact is what a row reads of its pull request's turn book.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ghreporttest derives the GitHub plugin's snapshot of a pull request the host's tests hold as inventory rows, with the plugin's own code, so a host test renders the rows the running plugin's reports render.
|
Package ghreporttest derives the GitHub plugin's snapshot of a pull request the host's tests hold as inventory rows, with the plugin's own code, so a host test renders the rows the running plugin's reports render. |