retro

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 15 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 retro computes the weekly retrospective docs/project/THEORY.md calls its instrument: one table, read from the mirror plus local.db, definitions printed under the numbers every time. Nine rows: sessions, resume (median), wip age p85, wip age max, in progress, closed, cycle p50, cycle p85, mismatch. Columns are ISO weeks (Monday 00:00 local, oldest left, the current partial week last) and a change column against the previous week. Everything is a read: the mirror, the status_catalog lookup, and local.visits; nothing here writes or touches a network. Statuses are keyed by id through status_catalog and by status_category — never by the display name beside them.

Degradation is a dash, never an error: an empty status_catalog blanks the weeks only the changelog can answer, an unparseable timestamp drops one row, and a workspace with no self identity resolves resume against any author on the issues the session visited (the footer says so).

Every count carries the issue keys behind it (Bucket.ClosedKeys and friends), so a number is never a dead end: the CLI opens a cell's keys in the running app and the server serves the same document. Key slices are collected in lockstep with each count increment — a count is the length of its slice by construction, mismatch included, where two matching comments on one issue leave the key twice.

Index

Constants

View Source
const (
	SurpriseReopened        = "reopened"
	SurpriseReversal        = "reversal"
	SurpriseAddedAfterStart = "added_after_start"
	SurpriseCarried         = "carried"
)

Surprise kinds, the closed vocabulary Surprise.Kind uses.

View Source
const (
	MinSessionGap = 5 * time.Minute
	MaxSessionGap = 24 * time.Hour
)

MinSessionGap and MaxSessionGap bound the --session-gap parameter. Below five minutes a session is every coffee refill; above a day the split has stopped meaning anything weekly. Both bounds are named in ParseSessionGap's error so a rejected value says which wall it hit.

View Source
const MaxEvents = 300

MaxEvents caps one bucket's event list. A bucket is a week or a sprint of one team; past a few hundred rows the list has stopped being a thing a person reads and the reader wants the table above it instead.

View Source
const MaxJSONKeys = 500

MaxJSONKeys caps each key array of the JSON document. It matches internal/jql MaxKeys, the ceiling a keys view may open, so a cell that fits the document also fits the app.

View Source
const SessionGap = store.SessionGap

