Documentation
¶
Overview ¶
Package reviews reads the committed review folders under .abcd/work/reviews/ and says how stale each has become (itd-28, spc-2609211854150455).
Two kinds of folder live there. A dated review, `<YYYY-MM-DD>-<scope>/`, is a commissioned review whose `00-summary.md` names the commit it read in its frontmatter (`review_of_commit: <full sha>`); a review of a spec carries the spec's id in its scope, `<YYYY-MM-DD>-<spc-N>-<slug>/`. A semantic-gate receipt directory, `<40-hex>/<gate>.json`, is keyed by the commit it gates, so its name is its pin. The package reads both and counts, per pin, the commits the default branch has moved since; it writes nothing.
The pin's one reading is Pin. The reviews-charter gate (scripts/check-reviews.sh, RD004) refuses a dated folder whose summary Pin would not read, so the board and the gate agree about every folder.
Index ¶
Constants ¶
const ( KindReview = "review" KindReceipt = "receipt" )
Kind names the two folder classes the tree holds.
const ( // StatePinned: the pin names a commit this repository holds, and the // count is the commits the default branch has moved since. StatePinned = "pinned" // StateUnreachable: the pin names no commit this repository can count // from (a rewritten or squashed-away sha), so the age is unknown. StateUnreachable = "unreachable" // StateUnpinned: the folder names no commit at all — a review that // predates the pin rule. StateUnpinned = "unpinned" )
State says whether a folder's staleness could be counted.
const Dir = ".abcd/work/reviews"
Dir is the committed reviews tree, repo-relative and slash-separated.
const StaleAfter = 20
StaleAfter is the threshold the board flags past: a review whose pin the default branch has moved more than this many commits beyond is marked for a re-run (itd-28 decision 2).
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Board ¶
type Board struct {
Threshold int `json:"threshold"`
// DefaultRef is the branch the counts are taken against, as a person
// names it; HEAD when no default branch resolves.
DefaultRef string `json:"default_ref"`
Rows []Row `json:"rows"`
}
Board is the reviews block of the status board.
func Staleness ¶
Staleness reads the tree and counts each pin's age against the default branch (gitutil.DefaultRef, or HEAD where none resolves), one `git rev-list --count <pin>..<ref>` per pinned folder. Rows come stalest first: counted rows by descending count, then the unreachable, then the unpinned, each run by folder name.
func (Board) StaleCount ¶
StaleCount is the number of rows flagged for a re-run.
type Entry ¶
type Entry struct {
Folder string `json:"folder"`
Kind string `json:"kind"`
// Scope is what the folder reviewed: the dated folder's name after its
// date, or a receipt directory's gates, comma-separated.
Scope string `json:"scope"`
// Spec is the spec id the dated folder's name carries, if any.
Spec string `json:"spec,omitempty"`
// ReviewOfCommit is the pin: the summary's frontmatter key, or the
// receipt directory's own name. Empty when the folder names none.
ReviewOfCommit string `json:"review_of_commit,omitempty"`
}
Entry is one review folder as the tree holds it, before any git is asked.
type Row ¶
type Row struct {
Entry
State string `json:"state"`
// CommitsSince is the number of commits the default branch holds that
// the pin does not; absent when the state is not pinned.
CommitsSince *int `json:"commits_since"`
// Stale is true when CommitsSince is past the threshold.
Stale bool `json:"stale"`
}
Row is one folder on the board, with its age.