decide

package
v0.0.57 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: Apache-2.0 Imports: 0 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 decide chooses which changes of a plan to start now and says why it holds each of the others. It reads nothing and writes nothing: the caller gathers the facts from the store and starts what it returns.

Index

Constants

View Source
const (
	AfterPrefix     = "after "
	AfterSuffix     = " has not landed"
	ReasonUnended   = "has an unended run"
	ReasonOpenPR    = "has an open PR from an earlier run: "
	ReasonMerged    = "its PR merged and is not on the default branch here yet: "
	ReasonAbandoned = "abandoned: its PR was closed without merging and a person has not answered"
	ReasonNoPR      = "its last run ended without a PR and a person has not said to run it again"
	ReasonNoSlot    = "no free slot"
)

The reasons a change is held. The ones ending in a space are followed by a URL; the after reason is AfterPrefix, the change's name and AfterSuffix.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	Name  string
	After []string
}

Change is one change of the plan with the names it comes after.

type Hold

type Hold struct {
	Change, Reason string
}

Hold says why a change is not started.

type Input

type Input struct {
	Changes []Change
	Landed  map[string]bool
	Runs    map[string]RunFacts
	Free    int // slots free for new runs
}

Input is everything Decide looks at. Changes are in plan order.

type Output

type Output struct {
	Start []string
	Held  []Hold
}

Output lists the changes to start, in plan order, and the held ones. A landed change is in neither.

func Decide

func Decide(in Input) Output

Decide walks the changes in plan order. Each landed change is skipped; the first rule that applies holds each other one; the rest are ready and are started in plan order until Free is used up.

type RunFacts

type RunFacts struct {
	Unended   bool   // some run has not ended
	OpenPR    string // an ended run's PR the forge says is open, or has never described
	MergedPR  string // a run's PR the forge says merged, while the change has not landed
	Abandoned bool   // an abandoned item for the change is unanswered
	NoPR      bool   // the newest run ended without a PR and nobody said to run it again
}

RunFacts is what the runs of one change say.

Jump to

Keyboard shortcuts

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