outcome

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package outcome implements the passive loop: for each applied pin that has fired at least once, it checks whether the pin's mistake recurred after agents started seeing it. Everything is recomputed on every call from the firing log, the finding table, and mined history; nothing is stored.

Index

Constants

View Source
const MinExposureActivity = 5

MinExposureActivity is the minimum number of post-exposure commits in the pin's regions before a "working" claim is allowed. Below it the verdict is untested: nothing touched the region, so the absence of the mistake proves nothing.

Variables

This section is empty.

Functions

func Gather

func Gather(st *store.Store, cfg *reviews.Config, applied []model.Proposal,
	firings []reviews.Firing,
) (map[int64]Reading, error)

Gather computes a Reading for every applied proposal whose pin is still present in lessons.yaml and cites at least one finding. The result is keyed by proposal id; proposals that cannot be measured (pruned pin, no citations) are absent, and callers print nothing for them.

Types

type Reading

type Reading struct {
	ProposalID  int64
	Exposed     bool      // at least one firing under the pin's current identity
	First       time.Time // exposure start: the first firing; zero when !Exposed
	Firings     int       // delivered firing records naming the pin
	Matches     int       // delivered plus suppressed records naming the pin
	PreEvents   int       // mistake events before exposure (the pin's evidence)
	PreCommits  int       // commits in the pin's regions before exposure
	PostEvents  int       // mistake events since exposure — the recurrence count
	PostCommits int       // commits in the pin's regions since exposure
	Verdict     Verdict
	Reason      Reason // set when Verdict is untested
}

Reading is the derived exposure and verdict for a single proposal.

func (Reading) Line

func (r Reading) Line() string

Line renders the verdict sentence. All surfaces (ledger, --stats, HTML report) print this one string, so they never phrase the same reading differently. The output is fixed words and numbers only, so callers do not need to sanitize it.

type Reason

type Reason int

Reason says why a verdict is untested, so Line() can name the missing evidence in the rendered sentence.

const (
	// ReasonMeasured means all checks passed; the verdict is working or not landing.
	ReasonMeasured Reason = iota
	// ReasonNeverFired means there is no firing under the pin's current identity.
	ReasonNeverFired
	// ReasonLowActivity means fewer than MinExposureActivity region-commits exist since exposure.
	ReasonLowActivity
	// ReasonStaleEvidence means findings were not mined since exposure.
	ReasonStaleEvidence
	// ReasonDeadCitations means all cited findings aged out of the mining window.
	ReasonDeadCitations
)

type Verdict

type Verdict int

Verdict is the derived outcome for a single applied pin.

const (
	// VerdictUntested means there is not enough evidence to judge the pin. See
	// Reason for which evidence is missing.
	VerdictUntested Verdict = iota
	// VerdictWorking means the pin fired, the region saw enough commits,
	// and the mistake did not recur. Validation only — not a signal
	// to remove the pin.
	VerdictWorking
	// VerdictNotLanding means the pin fired and the mistake recurred
	// anyway. The one verdict that calls for action.
	VerdictNotLanding
)

func (Verdict) String

func (v Verdict) String() string

Jump to

Keyboard shortcuts

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