decide

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package decide is ynf's decider (ADR-006): a pure function from (lane, item, facts, event) to (next item, actions). No I/O, no clock (time comes from the event), no model calls. Given the same inputs it returns the same decision, which is what makes `ynf replay` possible.

Index

Constants

View Source
const (
	Run        = "run"         // start the lane's runner on a fresh worktree
	OpenPR     = "open_pr"     // diff gate, commit with trailers, push, open or update the pull request
	PushCommit = "push_commit" // adopted items: diff gate, commit, push to the pull request's branch, never forced
	Escalate   = "escalate"    // tell a human, on the ticket
	Quarantine = "quarantine"  // tell a human the item was taken out of rotation
	Comment    = "comment"
	Close      = "close"
	// Label is the lane's labels for a state the item enters; the engine writes them as the item
	// moves, so they follow the decision without being one.
	Label = "label"
)

Action kinds the engine carries out. Each is idempotent per step (ADR-005).

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Kind     string `json:"kind"`
	Feedback string `json:"feedback,omitempty"` // for run: what the runner is told
	Reason   string `json:"reason,omitempty"`   // for escalate, quarantine, comment
}

Action is one thing for the engine to do.

type Decision

type Decision struct {
	Item    item.Item `json:"item"`
	Actions []Action  `json:"actions,omitempty"`
	Reason  string    `json:"reason"`
}

Decision is the decider's output.

func Decide

func Decide(in Input) Decision

Decide is the decider.

type Input

type Input struct {
	Lane  policy.Lane `json:"lane"`
	Item  item.Item   `json:"item"`
	Facts facts.Facts `json:"facts"`
	Event event.Event `json:"event"`
	Poll  Poll        `json:"poll"`
}

Input is everything a decision reads.

type Poll

type Poll struct {
	CI     time.Duration `json:"ci"`
	Review time.Duration `json:"review"`
}

Poll is how often waiting states are re-probed. It is an input, recorded with the decision.

Jump to

Keyboard shortcuts

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