look

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: 10 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 look is the reading half of one look of the engine's loop at a driven pursuit: with no transaction open it reads which changes have landed from version control, asks the forge whether each run's PR is open, merged or closed when the forge's next time has come, loads the harness binding and reads the machine's slots, and returns all of it as one result. It touches no store and no clock but the time in its payload, and it only reads the forge: it never merges, closes or edits a PR.

Index

Constants

View Source
const (
	ForgeOK     = "ok"
	ForgeFailed = "failed"
)

What a look did with the forge. Empty is that it did not ask: there is no forge that reads PR states, no PR to ask about, or its next time had not come.

View Source
const NoBind = "this engine was given no way to load the harness binding, so it can start no run"

NoBind is why no run can start on an engine that was given no way to load a harness binding.

View Source
const Scheme = "https://"

Scheme is how a PR's value must start for the forge to be asked about it. A PR is a harness's word and reaches the forge's tool as an argument, so any other value is never asked about and stays unseen.

Variables

This section is empty.

Functions

func Check

func Check(payload json.RawMessage) error

Check refuses a payload a look cannot use: one without its store directory, pursuit or time, or with a PR that names no run or does not start with Scheme.

func Do

func Do(ctx context.Context, payload json.RawMessage, d Deps) (string, error)

Do carries out one look. The repo root is the store directory's grandparent (.git/physa). A failure of version control, the forge or the binding is part of the result, never an error: Do fails only when its payload cannot be read. It never fetches and never writes to the forge.

Types

type Binding

type Binding struct {
	Level  int    `json:"level"`
	Start  string `json:"start"`
	Result string `json:"result"`
	Stop   string `json:"stop"`
}

Binding is the harness binding's level and command lines, as a run is started with them.

type Deps

type Deps struct {
	Env      []string
	NewForge func(root string) forge.Forge
	Bind     func(root string) (Binding, error)
	Slots    func() int
}

Deps is what a look reads through. Env is the environment git runs in. NewForge gives the forge of a repo root; nil, a nil forge or one that does not read PR states means the forge is not asked. Bind gives the binding of a repo root, or why no run can start there; nil means none can. Slots nil means 1.

type In

type In struct {
	Store         string    `json:"store"`
	Pursuit       string    `json:"pursuit"`
	Since         time.Time `json:"since,omitzero"`
	PRs           []PR      `json:"prs,omitempty"`
	ForgeFailures int       `json:"forge_failures"`
	ForgeNext     time.Time `json:"forge_next,omitzero"`
	At            time.Time `json:"at"`
}

In is a look's payload: the store directory, the pursuit and when it was created, the PRs to ask the forge about, the forge's backoff as the store held it, and At, the time of the tick that asked for the look. At is the look's only clock.

type Out

type Out struct {
	Landed     map[string]progress.Landing `json:"landed"`
	VCSError   string                      `json:"vcs_error,omitempty"`
	Seen       []Seen                      `json:"seen,omitempty"`
	Unread     []string                    `json:"unread,omitempty"`
	Forge      string                      `json:"forge,omitempty"`
	ForgeError string                      `json:"forge_error,omitempty"`
	ForgeRetry time.Time                   `json:"forge_retry,omitzero"`
	Bind       Binding                     `json:"bind"`
	BindError  string                      `json:"bind_error,omitempty"`
	Slots      int                         `json:"slots"`
}

Out is a look's result. Landed is what version control showed, and VCSError why it could not be read. Seen holds each PR state the forge gave, Unread each PR it could not read and why, Forge what the asking came to, with ForgeError when it failed and ForgeRetry the time a rate limit named. Bind is the binding, or BindError says why no run can start. Slots is how many runs may be live at once on this machine.

type PR

type PR struct {
	Run int64  `json:"run"`
	URL string `json:"url"`
}

PR is one run's PR to ask the forge about.

type Seen

type Seen struct {
	Run   int64         `json:"run"`
	URL   string        `json:"url"`
	State forge.PRState `json:"state"`
}

Seen is what the forge said of one run's PR.

Jump to

Keyboard shortcuts

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