Documentation
¶
Overview ¶
Package driveplan proposes how to drive a set of tasks: which to bundle on one branch, which to leave alone, and which After: lines to add. It reads nothing itself, so every rule is a table test; gathering lives in drive.
Index ¶
Constants ¶
const ( KindFeature = "feature" KindBug = "bug" KindRefactor = "refactor" KindSpike = "spike" )
The kinds a task may carry, as fetch settles them.
const Tradeoff = "a bundle is one PR: one revert, one review over a mixed diff, " +
"and a later bug is traced to its lead with the riders named"
Tradeoff is said once under a proposal holding a bundle.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edit ¶
type Edit struct {
Task string `json:"task"`
After string `json:"after"` // "none" drops the line
Reason string `json:"reason"`
}
An Edit is an After: line the proposal adds to a task, applied only on a yes.
type Entry ¶
type Entry struct {
IDs []string `json:"ids"`
Reason string `json:"reason"`
Base string `json:"after,omitempty"` // the one base outside the entry
Lines int `json:"lines,omitempty"`
Profile string `json:"profile,omitempty"`
// contains filtered or unexported fields
}
An Entry is one item of the drive command: a task or a bundle.
type Formed ¶
type Formed struct {
Bundles int `json:"bundles"`
Bundled int `json:"bundled"`
Waits int `json:"ciWaitsSaved"`
}
Formed is a saving the rules found by themselves.
type Input ¶
type Input struct {
Tasks []Task
MaxLines int // bundle_max_lines
Parallel int // the ceiling on --parallel, 0 for none
}
Input is the candidates in the parent's order, with the caps.
type Plan ¶
type Plan struct {
Stages []Stage `json:"stages"`
Edits []Edit `json:"edits,omitempty"`
Args []string `json:"args"` // the drive command's arguments
Parallel int `json:"parallel"`
Waits int `json:"ciWaitsSaved"`
Finishes int `json:"finishesSaved"`
Bundles int `json:"bundles"`
Bundled int `json:"bundled"` // tasks inside a bundle
// Formed counts the bundles the rules formed, the user's own left out, so
// a hint never offers what the user already bundled
Formed Formed `json:"formed"`
}
A Plan is the proposal.
func Propose ¶
Propose applies the rules: alone first, then bundles within a class by shared files or areas, split at the cap, then stages by After: depth.
func (Plan) Hint ¶
Hint is the one line a plain drive prints when the rules alone would save at least one CI wait, "" otherwise.
type Stage ¶
type Stage struct {
Entries []Entry `json:"entries"`
}
A Stage is the entries at one depth of the After: graph.
type Task ¶
type Task struct {
ID string `json:"id"`
Title string `json:"title,omitempty"`
Kind string `json:"kind,omitempty"` // "" reads as feature
Areas []string `json:"areas,omitempty"`
Files []string `json:"files,omitempty"`
Lines int `json:"lines,omitempty"` // changed lines; 0 is not sized
// Estimated marks Lines as a model's guess rather than a measured diff
Estimated bool `json:"estimated,omitempty"`
Base string `json:"after,omitempty"` // the body's After: line
BuildsOn string `json:"buildsOn,omitempty"` // a task whose code this one builds on, with no After: saying so
Flow string `json:"flow,omitempty"` // the flow its areas map to, "" for the drive's
Profile string `json:"profile,omitempty"` // its :profile as typed
Risky string `json:"risky,omitempty"` // the word that marks it risky (migration), "" for none
Alone bool `json:"alone,omitempty"` // the user kept it alone
With string `json:"with,omitempty"` // the user bundled it with this task
After string `json:"afterEdit,omitempty"` // the user's After: for it, "none" to drop the body's
}
A Task is one candidate and what is known about it.