driveplan

package
v0.71.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 7 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 driveplan proposes how to start a set of tasks. It says which to bundle on one branch and which to leave alone, and spells which entry waits for which in the start command. It reads nothing itself, so every rule is a table test. Gathering lives in drive.

Index

Constants

View Source
const (
	KindFeature  = "feature"
	KindBug      = "bug"
	KindRefactor = "refactor"
	KindSpike    = "spike"
)

The kinds a task may carry, as fetch settles them.

View Source
const NoOrder = "none"

NoOrder is the user's After: that drops every base of a task.

View Source
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 Base added in v0.71.0

type Base struct {
	ID      string `json:"id"`
	Reason  string `json:"reason"`
	Dropped bool   `json:"dropped,omitempty"` // the flow does not finish, so the join was cut to one base
}

A Base is one task an entry waits for, and why.

type Entry

type Entry struct {
	IDs     []string `json:"ids"`
	Reason  string   `json:"reason"`
	Bases   []Base   `json:"bases,omitempty"` // the tasks outside the entry it waits for
	Lines   int      `json:"lines,omitempty"`
	Profile string   `json:"profile,omitempty"`
	Suffix  string   `json:"suffix,omitempty"` // a lone task's -suffix as typed
	// contains filtered or unexported fields
}

An Entry is one item of the start command: a task or a bundle.

func (Entry) Token

func (e Entry) Token() string

Token is how the proposal's rows name the entry. The command adds its bases.

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
	// TypedParallel says the user typed that ceiling, so the command prints
	// it even at 1, where a default ceiling of 1 prints nothing
	TypedParallel bool
	// Carry is the start flags the user typed, put on the command as typed
	Carry []string
	// Joins says the run's flow finishes, so an entry may wait on several
	// bases. f10 start refuses a join otherwise, so only the first is kept.
	Joins bool
	// Finished is the bases outside the list that are finished, the only
	// outside bases f10 start lets a join wait on
	Finished []string
}

Input is the candidates in the parent's order, with the caps.

type Level added in v0.71.0

type Level struct {
	Entries []Entry `json:"entries"`
}

A Level is the entries at one depth of the base graph: every base of an entry sits in an earlier level.

type Plan

type Plan struct {
	Levels []Level  `json:"levels"`
	Args   []string `json:"args"` // the start command's arguments, the order spelled with , and @
	// Carry is the typed start flags the command ends in. Command is the one
	// place the line is built, for the text, the JSON and the hint.
	Carry []string `json:"carried,omitempty"`
	// Unordered is a line per task whose order the user dropped. Its body
	// still names a base, which the start would read back.
	Unordered []string `json:"unordered,omitempty"`
	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

func Propose(in Input) (Plan, error)

Propose applies the rules in order. Alone comes first, then bundles within a class by shared files or areas, split at the cap, then bases and levels.

func (Plan) Command

func (p Plan) Command() string

Command is the start command line the proposal runs: its arguments, then the start flags the user typed.

func (Plan) Hint

func (p Plan) Hint() string

Hint is the one line a plain start prints when the rules alone would save at least one CI wait, "" otherwise: the start command that saves them.

func (Plan) Saving

func (p Plan) Saving() string

Saving is the line naming what bundling saves, "" when it saves nothing.

func (Plan) Write

func (p Plan) Write(w io.Writer, notes []string) error

Write prints the proposal: the levels, the order with its reasons, the command, the saving, and the trade-off once.

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"`  // tasks whose code this one builds on, with no After: saying so
	Flow      string   `json:"flow,omitempty"`      // the flow its areas map to, "" for the batch'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 bases for it, ["none"] to drop every base
	// Suffix is its -suffix as typed, one attempt of the task, which never bundles
	Suffix string `json:"suffix,omitempty"`
}

A Task is one candidate and what is known about it.

Jump to

Keyboard shortcuts

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