Documentation
¶
Overview ¶
Package learnbranch writes one learning run to the physa/learn branch (design 08 section 6): it rebuilds the branch on the default branch in an isolated working copy, applies the run's kept proposals there and commits them with the record of what was learned (the Learned-through watermark and the Learned ids). It pushes the branch with a lease, redoing the write once without a second agent session when someone else moved it, and opens or refreshes its one PR. It never touches the person's own working copy, index or checked-out branch, and never merges: stewards accept, edit or drop what the PR holds.
Index ¶
Constants ¶
const ( PRNotAsked = "" // the run did not ask for a PR PRNone = "none" // nothing to open or refresh PROpened = "opened" // a PR was opened PRRefreshed = "refreshed" // the open PR's body was rebuilt PRReady = "ready" // no forge to open one; the branch is ready )
The states of PR.
const Branch = "physa/learn"
Branch is the branch learning writes to.
Variables ¶
This section is empty.
Functions ¶
func Read ¶
Read reads the map in dir and what the history r holds teaches it, with lo and its Capabilities taken from the map. It writes nothing.
Types ¶
type Flags ¶
type Flags struct {
Signals bool
Since string
JSON bool
Write bool // commit the kept proposals to physa/learn
Push bool // push physa/learn; needs Write
PR bool // open or refresh the PR; needs Push
Appetite int64 // most tokens a draft session may use; zero is the default
Agent string // agent to draft with; empty is the default
// contains filtered or unexported fields
}
Flags is a physa map learn command line as its declared flags read it.
type Options ¶
type Options struct {
// Push pushes the branch to the default branch's remote, with a lease.
Push bool
// PR opens or refreshes the branch's PR; it needs Push.
PR bool
// Since is the change the run starts after; empty means after the
// watermark (learn.Options.Since).
Since string
// Records are the slice records; RecordsReason, when not empty, says why
// they could not be read.
Records []store.SliceRecord
RecordsReason string
// Session says how the run drafts and checks proposals.
Session propose.Session
// Sessions reads the session logs that join changes to their sessions;
// nil means none.
Sessions learn.Sessions
// Forge is the forge to read each change's PR from; nil means none, and
// ForgeReason says why.
Forge forge.Forge
ForgeReason string
// PRs opens and refreshes the branch's PR; nil means no forge to do it.
PRs forge.PRs
}
Options say what one run reads and how far it goes. The map's capabilities are read from the working copy the run writes in.
type Outcome ¶
type Outcome struct {
// Report is what the run drafted and checked; its Kept are the proposals
// applied to the branch and its Dropped every other one, with its reason.
Report propose.Report
// Result is the run's triage. After a redo its Through and LearnedNow are
// the ones recorded.
Result learn.Result
// Commit is the change written to the branch; nil when nothing was.
Commit *Commit
// Pushed reports whether the branch was pushed.
Pushed bool
// Redone reports whether the write was redone after the lease was lost,
// and Superseded how many applied proposals that dropped.
Redone bool
Superseded int
// PR is what happened to the branch's PR.
PR PR
}
Outcome is what one run did.
func Run ¶
Run writes one learning run to the branch with w: it refuses a branch checked out in any working copy, rebuilds the branch on the default branch in a working copy under the store, drafts from the copy's map, applies what is kept, commits when there is anything to record, and then pushes and opens or refreshes the PR as o asks. A session the circuit breaker stopped writes nothing and is no error (the Report's Session is SessionStopped). The Outcome holds what was done even when it returns an error.