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
- func PlanKind(plansDir, task string) string
- func ReadLedger(ctx context.Context, path, project string, tasks []string) ([]ledger.Event, error)
- func TaskFacts(events []ledger.Event, tasks []string, since time.Time) map[string]*Facts
- func TrailerTask(trailers string) string
- type Aggregates
- type Brief
- type Count
- type Facts
- type Found
- type Input
- type Neighbor
- type Note
- type Recurring
- type Regression
- type Series
- type Touch
Constants ¶
const MaxLines = 15
MaxLines caps the text form: a brief that grows makes planning worse.
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.
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".
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 ¶
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 ¶
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 ¶
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 ¶
TrailerTask is a bundle's lead from Task:, else the id a Change: names.
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 ¶
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.
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 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 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 ¶
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.
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.