problem

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 6 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 problem is the one account of what is wrong with a finding, an Integration or a backfill request, for every place a person reads it: the status page (a finding's note under its header and its findings list, the configuration and repositories views) and `patchy describe`.

A finding records what goes wrong in separate places, each with its own writer and lifetime. internal/failure derives why a Failed or HandedOff finding stopped from its phase log, so it is never stale; status.forgeErrors holds the forge requests that keep failing, which their controllers retry with backoff or stop until a human retry. Those stay separate in the API, because they are different things: history on one side, retry state on the other. Of turns both into one list of Problems with the same shape and the same wording, so readers do not each re-derive titles, hints and states.

The same shape covers the work that runs where there is no Finding to record onto. OfIntegration reports an Integration's redelivery sweep and demo reset, and OfBackfill a backfill request's walk. Those record their forge failures as v1alpha1.ForgeErrorSummary entries (one per operation and reason, with a count and a few sample object names), which become skipped problems: patchy gave up on those objects and finished the rest.

Rate-limit holds are not problems: they are pacing patchy chose, and they lift by themselves.

Index

Constants

View Source
const (
	// StageTracking is the tracking issue and alert write-back.
	StageTracking failure.Stage = "tracking"
	// StageDelivery is receiving webhook deliveries: the redelivery sweep.
	StageDelivery failure.Stage = "delivery"
	// StageBackfill is a backfill walk.
	StageBackfill failure.Stage = "backfill"
	// StageReset is the demo reset.
	StageReset failure.Stage = "reset"
)

The stages beside the pipeline stages internal/failure names.

Variables

This section is empty.

Functions

func Blocked

func Blocked(ps []Problem) bool

Blocked reports whether any of ps waits for a human retry.

Types

type Kind

type Kind string

Kind says where a problem comes from.

const (
	// KindFailure: the finding stopped (internal/failure).
	KindFailure Kind = "failure"
	// KindForge: a forge request keeps failing (status.forgeErrors), or
	// failed for a set of objects (a ForgeErrorSummary).
	KindForge Kind = "forge"
	// KindError: a step failed, and all patchy kept is its message (a
	// redelivery sweep, a backfill walk).
	KindError Kind = "error"
)

The kinds of problem.

type Problem

type Problem struct {
	Kind  Kind
	State State
	// Stage is the part of the pipeline it belongs to: repository,
	// tracking, investigation, remediation or review on a finding; delivery,
	// backfill or reset on an Integration or a BackfillRequest.
	Stage failure.Stage
	// Operation is the forge operation that fails (v1alpha1.ForgeOp*);
	// empty for a failure.
	Operation string
	// Title says what went wrong in one line: "Couldn't push the fix: a
	// ruleset or branch protection rejected it", "Remediation failed on
	// attempt 2".
	Title string
	// Code is the machine reason: a forge reason (RuleViolation) or a run
	// outcome code (commit_failed, no_repository).
	Code string
	// Message is the detail in the forge's or the run's own words.
	Message string
	// Hint says what a person can do about it.
	Hint string
	// Run names the failed Investigation or Remediation child, if any.
	Run string
	// Attempts is how many times a forge request has failed in a row.
	Attempts int32
	// Since is when a forge request first failed.
	Since *metav1.Time
	// RetryAt is when patchy retries a forge request by itself.
	RetryAt *metav1.Time
	// StalledAt is when patchy stopped retrying a blocked forge request; a
	// retry requested after it resumes the request.
	StalledAt *metav1.Time
	// Count is how many objects' requests failed, for a problem that covers
	// many (a ForgeErrorSummary); zero otherwise.
	Count int32
	// Objects names some of them ("acme/api", "acme/api#12"), at most
	// v1alpha1.MaxForgeErrorSamples.
	Objects []string
}

Problem is one thing wrong with a finding, an Integration or a backfill.

func Of

func Of(f *v1alpha1.Finding) []Problem

Of lists what is wrong with f: why it stopped, then each forge request that is blocked, then each that patchy is still retrying. Nil when nothing is.

func OfBackfill

func OfBackfill(b *v1alpha1.BackfillRequest) []Problem

OfBackfill lists what is wrong with a backfill request: why its walk failed or is being retried, or the last alert that would not ingest, then the repositories it skipped. Nil when nothing is.

func OfIntegration

func OfIntegration(integ *v1alpha1.Integration) []Problem

OfIntegration lists what is wrong with an Integration's own work: the redelivery sweep failing, a demo reset retrying, or what the last reset left behind. Nil when nothing is. Its backfills are reported per BackfillRequest (OfBackfill).

func Summaries

func Summaries(list []v1alpha1.ForgeErrorSummary, stage failure.Stage) []Problem

Summaries turns tallies of failed objects (v1alpha1.ForgeErrorSummary) into problems in stage, one per entry. Patchy does not retry those objects by itself, so each is skipped work: the rest of the walk or the reset went ahead.

type State

type State string

State says what happens next.

const (
	// StateRetrying: patchy retries by itself, with backoff.
	StateRetrying State = "retrying"
	// StateBlocked: patchy stopped retrying a step; the finding keeps its
	// phase until someone fixes the cause and uses Retry.
	StateBlocked State = "blocked"
	// StateStopped: the work itself stopped (a Failed or HandedOff finding,
	// a Failed backfill), and needs a person: a retry, a recheck, a new
	// request, or a decision.
	StateStopped State = "stopped"
	// StateSkipped: patchy gave up on some objects and finished the rest:
	// the repositories a backfill could not list, the issues a demo reset
	// could not remove. Count and Objects say which.
	StateSkipped State = "skipped"
)

The states a problem can be in.

Jump to

Keyboard shortcuts

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