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
- Variables
- func Open(ctx context.Context, path string) (*respond.Recorder, func() error, error)
- func Server(configured []comms.ID, named string) (comms.ID, error)
- type ClarifyItem
- type ClarifyQueue
- func (q *ClarifyQueue) Exclude(ctx context.Context, id int64) error
- func (q *ClarifyQueue) Next(ctx context.Context) (ClarifyItem, bool, error)
- func (q *ClarifyQueue) Record(ctx context.Context, id int64, v ClarifyVerdict) error
- func (q *ClarifyQueue) Skip(id int64)
- func (q *ClarifyQueue) Status(ctx context.Context) (ClarifyTally, error)
- type ClarifyTally
- type ClarifyVerdict
- type Item
- type Queue
- type Tally
- type Verdict
Constants ¶
const ( // ReasonOneMeant means one reading was plainly meant. ReasonOneMeant = "one_meant" // ReasonOfferMissed means the offer missed the reading that was meant. ReasonOfferMissed = "offer_missed" )
Why asking back was wrong (spec 0031 D11).
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 ErrClarifyReason = errors.NewSentinel("review.clarify_reason",
"review: asking back judged wrong needs a reason, and judged right needs none")
ErrClarifyReason is returned for a clarify verdict whose reason does not fit it: "no" takes one of the reasons, and "yes" takes none (spec 0031 D11).
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 ClarifyItem ¶ added in v0.15.0
type ClarifyItem struct {
AnswerID int64
// Question is the question asked back, empty with QuestionExpired set
// once its retention has passed.
Question string
QuestionExpired bool
Body string
Evidence *respond.ClarifyEvidence
// Replied reports that a later record answers the same question, which
// is what a reply from the asker produces.
Replied bool
Posted bool
RecordedAt time.Time
}
ClarifyItem is one clarifying question as the reviewer sees it.
type ClarifyQueue ¶ added in v0.15.0
type ClarifyQueue struct {
// contains filtered or unexported fields
}
ClarifyQueue walks one server's clarifying questions (spec 0031 D11). Its verdicts are kept apart from Queue's, so none reaches the thirty.
func NewClarify ¶ added in v0.15.0
func NewClarify(rec *respond.Recorder, space comms.ID) *ClarifyQueue
NewClarify returns the clarify queue for one server.
func (*ClarifyQueue) Exclude ¶ added in v0.15.0
func (q *ClarifyQueue) Exclude(ctx context.Context, id int64) error
Exclude marks a clarification as not counting, for a replayed benchmark or calibration question. It is never offered again.
func (*ClarifyQueue) Next ¶ added in v0.15.0
func (q *ClarifyQueue) Next(ctx context.Context) (ClarifyItem, bool, error)
Next returns the oldest clarification waiting for a verdict and not skipped in this run, or false when none is.
func (*ClarifyQueue) Record ¶ added in v0.15.0
func (q *ClarifyQueue) Record(ctx context.Context, id int64, v ClarifyVerdict) error
Record stores a verdict, replacing any earlier one.
func (*ClarifyQueue) Skip ¶ added in v0.15.0
func (q *ClarifyQueue) Skip(id int64)
Skip holds a clarification back for the rest of this run.
func (*ClarifyQueue) Status ¶ added in v0.15.0
func (q *ClarifyQueue) Status(ctx context.Context) (ClarifyTally, error)
Status is the clarify queue's tally.
type ClarifyTally ¶ added in v0.15.0
ClarifyTally is what `review status` reports of the clarify queue, apart from the thirty.
func (ClarifyTally) String ¶ added in v0.15.0
func (t ClarifyTally) String() string
type ClarifyVerdict ¶ added in v0.15.0
ClarifyVerdict is whether asking back was right, and if not, why.
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.