history

package
v0.67.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 23 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 history is the brief plan and judge read before choosing or ruling on an approach: the tasks whose commits touched a set of files, what the ledger recorded about each, and the lore anchored there. Every number is a lookup; nothing here asks a model.

Index

Constants

View Source
const MaxLines = 15

MaxLines caps the text form: a brief that grows makes planning worse.

View Source
const MinSample = 3

MinSample is the fewest live neighbors a statistic is printed for: under it the neighbors are listed and no median or rate is given.

View Source
const NoHistory = "No history for these files."

NoHistory is the whole text of an empty brief, which a plan copies so a reader tells "checked, nothing" from "not checked".

View Source
const StandingFloor = 30

StandingFloor is the share of a task's added lines that must still stand at HEAD for its history to apply; below it the task is stale.

Variables

This section is empty.

Functions

func PlanKind

func PlanKind(plansDir, task string) string

PlanKind is the Kind: line of task's plan in plansDir, else of its newest archived plan; a plan with none is a feature, and no plan is "".

func ReadLedger

func ReadLedger(ctx context.Context, path, project string, tasks []string) ([]ledger.Event, error)

ReadLedger is every ledger row Build needs: the sessions of tasks, by the scoped read, and the project's regression_found rows, whose task is the bug rather than a neighbor. Both reads are indexed, so neither grows with the rest of the ledger.

func TaskFacts

func TaskFacts(events []ledger.Event, tasks []string, since time.Time) map[string]*Facts

TaskFacts folds the events into each task's facts, keyed by the upper-cased id: the newest verdict per finding and per verdict file standing, and the regressions found since traced to the task. Every task gets an entry.

func TrailerTask

func TrailerTask(trailers string) string

TrailerTask is the task raw trailer text names, as regression.TrailerTask reads it.

Types

type Aggregates

type Aggregates struct {
	N            int         `json:"n"` // the reviewed neighbors
	MedianRounds float64     `json:"median_rounds"`
	Recurring    []Recurring `json:"recurring"`
	Regressions  int         `json:"regressions"`
}

Aggregates are the statistics over the reviewed neighbors, those the ledger holds a review round for, once there are MinSample of them: older work predates the ledger, and counting it would dilute every rate.

type Brief

type Brief struct {
	Paths       []string     `json:"paths"`
	Since       time.Time    `json:"since"`
	Neighbors   []Neighbor   `json:"neighbors"`
	Stale       []Touch      `json:"stale"`
	Regressions []Regression `json:"regressions"`
	Aggregates  *Aggregates  `json:"aggregates"`
	Decisions   []Note       `json:"decisions"`
	Lessons     []Note       `json:"lessons"`
}

Brief is everything the command prints, the text form a capped view of it.

func Build

func Build(in Input) *Brief

Build is the brief. Counts and outcomes come from the ledger alone and reasons from lore alone, so a finding written to both counts once.

func (*Brief) Empty

func (b *Brief) Empty() bool

Empty reports a brief with nothing to say.

func (*Brief) Lines

func (b *Brief) Lines() []string

Lines is the text form, most decision-relevant first: the neighbors by id, regressions, the statistics, decisions, lessons, then a line per neighbor. Lines past MaxLines drop from the bottom, and every line cites a task or a lore id.

func (*Brief) Write

func (b *Brief) Write(w io.Writer) error

Write prints the text form.

type Count

type Count struct {
	Raised  int `json:"raised"`
	Fixed   int `json:"fixed"`
	Skipped int `json:"skipped"`
}

Count is a finding category in one task: raised as each round opened counted it, fixed and skipped as resolve's verdicts recorded them. Raised is the reliable one, because a verdict row carries its category only when the findings file wrote one beside it.

type Facts

type Facts struct {
	Lines            *int             `json:"lines,omitempty"`
	ImplementMinutes *float64         `json:"implement_minutes,omitempty"`
	Rounds           int              `json:"rounds"`
	Categories       map[string]Count `json:"categories,omitempty"`
	Superseded       int              `json:"plans_superseded"`
	Halts            int              `json:"halts"`
	HaltReasons      []string         `json:"halt_reasons,omitempty"` // one per halt, "" where none was given
	Verdicts         []string         `json:"judge_verdicts,omitempty"`
	// Regressions are the bug tasks traced to this one, Classes their
	// review-miss classes in the same order
	Regressions []string `json:"regressions,omitempty"`
	Classes     []string `json:"-"`
}

Facts is what the ledger recorded about one task; a nil pointer was never recorded. The history brief, the audit's pain map and any later reader count from this one fold, so a round or a fix counts the same everywhere.

type Found

type Found struct {
	*ledger.RegressionFoundPayload

	Bug string
}

Found is a bug's newest attribution.

type Input

type Input struct {
	Paths     []string
	Since     time.Time
	Touches   []Touch
	Events    []ledger.Event
	Lessons   []lore.Entry
	Decisions []lore.Entry
	Kinds     map[string]string
}

Input is what Build reads: the touches git found, the ledger rows of their sessions with every regression_found row of the project, the lore on the paths, and each task's plan kind.

type Neighbor

type Neighbor struct {
	Touch
	Facts

	Kind string `json:"kind,omitempty"`
}

Neighbor is a live task's touch and what the ledger recorded about it.

type Note

type Note struct {
	ID       string          `json:"id"`
	Change   string          `json:"change"`
	Path     string          `json:"path"`
	Anchors  []string        `json:"anchors"` // on the paths, as `f10 lore add --anchor` takes them
	Text     string          `json:"text"`
	Chosen   string          `json:"chosen,omitempty"`
	Rejected []lore.Rejected `json:"rejected,omitempty"`
}

Note is a lore lesson or decision on one of the paths.

type Recurring

type Recurring struct {
	Category string   `json:"category"`
	Tasks    []string `json:"tasks"`
}

Recurring is a finding category raised in at least half the reviewed neighbors.

type Regression

type Regression struct {
	Bug    string `json:"bug"`
	Origin string `json:"origin"` // the origin task, else pre-f10 or outside-f10
	Class  string `json:"class,omitempty"`
}

Regression is a bug traced to these files or to a neighbor.

type Series

type Series map[string]string // round: the reviewed sha of its latest opening

Series ties a task's review rows to the PR they reviewed: a follow-up PR's rounds restart at 1, so a round is its number with the reviewed sha of its latest opening, and a verdict belongs to that latest opening. Every reader of review rows keys them through it, so none merges two PRs.

func (Series) Of

func (s Series) Of(round string) string

Of is the key of the round a verdict on round belongs to.

func (Series) Opened

func (s Series) Opened(round, reviewed string) string

Opened records a round's opening and returns the round's key.

type Touch

type Touch struct {
	Task     string   `json:"task"`
	Commits  []string `json:"commits"`
	Added    int      `json:"added"`
	Standing int      `json:"standing"`
}

Touch is one task's work on the files: its commits, the lines they added there, and how many of those lines blame still gives it at HEAD.

func Neighbors

func Neighbors(ctx context.Context, dir, prefix string, paths []string, since time.Time, skip string) ([]Touch, error)

Neighbors is the tasks whose commits since touched paths at HEAD, oldest first, skip left out. One git log reads every commit's trailers and line counts; only a commit with no Task: or Change: trailer costs more git.

func (Touch) Stale

func (t Touch) Stale() bool

Stale reports a task whose lines were mostly rewritten since. A task that only deleted lines has nothing to measure, so it stays.

Jump to

Keyboard shortcuts

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