stats

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 11 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 stats rolls the human gate up across runs: what the agent filed, what was published, what the human rejected and what the agent cut itself, counted the way the published loupe-meta marker counts them.

Index

Constants

View Source
const (
	StateCaptured  = "captured"
	StateReady     = "ready"
	StatePublished = "published"
)
View Source
const (
	GroupNone  = "none"
	GroupRepo  = "repo"
	GroupWeek  = "week"
	GroupMonth = "month"
)

Variables

States is every state in the order a filter echoes them.

Functions

func State

func State(r Run) string

State is the one loupe list gives the run.

func Time

func Time(r Run) time.Time

Time is when the run was published, or captured when it is not.

Types

type Blocking

type Blocking struct {
	Published int `json:"published"`
	Excluded  int `json:"excluded"`
}

type ByLabel

type ByLabel struct {
	Published LabelCounts `json:"published"`
	Excluded  LabelCounts `json:"excluded"`
}

type Duration

type Duration time.Duration

Duration is an ISO 8601 duration in whole seconds, in hours, minutes and seconds only, since a day there is a calendar day rather than 24 hours.

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (Duration) String

func (d Duration) String() string

type Filter

type Filter struct {
	// Repos are owner/repo, matched ignoring case; none matches every repository.
	Repos []string
	// Since and Until are inclusive bounds on a run's time; nil leaves that side open.
	Since, Until *time.Time
	States       []string
	GroupBy      string
}

type Findings

type Findings struct {
	Filed      int `json:"filed"`
	Published  int `json:"published"`
	Excluded   int `json:"excluded"`
	Withdrawn  int `json:"withdrawn"`
	Pending    int `json:"pending"`
	Reinstated int `json:"reinstated"`
	Regraded   int `json:"regraded"`
}

Findings splits Filed into Published, Excluded, Withdrawn and Pending. Reinstated and Regraded are flags that can overlap any of them.

type Gate

type Gate struct {
	Published, Gated int
}

Gate is precision's dividend and divisor: published, and published plus excluded, over attended published runs.

type Group

type Group struct {
	Key          string   `json:"key"`
	Runs         Runs     `json:"runs"`
	PullRequests int      `json:"pullRequests"`
	Findings     Findings `json:"findings"`
	ByLabel      ByLabel  `json:"byLabel"`
	Blocking     Blocking `json:"blocking"`
	// Precision and MedianCaptureToPublish are over attended published runs only, nil when there is nothing to divide.
	Precision              *float64  `json:"precision"`
	Drifted                []string  `json:"drifted"`
	MedianCaptureToPublish *Duration `json:"medianCaptureToPublish"`
	// Gate stays out of the JSON, which carries only the ratio; the human output prints it beside precision.
	Gate Gate `json:"-"`
}

type LabelCounts

type LabelCounts struct {
	Issue      int `json:"issue"`
	Suggestion int `json:"suggestion"`
	Question   int `json:"question"`
	Other      int `json:"other"`
}

type Result

type Result struct {
	Groups []Group `json:"groups"`
	Total  Group   `json:"total"`
}

func Compute

func Compute(runs []Run, f Filter) Result

type Run

type Run struct {
	Ref     run.Ref
	Target  run.Target
	Draft   *draft.Draft
	Receipt *publish.Receipt
}

Run is one round as its files hold it. Receipt is nil when the round is not published.

type Runs

type Runs struct {
	Captured  int `json:"captured"`
	Ready     int `json:"ready"`
	Published int `json:"published"`
	// Unattended is a subset of Published.
	Unattended int `json:"unattended"`
}

Jump to

Keyboard shortcuts

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