evidence

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 5 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 evidence turns what version control and the forge show into evidence facts: a change landing, a change reverted, a merged PR's lead time and its CI result. Facts are observed, never reported and never judged: they carry no weight, and the package holds no store, so what to keep and how to count it is for the caller. Rework is not observed here: reading it from history is a guess, and a fact is never a guess (design 05 section 6.5).

Index

Constants

View Source
const (
	KindLanded             = "landed"
	KindReverted           = "reverted"
	KindLeadTime           = "lead_time"
	KindCIPassed           = "ci_passed"
	KindCIFailed           = "ci_failed"
	KindCIPassedAfterFails = "ci_passed_after_failing"
)

The kinds of Fact.

View Source
const (
	SourceVCS   = "vcs"
	SourceForge = "forge"
)

The sources of a Fact.

Variables

This section is empty.

Functions

func Observe

func Observe(repo Repo, forge Merged, w Watermark, now time.Time) (facts []Fact, next Watermark, forgeErr error, err error)

Observe reads the changes landed since w and, when forge is not nil, the PRs merged since it, and returns their facts oldest first with the watermark to start the next look from. A forge that fails gives forgeErr, with the version-control facts still returned and the forge's watermark unmoved; a failure of version control is err. A repo with no default branch has no changes and is no error.

Types

type Fact

type Fact struct {
	Kind       string    `json:"kind"`
	Commit     string    `json:"commit,omitempty"`
	PR         int       `json:"pr,omitempty"`
	Capability string    `json:"capability,omitempty"`
	Pursuit    string    `json:"pursuit,omitempty"`
	Change     string    `json:"change,omitempty"` // the plan change's name
	Idea       string    `json:"idea,omitempty"`
	At         time.Time `json:"at"`
	Source     string    `json:"source"`
	Seconds    *int64    `json:"seconds,omitempty"` // lead time only
	ByCommit   string    `json:"by_commit,omitempty"`
}

Fact is one observation. The idea is never set here: it needs the store.

type Merged

type Merged = forge.Merged

Merged is the part of a forge that observing reads: the PRs merged since a time.

type Repo

type Repo interface {
	DefaultBranch() (string, error)
	Changes(rng string) ([]vcs.Change, error)
	Since(ref string, t time.Time) ([]vcs.Change, error)
	Reverts(c vcs.Change) (string, bool)
	Resolve(ref string) (string, bool)
	IsAncestor(a, b string) bool
	Latest(ref string, n int) ([]vcs.Change, error)
}

Repo is the smallest part of vcs.Repo that observing reads.

type Watermark

type Watermark struct {
	Commit string    `json:"commit,omitempty"`
	Time   time.Time `json:"time,omitzero"`
	Forge  time.Time `json:"forge,omitzero"`
}

Watermark is how far observing has got: the default branch's head and its time, and the newest merged-at the forge showed. The zero Watermark is a first look.

Jump to

Keyboard shortcuts

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