waitrun

package
v0.200.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 12 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 waitrun observes bounded PR conditions and composes wait metadata effects. It does not import CLI packages or change pull requests.

Index

Constants

View Source
const (
	Settled   = "settled"
	Pending   = "pending"
	ReadError = "error"
)

TargetStatus values. "settled" means the requested condition holds; "pending" means it does not yet. "error" is a read that failed in a way a retry is unlikely to fix — a transient read stays pending on purpose, so a GitHub blip resumes instead of ending the wait with a false verdict.

Variables

This section is empty.

Functions

func ChecksKey

func ChecksKey(checks map[string]int) string

Types

type Condition

type Condition string
const (
	ChecksSettled Condition = "checks-settled"
	Changed       Condition = "changed"
	Closed        Condition = "closed"
)

type ListRequest

type ListRequest struct {
	ProjectsRoot string
	Prune        bool
}

type ListResult

type ListResult struct {
	Records []waitregistry.Record
	Removed int
	Pruned  bool
}

type Observer

type Observer struct {
	Read  func(context.Context, Reference) Target
	Now   func() time.Time
	Sleep func(context.Context, time.Duration) error
}

Observer retains the existing per-instance effects; nil uses real observations, the monotonic system clock and a context-cancelable timer.

func (Observer) Wait

func (observer Observer) Wait(ctx context.Context, request Request) Output

type Output

type Output struct {
	SchemaVersion int       `json:"schema_version"`
	ObservedAt    time.Time `json:"observed_at"`
	Until         string    `json:"until"`
	Status        string    `json:"status"`
	Observations  int       `json:"observations"`
	Targets       []Target  `json:"targets"`
	ResumeArgs    []string  `json:"resume_args,omitempty"`
}

type Reference

type Reference struct {
	Selector   string
	Repository string
	Number     string
}

type Registration

type Registration struct {
	ProjectsRoot, Kind string
	Targets            []Reference
	Until              string
	Slice              time.Duration
}

type Registry

type Registry struct {
	EnsureRoot func(string) (string, error)
	Register   func(string, waitregistry.Record) (func(), error)
	List       func(string, waitregistry.Options) ([]waitregistry.Record, error)
	Prune      func(string, waitregistry.Options) (int, error)
	Now        func() time.Time
	PID        func() int
	Identity   func() (worktrees.AgentIdentity, bool)
}

func DefaultRegistry

func DefaultRegistry() Registry

func (Registry) Inspect

func (registry Registry) Inspect(request ListRequest) (ListResult, error)

func (Registry) RegisterWait

func (registry Registry) RegisterWait(request Registration) func()

RegisterWait retains best-effort metadata and a nonnil release on every path.

type Request

type Request struct {
	Targets         []Reference
	Condition       Condition
	Slice, Interval time.Duration
	Progress        func(Update)
}

type Target

type Target struct {
	Selector   string                         `json:"selector"`
	Repository string                         `json:"repository"`
	Number     string                         `json:"number"`
	Status     string                         `json:"status"`
	State      string                         `json:"state,omitempty"`
	Draft      bool                           `json:"draft,omitempty"`
	Head       string                         `json:"head,omitempty"`
	Base       string                         `json:"base,omitempty"`
	Mergeable  string                         `json:"mergeable,omitempty"`
	Checks     map[string]int                 `json:"checks,omitempty"`
	Failed     []string                       `json:"failed_checks,omitempty"`
	Failures   []githubchecks.CIFailureDetail `json:"failures,omitempty"`
	Blocked    []string                       `json:"unsatisfied_required_checks,omitempty"`
	Reason     string                         `json:"reason,omitempty"`
	URL        string                         `json:"url,omitempty"`
}

func ObservePullRequest

func ObservePullRequest(ctx context.Context, reference Reference) Target

ObservePullRequest reads one pull request and the checks on its exact head. It delegates to prsnapshot.Observe — one shared implementation of both facts, reused by the herdr-session-transport daemon watcher (internal/prwatch) rather than a second dialect of the same GitHub reads — and adapts the result onto Target so `wb wait pr`'s own behavior is unchanged by the move (see reader_test.go).

type Update

type Update struct {
	Observations, Settled, Total int
	Interval                     time.Duration
}

Jump to

Keyboard shortcuts

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