Documentation
¶
Overview ¶
Package review records a person's verdict on the answers the bot composed in shadow mode, which is what stands between shadow mode and posting (spec 0010 D12, spec 0023).
It reads the answers pkg/respond records and owns only the verdicts. Deciding that the answers are worth posting is left to the person reading the tally: nothing here lifts shadow mode (0023 D7).
Index ¶
Constants ¶
const Target = 30
Target is how many reviewed answers to real questions 0010 D12 asks for before shadow mode can be lifted (R-ANS-18).
Variables ¶
var ( // ErrNotReviewable is returned for an answer that cannot take a verdict: // posted, over budget, expired, or not there at all (0023 D3). ErrNotReviewable = errors.NewSentinel("review.not_reviewable", "review: not a reviewable shadow answer") // ErrCitationsUnjudged is returned when an answer with citations is given // no verdict on them (0023 D5). ErrCitationsUnjudged = errors.NewSentinel("review.citations_unjudged", "review: the answer's citations need a verdict") // ErrNoCitations is returned for a citation verdict on an answer that has // none to judge (0023 D5). ErrNoCitations = errors.NewSentinel("review.no_citations", "review: the answer has no citations to judge") )
var ErrServerRequired = errors.NewSentinel("review.server_required",
"review: more than one server is configured; name one with --server")
ErrServerRequired is returned when several servers are configured and the reviewer did not name one (spec 0029 D4).
var ErrUnknownServer = errors.NewSentinel("review.unknown_server", "review: that server is not configured")
ErrUnknownServer is returned for a --server that is not configured.
Functions ¶
func Open ¶
Open opens the database at path, the one serve records into (0023 D2), and returns a recorder over it with the function that closes it.
Types ¶
type Item ¶
type Item struct {
AnswerID int64
// Question is the question as stored, redacted. Empty, with QuestionExpired
// set, once the question's retention has passed.
Question string
QuestionExpired bool
Posture respond.Posture
Title string
Body string
Cited []answer.Citation
RecordedAt time.Time
// Posted reports whether the answer reached the channel, rather than
// being composed in shadow mode (0025 D8).
Posted bool
}
Item is one answer as the reviewer sees it (0023 D4).
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue walks the reviewable answers, oldest first.
Each Next reads the database afresh rather than a list taken at the start, so an answer serve records mid-review joins the end (0023 D9). Skips live on the Queue and nowhere else: a new run offers them again.
func (*Queue) Exclude ¶
Exclude marks an answer as not counting, for a replayed benchmark or calibration question (0023 D5). It is never offered again.
func (*Queue) Next ¶
Next returns the oldest reviewable answer not skipped in this run, or false when none is waiting.
type Tally ¶
type Tally struct {
Target int
Reviewed int
Answers int
Declines int
Posted int
Correct int
CitationsJudged int
CitationsApt int
Excluded int
Waiting int
// Readers' 👍 and 👎 across every answer, and how many answers have any
// (spec 0027 D8). Totals only, so no vote sits beside a verdict.
Helpful int
NotHelpful int
Voted int
}
Tally is what `review status` reports (0023 D7). Reviewed excludes excluded answers, and Answers and Declines split it.