Documentation
¶
Overview ¶
Package situation derives who a pull request is waiting on, and since when, from the pull request and its events alone. The host lays its own state over it: a run on the pull request, the user's mute and a pending round.
Index ¶
Constants ¶
const NudgeWindow = 2 * time.Hour
NudgeWindow bounds how long after a nudge is asked for its comment can be posted: the agent reads the pull request first.
const ReasonMax = 200
ReasonMax bounds a reason that comes from an agent or a CI, so a row and a notification stay one line; the host cuts its own reasons alike.
Variables ¶
var Reasons = map[string]string{
"merged": "merged",
"closed": "closed",
"round_blocked": "round blocked: {{.why}}",
"round_held": "automatic round held: {{.why}}",
"to_address": "review to address, no workspace: {{.why}}",
"agent_asked": "the agent asked you something",
"round_in_progress": "review round in progress",
"draft": "draft",
"checks_failing": "checks failing on the head",
"checks_failing_named": "checks failing: {{.checks}}",
"checks_failing_more": "checks failing: {{.checks}} and {{.more}} more",
"changes_requested": "changes requested by {{.actor}}",
"merge_conflicts": "merge conflicts with {{.branch}}",
"approved_green": "approved and green",
"approved_checks_pending": "approved, checks pending",
"review_requested": "review requested, no review on the head",
"review_requested_again": "review requested again after your review",
"reviewer_not_back": "{{.author}} replied, {{.reviewer}} has not returned",
"commented_no_reply": "{{.actor}} commented, no reply",
"no_reviewer_requested": "no reviewer requested",
"review_wanted": "your review is wanted, no review on the head",
"no_review_required": "green, no review required",
"no_review_required_checks_pending": "no review required, checks pending",
}
Reasons are the reasons Derive gives, by key, each as the English sentence agents and logs read; ui.toml's [reasons] words each for people, {{.name}} where a value goes.
Functions ¶
func ActiveBlock ¶
ActiveBlock is the newest round_blocked event of evs, oldest first, that no later event ended: a round_unblocked, a round sent or held, or a review by viewer.
Types ¶
type Input ¶
type Input struct {
PR pr.PR
Events []pr.Event
Viewer string // my login
MyTeams []string // "org/slug", any case
Ignore []string // actors whose comments and reviews never count: automated reviewers
// Now is when the situation is derived: a round held by the cap holds
// only on the local day it was held.
Now time.Time
Stalled Thresholds
// AddressedAt is when the pull request's driving turn, an address turn,
// reached its state; zero without one.
AddressedAt time.Time
// ThreadsSettledAt is when a full read last found the pull request's
// review threads, at least one, every one resolved; zero when it did not.
ThreadsSettledAt time.Time
// AskedAt is when the newest turn of an intent on the pull request asked
// the user something no answer reached yet; zero without one.
AskedAt time.Time
// ReviewerOptional says the profile's reviewer_required does not hold for
// the pull request: with no reviewer asked, it is ready as an approved one.
ReviewerOptional bool
// ReviewWanted says the profile's review_wanted holds for the pull
// request: with no reviewer asked, one I did not open and did not review
// on its head waits on my review.
ReviewWanted bool
}
type Kind ¶
type Kind string
Kind is a situation of plugin.toml's row_kinds.
const ( KindDone Kind = "done" KindHeldByCap Kind = "held" KindBlocked Kind = "blocked" KindToAddress Kind = "to_address" KindLoopWorking Kind = "loop_working" KindLoopWaiting Kind = "loop_waiting" KindDraft Kind = "draft" KindChecks Kind = "checks" KindChanges Kind = "changes" KindMerge Kind = "merge" KindConflicts Kind = "conflicts" KindReply Kind = "reply" KindReviewerBack Kind = "reviewer_back" KindReview Kind = "review" KindNoReviewer Kind = "no_reviewer" )
The situations the plugin derives.
type Result ¶
type Result struct {
Kind Kind
WaitingOn string // login(s), "me", "author", "nobody"
Since time.Time
Reason string
// ReasonKey names Reason among Reasons, which ReasonParams fill; the plugin's profile layer words it
// for the rows.
ReasonKey string
ReasonParams map[string]string
// Stalled is when the situation stalls: true once its threshold has
// passed since Since, in working days; zero never stalls.
Stalled src.Value
}
type Thresholds ¶
Thresholds are how long, in working days, a situation lasts before it is stalled; zero never stalls.