SessionGap splits person reads into sessions: a counted visit more than this after the previous one starts a new session. Exactly the gap is still the same session — strictly greater, so a test can sit on the line. It re-exports store.SessionGap, the single owner of the 30-minute value since GDK-1439 (local.sessions rows are chained at it, and the server's session strip — internal/server/read.go — reads that table through store.LastSessionEnd). This name stays exported because retro's own walk and Options.SessionGap still need the default; Compute is free to be told a different one, and that custom-gap walk deliberately re-bins visits rather than reading the chained-at-30m table.

Variables

View Source
var DoneWords = []string{
	"done", "fixed", "merged", "resolved", "shipped",
	"완료", "해결", "머지", "반영", "배포",
	"完了", "修正済み", "対応済み",
	"已完成", "已解决", "已修复",
}

DoneWords is the mismatch heuristic: a comment containing one of these on an issue that is not done now. A heuristic, not a parser — the row says so in its definition, and the words cover the languages this workspace writes (English, Korean, Japanese, Chinese).

Matching is HasDoneWord's job, not a plain Contains: an English word must stand on its own (2026-09-06 — "abandoned" contains "done", "unresolved" contains "resolved"), and a CJK word must not be carrying a negation prefix ("미완료" contains "완료", "未完了" contains "完了"). Both classes pointed the signal backwards, at exactly the comments saying the work is NOT finished.

View Source
var ErrNoSprints = errors.New("retro: this workspace has no sprints — --by sprint needs a board with sprints (Jira Software, Linear cycles, or the built-in tracker)")

ErrNoSprints says this mirror has no sprint to cut by. The caller turns it into its own surface's refusal — a CLI line, an HTTP 409 — rather than an empty table, which would read as "your team did nothing".

View Source
var OpenMetrics = []string{"closed", "in-progress", "sprint-done", "sprint-in-progress",
	"mismatch", "cycle",
	"aging", "unplanned", "surprises", "seen-not-moved", "moved-not-seen"}

OpenMetrics are the --open values, in help order. Each names a cell of the table by its row.

The last five name the material lists under the table rather than a cell of it (materials.go). `aging` is the one that is not per bucket — it is measured at now — so a week does not apply to it and saying so is better than quietly ignoring it.

`sprint-done` and `sprint-in-progress` answer only on the sprint cut, whose columns have members (membership.go); a week cut has no sprint cell to open, and the keys come back empty rather than the name being rejected — the same way a bucket without surprises answers `surprises`.

View Source
var ReportMetrics = []string{"aging"}

ReportMetrics are the OpenMetrics answered by the report rather than by one bucket.

Functions

func ClaimStands

func ClaimStands(commentAt time.Time, commentOK bool, statusChangedAt string) bool

ClaimStands reports whether a done-word comment is a live claim: it is newer than the issue's last status change. A comment that predates the change was answered by it — the structure moved after the prose — and is not a mismatch now. No recorded status change means nothing answered the claim, so it stands; a comment with no usable stamp cannot be shown to be newer, so it does not.

The web mirror of this signal (web/src/lib/done-words.ts) implements the same truth table; keep the two in lockstep.

func DoneWordMatch added in v0.23.0

func DoneWordMatch(body string) (string, bool)

DoneWordMatch reports the first done word that fires in body (GDK-1943): the word a counted mismatch actually matched, for the surfaces that show it — the JSON document's mismatch_comments array carries it per counted comment, so "which sentence, and what fired on it" is answerable from the product instead of a throwaway probe. Same rule as HasDoneWord; empty and false when nothing fires.

func FormatDays added in v0.22.0

func FormatDays(v float64) string

FormatDays prints a day-valued metric the way both surfaces show it.

Days alone swallow anything faster than a day: a team that closes work in four hours read a cycle time of "0.0d", which says "no data" to every reader (GDK-1683, measured on the demo fixture where seven of eight cells were 0.0d). The ladder steps down the same way FormatSeconds does — a value under a day prints in hours, under an hour in minutes — so the number survives. JSON is unchanged: it carries days, rounded by roundDays, and this is the one place that turns a day count into a cell.

func FormatSeconds

func FormatSeconds(secs float64) string

FormatSeconds is the resume cell: 4m 10s / 1h 02m / 45s. Exported for the surfaces that render the same document (the CLI test checks its table against JSON with it).

func HasDoneWord

func HasDoneWord(body string) bool

HasDoneWord reports whether a comment claims the work is finished.

It is a guarded match, not a substring test. Plain containment read every negation as its opposite — measured on the shipped rule, "미완료", "완료되지 않음", "未完了", "not fixed", "unresolved", "unmerged", "abandoned" and "is this done?" all came back true, and each of those is a comment saying the work is NOT done. The guards, in the order they run:

  • a question is not a claim: a body whose last sentence ends in "?" or "?" is rejected outright;
  • quoted lines (Markdown "> ") and fenced code blocks are stripped — quoting someone else's "done" is not saying it;
  • an English word must stand alone (word boundaries), so "abandoned" and "unresolved" no longer carry "done" and "resolved";
  • a CJK word must not carry a negation prefix (미 未 불 非 无 無) or be followed by a negation ("되지 않", "ではない").

The result is a candidate, never a fact (THEORY.md T5). It is precise enough for an affordance that costs one dismissal when wrong; a count shown to a steward needs more than this.

func IsOpenMetric added in v0.22.0

func IsOpenMetric(m string) bool

IsOpenMetric reports whether m names a cell this package can answer.

func JoinOpenMetrics added in v0.22.0

func JoinOpenMetrics() string

JoinOpenMetrics is the value list an "unknown metric" message prints.

func KeysFor added in v0.22.0

func KeysFor(b Bucket, metric string) []string

KeysFor is the key set behind one cell of one bucket.

func Max

func Max(vals []float64) (float64, bool)

Max is the largest value, for wip age max beside wip age p85 — the tail the percentile smooths over.

func OriginSuppliesChangelog added in v0.22.0

func OriginSuppliesChangelog(origin string) bool

OriginSuppliesChangelog says whether an origin gives the mirror a state history, which is the only thing that makes a reopen count meaningful.

`reopen_count`, `reopened_at` and `reopen_reason` are derived from the changelog, so on an origin that supplies none they are not zero — they are unknown, and the two mean opposite things to a reader. "Reopened 0" on a Linear workspace reads as "this team has no regressions" when the honest answer is that nobody can tell (GDK-1690).

The judgement is the origin's capability, never the count: 0 and "cannot be counted" are indistinguishable from the number alone. docs/SUPPORT_MATRIX.md is the single owner of the column — the history row ([^14] Jira, [^120] Jira Server, [^15] Linear, [^16] built-in) — and this function is that row in code. A cell that moves there moves here, and TestOriginChangelogMatchesSupportMatrix fails if the two disagree.

func P85

func P85(vals []float64) (float64, bool)

P85 is the nearest-rank 85th percentile. Integer rank arithmetic ((85n+99)/100) on purpose: 85*20/100 in floats lands on 17.000000000000004 and a ceil rounds a hair high.

func ParseSessionGap

func ParseSessionGap(s string) (time.Duration, error)

ParseSessionGap accepts a Go duration (30m, 1h30m, 90m) between MinSessionGap and MaxSessionGap, naming both bounds in every rejection — the same posture as ParseSince: a usage error the caller wraps, never a silent default.

func ParseSince

func ParseSince(s string) (time.Duration, error)

ParseSince accepts <N>d or <N>w, 1..365 days equivalent. Anything else is a usage error (the caller wraps it), never a silent default.

func ReportKeysFor added in v0.22.0

func ReportKeysFor(rep Report, metric string) ([]string, bool)

ReportKeysFor is the key set behind a report-level metric: aging is measured at now, not inside a bucket, so it has no week. The bool is false for every metric that is per bucket.

Types

type Action added in v0.22.0

type Action struct {
	Key            string   `json:"key"`
	Summary        string   `json:"summary"`
	StatusCategory string   `json:"status_category"`
	CreatedAt      string   `json:"created_at"`
	ResolvedAt     *string  `json:"resolved_at"`
	Metric         string   `json:"metric"`
	Then           *float64 `json:"then"`
	Now            *float64 `json:"now"`
}

Action is one issue labelled retro-action: something a past retrospective decided to do. Metric/Then/Now are the honest part — an action that names a metric is measured against it, and one that does not says so with an empty name rather than a number nobody can check.

type Aging added in v0.22.0

type Aging struct {
	P85            *float64    `json:"p85_days"`
	Items          []AgingItem `json:"items"`
	ItemsTruncated bool        `json:"items_truncated,omitempty"`
}

Aging is the whole in-progress tail, oldest first, with the percentile the table's "wip age p85" row shows. It is report-level, not per bucket: the question "what is old" is asked of now, not of a window that has closed.

type AgingItem added in v0.22.0

type AgingItem struct {
	Key         string  `json:"key"`
	Days        float64 `json:"days"`
	Summary     string  `json:"summary"`
	IssueTypeID string  `json:"issue_type_id"`
}

AgingItem is one in-progress issue and how long it has been there.

type BoardRef added in v0.22.0

type BoardRef struct {
	ID   int64
	Name string
}

BoardRef is one board that could answer --by sprint.

type Bucket

type Bucket struct {
	From    time.Time
	To      time.Time
	Partial bool
	// Name is what the column is called when the buckets are not weeks —
	// the sprint's name under --by sprint (GDK-1693). Empty for weeks, and
	// Label() falls back to the date range then.
	Name string

	Sessions int
	Resume   *float64 // median seconds to the first own write
	ResumeK  int      // sessions in this bucket that had a write
	ResumeN  int      // sessions in this bucket
	WipP85   *float64 // days, nearest-rank 85th percentile
	WipMax   *float64 // days, the oldest in-progress issue at week end
	InProg   *int
	Closed   *int
	CycleP50 *float64 // days, median cycle of the week's closures
	CycleP85 *float64 // days, nearest-rank 85th percentile of the same
	Mismatch int

	// The sprint membership rows (membership.go): what is in this
	// sprint now, as opposed to what happened inside its window. Nil on week
	// columns, where the rows do not exist.
	SprintDone   *int
	SprintInProg *int

	// The issue keys behind the counts, sorted by key, one entry per
	// counted item (mismatch: per counted comment), so each count is the
	// length of its slice. CycleKeys has no count field of its own: its
	// length is the week's sample size, and CycleP50/CycleP85 exist exactly
	// when it is non-empty.
	ClosedKeys     []string
	InProgressKeys []string
	MismatchKeys   []string
	CycleKeys      []string

	// MismatchComments names each counted mismatch comment — which issue,
	// which word fired, when (GDK-1943) — in lockstep with MismatchKeys, so
	// the count is the length of this slice too. No bodies: a comment can
	// quote private text, and key+word+stamp is enough to find the row.
	MismatchComments []MismatchComment

	// SprintDoneKeys and SprintInProgKeys are the members behind the two
	// membership rows, same rule as the slices above: one entry per counted
	// issue, sorted, so each count is the length of its slice (membership.go).
	SprintDoneKeys   []string
	SprintInProgKeys []string

	// SprintID is the sprint this bucket is, under --by-sprint. Zero for
	// week columns, and the two sprint-only surprises (added_after_start,
	// carried) need it to tell this sprint's arrivals from any other's.
	SprintID int64

	// The materials: what happened in the bucket, rather than how much.
	// Every one of them is computed by materials.go from the samples above.
	Events          []Event
	EventsTruncated bool
	Surprises       []Surprise
	ClosedByType    []TypeCount
	ClosedByEpic    []EpicCount
	Unplanned       KeyCount
	CyclePoints     []CyclePoint
	SeenNotMoved    KeySet
	MovedNotSeen    KeySet
	// contains filtered or unexported fields
}

Bucket is one ISO week column: From is Monday 00:00 local; the last bucket runs to now and is partial. The metric fields are per bucket: pointers are nil where the answer does not exist (no data for it), which the table prints as a dash and JSON emits as null.

func Buckets

func Buckets(now time.Time, since time.Duration) []Bucket

Buckets lays the weeks from the Monday of the first week since reaches up to now. At least one bucket comes back: an empty span (now exactly on a Monday midnight) still gets the single partial week.

func SprintBuckets added in v0.22.0

func SprintBuckets(ctx context.Context, db *sql.DB, now time.Time, boardID int64) ([]Bucket, error)

SprintBuckets lays one bucket per sprint of one board, oldest first.

A sprint's window is its own start_at..end_at, which is what makes the column mean "that sprint" rather than "the fortnight around it". The one sprint that is still running is the partial bucket: its end is in the future, and every metric here is measured at the bucket's end, so reading it to end_at would report a week that has not happened. Sprints with no start are skipped — a future sprint nobody has scheduled has no window — and so is anything starting after now.

func (Bucket) Label

func (b Bucket) Label() string

Label is the bucket's column title and the name --open reports: 08-24..08-31, or 08-31..now for the current partial week. A named bucket (a sprint) says its name instead — a column headed "Sprint 42" is the whole point of cutting by sprint.

type BucketJSON

type BucketJSON struct {
	From string `json:"from"`
	To   string `json:"to"`
	// Name is the column's own title when the buckets are not weeks — the
	// sprint's name (GDK-1693). Absent for weeks, where the dates are the
	// title and the renderer formats them in the reader's locale.
	Name       string     `json:"name,omitempty"`
	Partial    bool       `json:"partial"`
	Sessions   int        `json:"sessions"`
	Resume     *float64   `json:"resume (median)"`
	WipP85     *float64   `json:"wip age p85"`
	WipMax     *float64   `json:"wip age max"`
	InProgress *int       `json:"in progress"`
	Closed     *int       `json:"closed"`
	CycleP50   *float64   `json:"cycle p50"`
	CycleP85   *float64   `json:"cycle p85"`
	Mismatch   int        `json:"mismatch"`
	Keys       BucketKeys `json:"keys"`

	// The sprint membership rows, flat like the counts they sit
	// beside in the table. Absent on the week cut, where the rows do not
	// exist — omitempty keeps a week bucket byte-identical to what it was.
	SprintDone       *int     `json:"sprint_done,omitempty"`
	SprintInProg     *int     `json:"sprint_in_progress,omitempty"`
	SprintDoneKeys   []string `json:"sprint_done_keys,omitempty"`
	SprintInProgKeys []string `json:"sprint_in_progress_keys,omitempty"`

	// The sentence behind each mismatch entry (GDK-1943): key, the word
	// that fired, the stamp. Present, empty rather than null, and capped
	// beside the key array it explains.
	MismatchComments []MismatchComment `json:"mismatch_comments"`

	// The materials (materials.go): what happened in the bucket. Every
	// array is present, empty rather than null, so a renderer can iterate
	// without a nil check.
	Events          []Event      `json:"events"`
	EventsTruncated bool         `json:"events_truncated,omitempty"`
	Surprises       []Surprise   `json:"surprises"`
	ClosedByType    []TypeCount  `json:"closed_by_type"`
	ClosedByEpic    []EpicCount  `json:"closed_by_epic"`
	Unplanned       KeyCount     `json:"unplanned"`
	CyclePoints     []CyclePoint `json:"cycle_points"`
	SeenNotMoved    KeySet       `json:"seen_not_moved"`
	MovedNotSeen    KeySet       `json:"moved_not_seen"`
}

BucketJSON is one element of buckets. The keys are the table row names verbatim, so a consumer reads the same words the footer defines.

type BucketKeys

type BucketKeys struct {
	Closed        []string `json:"closed"`
	InProgress    []string `json:"in progress"`
	Mismatch      []string `json:"mismatch"`
	Cycle         []string `json:"cycle"`
	KeysTruncated bool     `json:"keys_truncated,omitempty"`
}

BucketKeys is the keys object of one JSON bucket: the issue keys behind each count, capped at MaxJSONKeys per array with KeysTruncated set when any array was cut.

type CyclePoint added in v0.22.0

type CyclePoint struct {
	Key        string  `json:"key"`
	Summary    string  `json:"summary"`
	ResolvedAt string  `json:"resolved_at"`
	Days       float64 `json:"days"`
}

CyclePoint is one sample behind the cycle p50/p85 cells: the row that lets a reader see the distribution instead of two percentiles of it.

type Doc

type Doc struct {
	Buckets     []BucketJSON      `json:"buckets"`
	Definitions map[string]string `json:"definitions"`
	// Notes is Definitions' empty-cell half, kept as an ordered array: a
	// map cannot say which entries are reasons rather than metric
	// definitions, and the renderer needs exactly that (GDK-1679). Each
	// entry is the name and the sentence, the same pair the CLI footer
	// prints. Empty when nothing is missing.
	Notes []DocNote `json:"notes"`
	// BucketNoun is what one column is — "week", or "sprint" under
	// --by-sprint. A surface that writes its own definitions needs it for
	// the same reason SessionGap is here (GDK-1693).
	BucketNoun string `json:"bucket_noun"`
	// SessionGap is the split gap the report ran with, trimmed the way the
	// footer prints it ("30m", "1h30m"). The definitions strings are English
	// and stay that way — they are the CLI's footer — but a surface that
	// writes its own translated definitions still needs this one value, and
	// hardcoding "30m" into a translation is wrong the moment someone passes
	// --session-gap (GDK-1692).
	SessionGap string `json:"session_gap"`
	// Aging is the in-progress tail measured at now and Actions the
	// retro-action issues — report-level, not per bucket (materials.go).
	Aging   Aging    `json:"aging"`
	Actions []Action `json:"actions"`
	// ReopenUnavailable says the origin supplies no changelog, so the reopen
	// surfaces cannot be counted here (GDK-1690). A surface hides them or says
	// it cannot count; showing 0 would read as "this team has no regressions"
	// when the truth is that nobody can tell. The reason sentence is in Notes
	// under "reopened".
	ReopenUnavailable bool `json:"reopen_unavailable"`
}

Doc is the JSON document: buckets plus the same definitions strings the footer prints.

type DocNote added in v0.22.0

type DocNote struct {
	Name string `json:"name"`
	Text string `json:"text"`
}

DocNote is one entry of Doc.Notes.

type EpicCount added in v0.22.0

type EpicCount struct {
	EpicKey string   `json:"epic_key"`
	Title   string   `json:"title"`
	Count   int      `json:"count"`
	Keys    []string `json:"keys"`
}

EpicCount is one row of closed_by_epic. EpicKey "" is the issues under no epic; the surface names that row in the reader's language, not this file.

type ErrAmbiguousBoard added in v0.22.0

type ErrAmbiguousBoard struct {
	Boards []BoardRef
}

ErrAmbiguousBoard says several boards carry sprints and none was named. Sprint windows from two boards overlap, so a merged column set would be neither team's cadence; the caller must pick one.

func (*ErrAmbiguousBoard) Error added in v0.22.0

func (e *ErrAmbiguousBoard) Error() string

type Event added in v0.22.0

type Event struct {
	At     string `json:"at"`
	Key    string `json:"key"`
	Kind   string `json:"kind"`
	Detail string `json:"detail"`
}

Event is one thing that happened inside a bucket, in the bucket's own order. Kind is the vocabulary the renderer switches on; Detail is the one extra string that kind carries (a comment's author, a sprint's name).

type KeyCount added in v0.22.0

type KeyCount struct {
	Count int      `json:"count"`
	Keys  []string `json:"keys"`
}

KeyCount is a count that carries its keys — the shape every number in this package takes, so a number is never a dead end.

type KeySet added in v0.22.0

type KeySet struct {
	Keys []string `json:"keys"`
}

KeySet is a key list whose length is the whole answer.

type MismatchComment added in v0.23.0

type MismatchComment struct {
	Key  string `json:"key"`
	Word string `json:"word"`
	At   string `json:"at"`
}

MismatchComment is one entry of Bucket.MismatchComments: the issue key, the done word that fired on it, and the comment's stamp. It names the sentence a counted mismatch rests on without carrying its body (GDK-1943).

type Options

type Options struct {
	SessionGap time.Duration
	// BySprint cuts the report by sprint window instead of by ISO week
	// (GDK-1693). A scrum team retrospects on its sprint, and 0.22 put the
	// sprint boundaries in the mirror, so the columns can be the thing the
	// team actually meets about. Every metric below is computed from a
	// [From, To) span and none of them assumes seven days, so this changes
	// the bucket source and nothing else.
	BySprint bool
	// BoardID picks the board whose sprints are the buckets. Zero means the
	// only sprint-bearing board; with more than one, SprintBuckets refuses
	// and names them rather than guessing whose cadence the reader meant.
	BoardID int64
	// Actor is the resolved actor slug (config.ResolveActor) — the identity a
	// write carries on the built-in tracker, where issuetap stamps the slug
	// onto the comment/changelog author_id. Empty everywhere else; see
	// selfMatch for why the credential alone was not enough (GDK-1427).
	Actor string
	// Origin is the workspace's origin type (config.OriginType). It decides
	// whether the reopen surfaces can be shown at all — see
	// OriginSuppliesChangelog. Empty reads as "assume it does", which is what
	// every caller that has no config sees and is the pre-GDK-1690 behaviour.
	Origin string
}

Options is the tunable half of Compute; the zero value is every default. SessionGap zero or negative means the SessionGap constant (30m).

type Report

type Report struct {
	Buckets      []Bucket
	CLIFallback  bool // no ui/unknown visits; sessions came from cli rows
	SelfResolved bool // a FeedIdentity or an actor slug was available for resume
	// SelfBasis names the identifier the resume row matched on, so the footer
	// can say which one decided instead of leaving the reader to guess
	// (GDK-1427). Empty when nothing resolved.
	SelfBasis string
	// ReopenUnavailable is set when the origin supplies no changelog, so the
	// reopen surfaces cannot be counted at all. A surface hides them or says
	// it cannot count; it never prints 0 (GDK-1690).
	ReopenUnavailable bool

	CatalogEmpty bool // status_catalog has no rows

	// SessionGap is the effective split gap Compute ran with. Definitions
	// prints it; zero or negative (a hand-built Report) renders the default.
	SessionGap time.Duration
	// CycleUnavailable marks a mirror whose schema predates cycle_hours
	// (user_version < 43): every cycle cell is a dash and the footer says
	// how to fix it, in the same shape as CatalogEmpty.
	CycleUnavailable bool
	// BySprint says the columns are sprints, not ISO weeks (GDK-1693). It
	// reaches the definitions, which name the bucket in nearly every
	// sentence — "at week end", "during the week" — and would otherwise
	// describe a unit the table is not using.
	BySprint bool

	// Aging is the whole in-progress tail measured at now, and Actions the
	// retro-action issues: both report-level, because neither question is
	// asked of a window that has closed (materials.go).
	Aging   Aging
	Actions []Action
	// VisitsEmpty says no issue reads were recorded in the window, which is
	// why seen_not_moved and moved_not_seen are empty everywhere. Notes
	// carries the sentence.
	VisitsEmpty bool
	// contains filtered or unexported fields
}

Report is everything the table and the JSON document render.

func Compute

func Compute(ctx context.Context, db *sql.DB, me store.FeedIdentity, since time.Duration, now time.Time, opts Options) (Report, error)

Compute reads the mirror plus local.visits and fills the buckets. db is a handle on the mirror with local.db attached (store.OpenReadOnly gives the CLI one; the server opens its own the same way). opts carries the tunables; the zero Options is the shipped default (SessionGap constant). Each table walks in its own loader below the function — one defer rows.Close() and one rows.Err() per walk, not three close sites on every error branch (GDK-1575).

func (Report) BucketNoun added in v0.22.0

func (r Report) BucketNoun() string

BucketNoun is what one column is, in the definitions' own words.

func (Report) Definitions

func (r Report) Definitions() [][2]string

Definitions is the footer under every table (and the definitions object of JSON): a metric name and the sentence that fixes what it counts. Branch lines (which visits fed sessions, whether self resolved, the empty-catalog note) are rows with their own names so both surfaces print the same strings.

func (Report) JSON

func (r Report) JSON() Doc

func (Report) Notes added in v0.22.0

func (r Report) Notes() [][2]string

Notes is the subset of Definitions that explains why cells are empty rather than what a metric counts (GDK-1679). Definitions carries them too, so the CLI footer is unchanged — but a surface that renders one definition per metric row has nowhere to put a line whose name is not a row, and the web dropped both of these on the floor: a table of dashes with the reason already computed and already in the payload. This is the list a reader needs beside the table, in the order the report decides them.

func (Report) Sections added in v0.22.0

func (r Report) Sections(explain bool) string

Sections is the text under the table: the three material sections, and then the one-line summary. explain adds the paragraph under each heading.

func (Report) Summary added in v0.22.0

func (r Report) Summary() string

Summary is the last line of every run: one sentence about the last bucket, the thing a reader repeats out loud. Clauses that have nothing to say are left out rather than printed as zeros — "reopened 0" is noise, and a sentence made only of zeros would say the bucket was empty when it was merely quiet.

func (Report) Table

func (r Report) Table() string

Table renders the text output: header row, the metric rows, then the definitions footer — every time, in every invocation.

type Surprise added in v0.22.0

type Surprise struct {
	Kind string `json:"kind"`
	Key  string `json:"key"`
	// Summary is the issue's title, carried beside the key so the surface can
	// name the work instead of listing identifiers (GDK-1737). Empty when the
	// mirror has no title for that item, which is the honest answer.
	Summary string `json:"summary"`
	Detail  string `json:"detail"`
}

Surprise is an event the plan did not have: work that came back, work that churned, work that arrived after the sprint had started, work that was carried in. Detail carries the reason where the mirror has one — a reopen reason, a carry count, an arrival time — because a surprise without its reason is an accusation.

type TypeCount added in v0.22.0

type TypeCount struct {
	IssueTypeID string   `json:"issue_type_id"`
	IssueType   string   `json:"issue_type"`
	Count       int      `json:"count"`
	Keys        []string `json:"keys"`
}

TypeCount is one row of closed_by_type: what the bucket's closures were made of, by issue type id (never by the display name beside it).

Jump to

Keyboard shortcuts

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