Documentation
¶
Overview ¶
Package run records runs and what a harness reports on them in the engine's store: a run of the team's harness on one planned change, its result, its state, and the outcomes, asks, calls and findings the harness reports. Each write is one command in one transaction with its one event. Run records live only in the store and never enter the map.
Index ¶
- Constants
- Variables
- type AskIn
- type AskRecord
- type CallIn
- type CallRecord
- type CreateIn
- type Detail
- type FindingIn
- type FindingRecord
- type OutcomeIn
- type OutcomeRecord
- type Report
- func Ask(ctx context.Context, s work.Submitter, in AskIn) (Report, error)
- func Call(ctx context.Context, s work.Submitter, in CallIn) (Report, error)
- func Finding(ctx context.Context, s work.Submitter, in FindingIn) (Report, error)
- func Outcome(ctx context.Context, s work.Submitter, in OutcomeIn) (Report, error)
- type ResultIn
- type Run
- type StateIn
Constants ¶
const ( StateWorking = "working" StateBlocked = "blocked" StateDone = "done" StateError = "error" )
The states a harness reports. Only error ends the run; done and blocked are reports. Whether a run is over is its end time, never its state.
const ( KindOutcome = "outcome" KindAsk = "ask" KindCall = "call" KindFinding = "finding" )
The kinds of report a harness makes on a run.
const SaidByHarness = "harness"
SaidByHarness is who said a finding: the harness, never Physa.
const TailMax = 4096
TailMax is how many bytes of a harness's stderr a run keeps: its end.
Variables ¶
var ( ErrUnknownRun = errors.New("unknown run") ErrUnknownChange = errors.New("unknown change") ErrBadLevel = errors.New("bad level") ErrBadCommit = errors.New("bad commit") ErrBadState = errors.New("bad state") ErrBadVerdict = errors.New("bad verdict") ErrBadItem = errors.New("bad item") ErrNoVouch = errors.New("no vouched-by") ErrMissing = errors.New("missing field") ErrEnded = errors.New("run ended") ErrBadReason = errors.New("reason without an error") )
The kinds of Refusal this package adds to work's. Each is a *work.Refusal, so the API replies bad_request with its message.
Functions ¶
This section is empty.
Types ¶
type CallRecord ¶
CallRecord is a stored call.
type Detail ¶
type Detail struct {
Run
Outcomes []OutcomeRecord
Asks []AskRecord
Calls []CallRecord
Findings []FindingRecord
}
Detail is a run and every report on it, oldest first.
type FindingRecord ¶
FindingRecord is a stored finding; SaidBy is always "harness".
type OutcomeIn ¶
OutcomeIn is the harness's verdict on one acceptance item, by its place in the change's list from 1, for an exact commit, and who vouched for it.
type OutcomeRecord ¶
type OutcomeRecord struct {
ID int64
Item int
Verdict, Commit, VouchedBy string
Stale bool
At time.Time
}
OutcomeRecord is a stored outcome. Stale is worked out on read, never stored: the run has a result and its commit is not this outcome's.
type Report ¶
Report is one report stored on a run. Stale is set on an outcome whose commit is not the run's latest result's; SaidBy is "harness" on a finding.
func Finding ¶
Finding stores what a harness's check said, as the harness's word, with event run.finding.
type ResultIn ¶
ResultIn is where a run's work ended up: its branch, the full sha of its latest commit and its pull request. The first ends the run; a later one replaces it.
type Run ¶
type Run struct {
ID int64
Pursuit, Change string
PlanRevision, Level int
State, Branch, Commit, PR, EndReason, StderrTail string
Started, Ended time.Time
}
Run is a run's record. PlanRevision is the plan's revision it was created from. Branch, Commit and PR are empty before a result, EndReason is an error's reason, and the run is over exactly when Ended is not zero.
func Create ¶
Create starts a run on the pursuit's planned change in state working, with event run.created. It records the plan's current revision, read in the same transaction. An unknown pursuit, a change not in its plan and a level outside 0 to 3 are refused.
func Result ¶
Result stores where the run's work ended up, with event run.result, and ends the run. A later result replaces the earlier one and keeps the end time. A result for a run that ended in error is refused: a retry is a new run.