Documentation
¶
Overview ¶
Package analysis is the analysis framework: one contract every way of answering a question about a model implements, one scale for the strength of an answer, a registry of engines and the dispatch that turns a question into the engines that answer it.
A Question names a subject, what is asked of it and what is left free. An Engine covers a set of questions and answers one with a Result whose Strength says how the claim is supported. A Registry holds the engines a binary knows, and Registry.Answer dispatches a question under `auto`: the strongest covering engine answers, a not-covered result advances to the next, and the Plan records every engine consulted.
The engines here — run, explore, sweep and solve — are adapters over the interpreter, runtime.Explore, Context.RunSweep and internal/exec/solve.
Index ¶
- Constants
- Variables
- func ClockStepOf(ctx *runtime.Context) float64
- func Compose(results []Result) (Result, []Disagreement)
- func Consistent(claim Claim, strength Strength) error
- func DeclaringScope(sym *symbols.Symbol, root *symbols.Scope) *symbols.Scope
- func DefaultJobs() int
- func DistributionLines(table sweep.SweepTable, text func(*runtime.Context, runtime.Value) string) []string
- func DrawnMean(d *runtime.Distribution) semantics.Value
- func DrawsOf(ctx *runtime.Context) runtime.DrawPolicy
- func Explores(selection Selection, schedule runtime.SchedulePolicy) (runtime.SchedulePolicy, bool)
- func JobsFromEnv() (int, error)
- func Lines(listings []Listing) []string
- func Observe(ctx *runtime.Context, outcome runtime.Outcome, observables []string) []runtime.CalcOutputValue
- func OutputColumns(table sweep.SweepTable) []string
- func OutputLimitFromEnv() int
- func ParseJobs(source, text string) (int, error)
- func ProcessDetail(path string, err error, stderr []byte) string
- func ProgressText(p enginewire.ProgressParams) string
- func RenderReply(reply map[string]runtime.ToolValue) string
- func SensitivityFile(subject, performer, feature, label string) string
- func ToolEngineName(tool string) string
- func ToolEnvNames() ([]string, error)
- func ToolReplyOf(tool string, stdout []byte) (map[string]runtime.ToolValue, error)
- func ToolRequestOf(call *runtime.ToolCall) ([]byte, error)
- func ToolTimeoutFromEnv() time.Duration
- func Unobserved(table sweep.SweepTable, observables []string) error
- func ValidationReason(report runtime.ValidationReport) string
- func ViolationFile(subject, performer string, n int) string
- func WithReporter(ctx context.Context, report Reporter) context.Context
- func WithUnit(x semantics.Value, unit string) string
- func WitnessLine(w *Witness) string
- func WriteWitness(path, text string) (err error)
- type Answer
- func CaseAnswer(result runtime.AnalysisResult, err error) Answer
- func CheckAnswer(result runtime.CheckResult, err error) Answer
- func ValidationAnswer(report runtime.ValidationReport, err error) Answer
- func ValuesAnswer(values []Evaluation, err error) Answer
- func VerificationAnswer(result runtime.VerificationResult, err error) Answer
- type Asking
- type Bound
- type BoundedBuffer
- type Bounds
- type Budget
- type CheckAsk
- type CheckConditions
- type CheckStatus
- type Checked
- type Claim
- type Column
- type ComputeAsk
- type ConditionCheck
- type ConstructError
- type CountedText
- type Coverage
- type Description
- type Disagreement
- type DomainError
- type DryRun
- type DryRunFile
- type DryRunner
- type DuplicateEngineError
- type Engine
- type EngineEntry
- type EngineExitedError
- type EngineFaultError
- type EngineRefusalError
- type EngineTimeoutError
- type EngineWithheldError
- type EntryKind
- type Evaluation
- type External
- type Freedom
- type FreedomError
- type HandshakeError
- type HoldsAsk
- type InconsistentResultError
- type Input
- type InputError
- type InputFile
- type InputFormat
- type InputNotFreeError
- type Invocation
- type JobsError
- type Kind
- type Linearization
- type Listing
- type MalformedQuestionError
- type Manifest
- type ManifestError
- type Manifested
- type Mode
- type Model
- type ModelForm
- type ModelSeed
- type NoEngineError
- type NoReplayError
- type NoRuntimeError
- type NotAToolEntryError
- type NotAskedError
- type NotExternalError
- type NotServedError
- type ObservableSummary
- type Origin
- type OverclaimError
- type Performance
- type Plan
- func (p Plan) Refusals() []error
- func (p Plan) Refused() error
- func (p Plan) Results() []Result
- func (p Plan) Standing() string
- func (p Plan) ToolMark() int
- func (p Plan) ToolTexts() []string
- func (p Plan) ToolTextsIn(ctx *runtime.Context) []string
- func (p Plan) ToolTextsInBefore(ctx *runtime.Context, mark int) []string
- type PreviewUndecidedError
- type Prober
- type ProcessAbsentError
- type ProgressReport
- type ProtocolError
- type Question
- type RefusedError
- type Registry
- func (r *Registry) Answer(ctx context.Context, model *Model, q Question, budget Budget) (Plan, error)
- func (r *Registry) AnswerWith(ctx context.Context, model *Model, q Question, budget Budget, ...) (Plan, error)
- func (r *Registry) Check(ctx context.Context, req Request, kind Kind, free Freedom, check *CheckAsk, ...) (Plan, error)
- func (r *Registry) DryRunner(selection Selection) *DryRunner
- func (r *Registry) Engines() []Engine
- func (r *Registry) Explore(ctx context.Context, req Request, run Linearization) (Plan, error)
- func (r *Registry) External() []Manifested
- func (r *Registry) Listings() []Listing
- func (r *Registry) Names() []string
- func (r *Registry) Probed() []Listing
- func (r *Registry) Prove(ctx context.Context, req Request, queries []*solve.Query) (Plan, error)
- func (r *Registry) Register(e Engine) error
- func (r *Registry) Select(text string) (Selection, error)
- func (r *Registry) Serving(names []string) (*Registry, error)
- func (r *Registry) Solve(ctx context.Context, req Request, queries []*solve.Query, ask Asking) (Plan, error)
- func (r *Registry) Statuses() []Status
- func (r *Registry) Sweep(ctx context.Context, req Request, plan sweep.SweepPlan, row sweep.SweepRun) (Plan, error)
- func (r *Registry) ToolRunner(ctx context.Context, held *runtime.Context, budget Budget, selection Selection) runtime.ToolRunner
- type Reply
- type ReplyFormat
- type ReplyOutput
- type Reporter
- type Request
- type Result
- type Row
- type RowKind
- type Selection
- type SessionEndedError
- type SolveAsk
- type Start
- type Status
- type StdinFormat
- type StdinSpec
- type Step
- type Strength
- type SubjectError
- type SweepAsk
- type ToolAbsentError
- type ToolDryRunError
- type ToolEntry
- type ToolUse
- type ToolVariableError
- type UnansweredRunError
- type UnknownEngineError
- type ValueType
- type WireValueError
- type Withheld
- type Witness
- type WitnessKind
- type Worker
- type WrongToolError
Constants ¶
const ( DefaultCheckDepth = 10000 DefaultCheckStates = 1000000 )
The bounds a check searches under when the budget leaves them 0: the moves one schedule may make and the distinct states the search may visit.
const CheckEngineName = "check"
CheckEngineName is the name of the engine that searches an action's schedules explicitly.
const ClockObservable = "clock"
ClockObservable names the observable every run of a Monte Carlo reports without being asked: the clock reading the run completed at.
const DefaultOutputLimit = 64 << 20
DefaultOutputLimit is the bound when OutputLimitEnv is unset or unusable.
const DefaultToolTimeout = solve.DefaultTimeout
DefaultToolTimeout is how long a tool is given to answer one invocation before the performance fails with a timeout: the solver's default.
const DefaultUnroll = 4
DefaultUnroll is how many iterations of a body loop a symbolic engine unrolls when Budget.Unroll is zero.
const EnginesEnv = "OPENSYSML_ENGINES"
EnginesEnv names the environment variable holding the engine manifest: a directory with one JSON entry per external engine or strategy. Either directory may hold any kind.
const ExploreEngineName = "explore"
ExploreEngineName is the name of the engine that runs every linearization.
const JobMemoryBudget = 512 << 20
JobMemoryBudget is the memory the default jobs reserve per worker: one per CPU, fewer when the memory available to the process would leave a worker less than this.
const JobsEnvVar = "OPENSYSML_JOBS"
JobsEnvVar names the variable setting how many runs of one plan go concurrently.
const ManifestExt = ".json"
ManifestExt is the extension of a manifest entry; other files in the directory are ignored.
const OutputLimitEnv = "OPENSYSML_TOOL_MAX_OUTPUT"
OutputLimitEnv names the environment variable bounding what one external process may write: one reply or one protocol line on standard output, and the whole of standard error, for tools and engines alike. Bytes, or bytes with a `K`, `M` or `G` suffix.
const ProgressInterval = 250 * time.Millisecond
ProgressInterval is the least time between two reports of one run: an engine that sends a notification per state costs the pipe, not the report.
const RunEngineName = "run"
RunEngineName is the name of the engine that runs the interpreter once.
const SMTEngineName = "smt"
SMTEngineName is the name of the symbolic engine over an SMT solver, which lives in package smt and joins the build's registry through package engines.
const ServeAll = "all"
ServeAll is the spelling that serves every manifest engine.
const SolveEngineName = "solve"
SolveEngineName is the name of the engine that puts conditions to an SMT solver.
const SolveProcess = "an SMT solver: the one " + solve.SolverEnv + " names, else z3 or cvc5 on PATH"
SolveProcess is what the solve engine needs, as its description names it.
const SweepEngineName = "sweep"
SweepEngineName is the name of the engine that runs a domain row by row.
const ToolEnginePrefix = "tool:"
ToolEnginePrefix starts the name of every tool engine: `tool:ModelCenter`.
const ToolEnvPassthroughEnv = "OPENSYSML_TOOL_ENV_PASSTHROUGH" // #nosec G101 -- a variable name, not a credential
ToolEnvPassthroughEnv lists, comma-separated, the variables of this process a tool with an invocation block is started with besides PATH, HOME, TMPDIR and LANG.
const ToolKeepEnv = "OPENSYSML_TOOL_KEEP"
ToolKeepEnv, set to 1, keeps every invocation's temporary directory instead of removing it once the reply is read.
const ToolTimeoutEnv = "OPENSYSML_TOOL_TIMEOUT"
ToolTimeoutEnv names the environment variable bounding one tool invocation and, for an external engine, one message round trip and the grace a cancel is given.
const ToolsEnv = "OPENSYSML_TOOLS"
ToolsEnv names the environment variable holding the tool manifest: a directory with one JSON entry per external tool.
const TransportGRPC = "grpc"
TransportGRPC is a bidirectional streaming RPC to an address; defined, not yet served.
const TransportStdio = "stdio"
TransportStdio is a child process on a pair of pipes, the one transport this build serves.
Variables ¶
var BaseToolEnv = []string{"PATH", "HOME", "TMPDIR", "LANG"}
BaseToolEnv are the variables of this process every tool with an invocation block is started with; the rest of the environment is not inherited.
var BoundNames = []string{"depth", "steps", "runs", "memory"}
BoundNames are the bounds an engine entry may take, as the budget spells them.
var ErrConstruct = errors.New("construct outside the check engine's search")
ErrConstruct is the typed refusal of a construct the check engine does not search.
var ErrDomain = errors.New("engine has no domain for that type")
ErrDomain is the typed error for a free input whose declared type the engine cannot narrow to a domain it ranges over.
var ErrDuplicateEngine = errors.New("engine already registered")
ErrDuplicateEngine is the typed error Register returns for a name already registered.
var ErrEngineExited = errors.New("engine process exited")
ErrEngineExited is the typed error for an engine process that ended before it answered.
var ErrEngineFault = errors.New("engine answered with an error")
ErrEngineFault is the typed error for an engine answering a request with an error.
var ErrEngineRefusal = errors.New("engine does not cover the question")
ErrEngineRefusal is the typed error for an engine answering covers with false.
var ErrEngineTimeout = errors.New("engine did not answer in time")
ErrEngineTimeout is the typed error for a message unanswered within OPENSYSML_TOOL_TIMEOUT.
var ErrEngineWithheld = errors.New("engine is not served by this service")
ErrEngineWithheld is the typed error for a manifest engine a service lists but does not run: a request naming it asks to run a program on the server the operator did not grant.
var ErrFreedom = errors.New("engine cannot leave that free")
ErrFreedom is the typed error a concrete engine refuses with for a question that leaves free what the engine fixes.
var ErrHandshake = errors.New("engine describes itself otherwise than its manifest entry")
ErrHandshake is the typed error for a describe answer that disagrees with the manifest.
var ErrInconsistentResult = errors.New("claim and strength do not agree")
ErrInconsistentResult is the typed error for a claim at a strength the scale does not admit.
var ErrInput = errors.New("engine cannot free that input")
ErrInput is the typed error for a feature a question names as an input that the engine cannot leave free: one the behavior lacks, or one it writes back.
var ErrInputNotFree = errors.New("a witness input the question does not leave free")
ErrInputNotFree is the typed refusal of a witness input the question does not leave free.
var ErrJob = errors.New("job index must not be negative")
ErrJob is the typed error for a run asking for a worker at a negative job index.
var ErrJobs = errors.New("jobs must be a positive integer")
ErrJobs is the typed error for a jobs setting that is not a positive integer.
var ErrMalformedQuestion = errors.New("question lacks the ask its kind needs")
ErrMalformedQuestion is the typed error for a question missing the ask its kind needs.
var ErrManifest = errors.New("tool manifest is malformed")
ErrManifest is the typed error every fault in a manifest unwraps to.
var ErrNoEngine = errors.New("no engine answers this kind of question")
ErrNoEngine is the typed error Answer returns when no registered engine answers the question's kind at all.
var ErrNoReplay = errors.New("no action to replay the witness on")
ErrNoReplay is the typed refusal of a witness on a question with no action to replay it on.
var ErrNoRuntime = errors.New("model builds no runtime of a run's own")
ErrNoRuntime is the typed error for a run needing a context the model does not build.
var ErrNotAsked = errors.New("engine does not answer this kind of question")
ErrNotAsked is the typed error an engine refuses with for a kind it does not answer.
var ErrNotExternal = errors.New("not an external engine")
ErrNotExternal is the typed error for a name given to serve that is not a manifest engine.
var ErrNotServed = errors.New("manifest entry is not served in this build")
ErrNotServed is the typed error for a manifest entry this build lists but does not run.
var ErrOverclaim = errors.New("engine answered above its authority")
ErrOverclaim is the typed error for an engine answering above its declared authority.
var ErrProcessAbsent = errors.New("engine's process is absent")
ErrProcessAbsent is the typed error an external engine refuses with when its process is not found.
var ErrProtocol = errors.New("engine broke protocol")
ErrProtocol is the typed error for an engine that broke the message protocol.
var ErrSessionEnded = errors.New("engine session ended")
ErrSessionEnded is the typed error for a request to an engine whose session in this plan has already ended.
var ErrSubject = errors.New("engine does not answer for the subject")
ErrSubject is the typed error for a question about a subject the entry does not name.
var ErrToolAbsent = errors.New("tool's executable is absent")
ErrToolAbsent is the typed error for a manifest entry whose executable is not found.
var ErrToolVariable = errors.New("tool does not accept the variable")
ErrToolVariable is the typed error for a call using tool variables the manifest entry does not accept.
var ErrUnansweredRun = errors.New("run ended unanswered")
ErrUnansweredRun is the typed error for a run that ended without an answer after reporting progress.
var ErrUnknownEngine = errors.New("no such engine")
ErrUnknownEngine is the typed error for a selection naming no registered engine.
var ErrWireValue = errors.New("value is not carried by the engine protocol")
ErrWireValue is the typed error for a value the protocol does not carry.
var ErrWrongTool = errors.New("call names another tool")
ErrWrongTool is the typed error a tool engine refuses with for a call naming another tool.
var GraphsVersions = []int{modelform.GraphsVersion}
GraphsVersions are the versions of the `graphs:<v>` model form this build serves.
var ProtocolVersions = []int{1}
ProtocolVersions are the versions of the engine message set this build serves.
Functions ¶
func ClockStepOf ¶
ClockStepOf is the clock step set on ctx, 0 (a continuous clock) when ctx is nil.
func Compose ¶
func Compose(results []Result) (Result, []Disagreement)
Compose is the one result of several engines' answers, taken in engine-name order: a witness stands over the universal claim it refutes (a disagreement) — a violation over holds, a satisfying assignment over unsatisfiable, and to a Sensitive question a replayed sensitivity over the feature held not sensitive — else the strongest strength earned.
func Consistent ¶
Consistent is the typed error for a claim at a strength the scale does not admit, nil for a pair it does: nothing at not covered, an existential at witnessed, a concrete claim at observed, a universal at observed, bounded or proved.
func DeclaringScope ¶ added in v0.11.0
DeclaringScope is the scope sym's names resolve in: its owner's, else root.
func DefaultJobs ¶
func DefaultJobs() int
DefaultJobs is the jobs a plan has when nothing sets them: one per CPU, fewer where the memory available leaves less than JobMemoryBudget per worker; never fewer than one.
func DistributionLines ¶ added in v0.11.0
func DistributionLines(table sweep.SweepTable, text func(*runtime.Context, runtime.Value) string) []string
DistributionLines summarise each observable over the completed runs: its extremes, mean and percentiles where the runs produced numbers, the count of each distinct value otherwise, and a histogram of the numbers.
func DrawnMean ¶ added in v0.11.0
func DrawnMean(d *runtime.Distribution) semantics.Value
DrawnMean is a distribution's mean as the Real it is.
func DrawsOf ¶
func DrawsOf(ctx *runtime.Context) runtime.DrawPolicy
DrawsOf is the draw policy set on ctx, random when ctx is nil.
func Explores ¶
func Explores(selection Selection, schedule runtime.SchedulePolicy) (runtime.SchedulePolicy, bool)
Explores is the exploration a selection and a schedule together ask of a behavior: the schedule's own when it explores, else the default one when the selection names the explore engine, `-engine explore` being `-schedule explore`.
func JobsFromEnv ¶
JobsFromEnv is the jobs OPENSYSML_JOBS asks for, DefaultJobs when it is unset or empty; a value that is not a positive integer is reported rather than left at the default.
func Lines ¶
Lines tables listings as a report prints them — name, kind, protocol, authority, kinds, status — then one source line per manifest entry.
func Observe ¶ added in v0.11.0
func Observe(ctx *runtime.Context, outcome runtime.Outcome, observables []string) []runtime.CalcOutputValue
Observe is what one run reports: the observables named, in that order, from the clock and the outcome's features; every feature in name order and the clock when none are named. The clock's name is reserved, so a feature called clock is never reported; a feature the run does not hold is left out.
func OutputColumns ¶ added in v0.11.0
func OutputColumns(table sweep.SweepTable) []string
OutputColumns names a table's outputs in the order its rows first produced them.
func OutputLimitFromEnv ¶ added in v0.9.2
func OutputLimitFromEnv() int
OutputLimitFromEnv reads OutputLimitEnv, falling back to DefaultOutputLimit for an unset, unparsable or non-positive value.
func ParseJobs ¶
ParseJobs reads a jobs setting written at source: a positive integer, else a JobsError.
func ProcessDetail ¶ added in v0.9.2
ProcessDetail spells a failed process: how it exited and what it wrote to standard error.
func ProgressText ¶
func ProgressText(p enginewire.ProgressParams) string
ProgressText spells progress as a report prints it: `runs 120, depth 17, steps 3: text`.
func RenderReply ¶ added in v0.9.2
RenderReply spells a reply's outputs canonically, by variable name, as it was written and before binding: two invocations of equal inputs compare by it.
func SensitivityFile ¶
SensitivityFile names one witness of a pair of schedules ending with different values of a feature, `test.race-x-A.witness` and `test.race-x-B.witness`: the checked name, the feature's segments and the label, `A` or `B`, of the copy that ran it.
func ToolEngineName ¶
ToolEngineName is the name of the engine answering for the tool named.
func ToolEnvNames ¶ added in v0.9.2
ToolEnvNames are the names of this process's variables a tool's environment may carry: the base ones and each ToolEnvPassthroughEnv lists. An entry holding `=` or a NUL byte is not an environment variable name and is refused.
func ToolReplyOf ¶
ToolReplyOf reads the tool's standard output as the protocol's one JSON object: the outputs keyed by ToolVariable name, or the tool's own error as a ToolError.
func ToolRequestOf ¶
ToolRequestOf is the JSON object the protocol writes to the tool for one call: the toolName and uri passed through, the inputs keyed by ToolVariable name. Its bytes are the same for equal inputs, so two invocations compare by them.
func ToolTimeoutFromEnv ¶ added in v0.9.2
ToolTimeoutFromEnv reads the tool timeout, falling back to DefaultToolTimeout for an unset, unparsable or non-positive value.
func Unobserved ¶ added in v0.11.0
func Unobserved(table sweep.SweepTable, observables []string) error
Unobserved is the error of an observable no completed run produced: the action holds no such feature, or holds one no run gave a value. Nothing is held against a table whose every run failed.
func ValidationReason ¶
func ValidationReason(report runtime.ValidationReport) string
ValidationReason says what kept a validation from holding: that the object states no assertion, how many fail, how many are undecided, whether every object was reached.
func ViolationFile ¶
ViolationFile names the witness of the n-th violation of the subject, performed by performer when one is named: `test.race.violation-1.witness`, `Plant.fill@Plant.tank.violation-1.witness`. Its one `-` tells it from a divergence's file, whose tokens carry none.
func WithReporter ¶
WithReporter installs the reporter a plan's external engines report progress to.
func WithUnit ¶ added in v0.11.0
WithUnit spells a number as the table spells it, in unit, bare when it has none.
func WitnessLine ¶ added in v0.11.0
WitnessLine spells a witness: the file it was written to, else its draws and choices as one schedule, "no choices" for an empty one.
func WriteWitness ¶
WriteWitness writes the witness text beside path and moves it into place over what the path held, so a link planted there is replaced, never followed to what it points at. The directory is made when it does not exist.
Types ¶
type Answer ¶
type Answer struct {
Claim Claim
// Reason says why nothing is claimed when no error does.
Reason string
// Err is the failure that ended the execution: a typed runtime error, whose
// budget the engine reports as a bound reached.
Err error
Values []Evaluation
}
Answer is what one performance established: the claim it supports, the values it produced, and why when it claims nothing.
func CaseAnswer ¶
func CaseAnswer(result runtime.AnalysisResult, err error) Answer
CaseAnswer is what one analysis case run established: its outputs.
func CheckAnswer ¶
func CheckAnswer(result runtime.CheckResult, err error) Answer
CheckAnswer is what a constraint, requirement or satisfaction check established. A false verdict arrives as an error unwrapping to runtime.ErrViolated and is a violation.
func ValidationAnswer ¶
func ValidationAnswer(report runtime.ValidationReport, err error) Answer
ValidationAnswer is what validating an object established: a violated assertion is a violation, every assertion holding on every object reached is holding, and an undecided assertion or an unreached object claims nothing.
func ValuesAnswer ¶
func ValuesAnswer(values []Evaluation, err error) Answer
ValuesAnswer is what a run producing values established: the values, or nothing when it failed.
func VerificationAnswer ¶
func VerificationAnswer(result runtime.VerificationResult, err error) Answer
VerificationAnswer is what one verification case run established: pass holds, fail is violated, and an inconclusive or erroring body establishes nothing.
type Asking ¶
Asking puts one query to the solver in a method expression's shape. An error is that query's failure, not the question's; nil for both is a query withheld, which stays uncovered.
type Bound ¶
type Bound struct {
// Name is the bound's, as the budget spells it: runs, depth, steps,
// elements, solver, configurations.
Name string
// Limit is the value the run was held to: a count, or milliseconds for a time.
Limit int64
// Reached reports the run stopped at the limit rather than finishing within it.
Reached bool
}
Bound is one limit a run took, and whether the run reached it.
type BoundedBuffer ¶ added in v0.9.2
type BoundedBuffer struct {
// contains filtered or unexported fields
}
boundedBuffer keeps the first limit bytes written to it and stops the process at the first byte beyond. It is a plain Writer so every byte passes through Write; mu lets a process's two streams and the reader that inspects them share one.
func NewBoundedBuffer ¶ added in v0.9.2
func NewBoundedBuffer(limit int, stop context.CancelFunc) *BoundedBuffer
NewBoundedBuffer is a buffer of limit bytes that calls stop when the limit is passed.
func (*BoundedBuffer) Bytes ¶ added in v0.9.2
func (b *BoundedBuffer) Bytes() []byte
Bytes is a copy of what was kept.
func (*BoundedBuffer) Over ¶ added in v0.9.2
func (b *BoundedBuffer) Over() bool
Over reports whether the limit was passed.
type Bounds ¶
type Bounds []Bound
Bounds is every bound a run took, in the order the budget names them.
type Budget ¶
type Budget struct {
// Deadline is the wall clock for the whole plan, met as context.DeadlineExceeded; zero means none.
Deadline time.Time
// Jobs is how many runs may go concurrently, as -jobs, %jobs or OPENSYSML_JOBS set it
// and BudgetOf fills it; zero means one. Memory times Jobs is what the fleet may hold.
Jobs int
// Runs is how many runs an exploration, rows a sweep or queries a solver
// may make; the unit is the engine's.
Runs int
// Depth is how many moves one run may resolve.
Depth int
// Unroll is how many iterations of a body loop a symbolic engine unrolls; zero is
// DefaultUnroll.
Unroll int
// Steps is the step budget of one run, as OPENSYSML_MAX_STEPS names it.
Steps int
// Solver is the time one query may take, as OPENSYSML_SMT_TIMEOUT names it.
Solver time.Duration
// Memory is the elements one run may hold, as OPENSYSML_MAX_ELEMENTS names it.
Memory int
}
Budget is what a run may spend; a zero field is the engine's own default. Runs, Depth and Solver are applied by the engines in their own units, Deadline by Registry.Answer to the plan's context; Steps and Memory name the context's.
type CheckAsk ¶
type CheckAsk struct {
// Start begins the invocation in a context of the check's own; a replay begins it the same way.
Start runtime.Starter
// Performer names the object Start performs the behaviors on, as the surface
// spelled it, so the witnesses of one behavior on two objects are two sets of
// files; empty when no object performs it.
Performer string
// Properties are evaluated at every stable state; one false is a violation.
Properties []runtime.CheckProperty
// Diverge names the features whose final values are compared across the
// complete schedules; none compares the behaviors' own attributes and final
// states, and the performing object's features when one performs them.
Diverge []string
// WitnessDir is where every violation's and divergent value's witness is
// written, a file per witness; empty writes none.
WitnessDir string
}
CheckAsk is what a check question asks over the schedules of one invocation: how its behaviors begin on one clock, what must hold at every stable state, what may not diverge, and where the witnesses go.
type CheckConditions ¶ added in v0.11.0
type CheckConditions struct {
Properties []runtime.CheckProperty
Conditions []*symbols.Symbol
Assume []*symbols.Symbol
Scope *symbols.Scope
}
CheckConditions are the constraints and requirements a check evaluates and assumes, resolved from the names a caller gave: Properties evaluated at every stable state about every object the invocation's behaviors perform on, each holding when it holds of each; Conditions the same symbols for the symbolic engine to translate; Assume the symbols it assumes; Scope the scope they resolve in.
func ResolveCheckConditions ¶ added in v0.11.0
func ResolveCheckConditions(lookup func(name string) (*symbols.Symbol, error), root *symbols.Scope, properties, assume []string) (CheckConditions, error)
ResolveCheckConditions resolves the property and assumption names through lookup, root being the scope a symbol without an owning scope is read in. A name that resolves to neither a constraint nor a requirement is an error, as is a name given when nothing is loaded (root nil).
type CheckStatus ¶ added in v0.11.0
type CheckStatus int
CheckStatus is how a check's answer stands: the condition held of every searched schedule, some schedule failed it, or nothing was decided.
const ( CheckUndecided CheckStatus = iota CheckHolds CheckFails )
func CheckLines ¶ added in v0.11.0
func CheckLines(label string, result Result) (CheckStatus, []string, bool)
CheckLines renders what one engine answered to a check of the behavior label names, as the `sysml` command prints it: the status line, then each violation with its probability and witness, each divergent value, and each outcome of the complete schedules; for an answer carrying no search report (the symbolic engine's or an external one's) the claim, the inputs and assumptions it rests on and its witnesses. Unresolved is true when no engine covered the question.
func (CheckStatus) String ¶ added in v0.11.0
func (s CheckStatus) String() string
String spells the status as the service reports it.
type Checked ¶
type Checked struct {
Report *runtime.CheckReport
Violations []string
Divergent [][]string
}
Checked is a check's report with where its witnesses were written: a path per violation and per divergent value, in the report's order; none without a directory.
type Claim ¶
type Claim int
Claim is what a result asserts about its question.
const ( // ClaimNone asserts nothing; the result's Reason says why. ClaimNone Claim = iota // ClaimHolds asserts the condition holds for what the question left free. ClaimHolds // ClaimViolated asserts an execution violates the condition. ClaimViolated // ClaimSensitive asserts the behavior's result depends on its schedule. ClaimSensitive // ClaimValue asserts the values in Values are what the subject produces. ClaimValue // ClaimTable asserts the rows in Values are the domain's, one per row. ClaimTable // ClaimOutcomes asserts the outcomes in Values are what the behavior can do. ClaimOutcomes // ClaimSatisfiable asserts an assignment in Values meets the conditions. ClaimSatisfiable // ClaimUnsatisfiable asserts no assignment meets the conditions. ClaimUnsatisfiable // ClaimUnbounded asserts an objective has no optimum: better values exist without limit. ClaimUnbounded )
func ParseClaim ¶
ParseClaim reads a claim as Claim.String spells it.
func (Claim) Concrete ¶
Concrete reports whether the claim is the values concrete executions produced — a value, a table — which are only ever observed.
func (Claim) Existential ¶
Existential reports whether the claim is that some execution exists — a violation, a sensitivity, a satisfying assignment — for which witnessed is the one strength that is a claim at all.
type Column ¶ added in v0.9.2
Column is a CSV column: a header name, or a zero-based index as a JSON integer.
func (Column) MarshalJSON ¶ added in v0.9.2
MarshalJSON writes the column as it is read.
func (Column) String ¶ added in v0.9.2
String spells the column for an error: the name, or the index.
func (*Column) UnmarshalJSON ¶ added in v0.9.2
UnmarshalJSON reads a name or a zero-based index; a negative index, a fraction, a boolean or null is malformed.
type ComputeAsk ¶
ComputeAsk is the invocation a Compute question asks for: one performance of an action annotated ToolExecution, as the runtime hands it to the tool.
func (*ComputeAsk) Ran ¶ added in v0.9.2
func (a *ComputeAsk) Ran(use ToolUse)
Ran reports a tool call's use to the asker, when one listens.
type ConditionCheck ¶ added in v0.11.0
type ConditionCheck func(*runtime.Context, *symbols.Symbol, *symbols.Scope, *runtime.Instance) (runtime.CheckResult, error)
ConditionCheck evaluates a constraint or requirement about an object.
type ConstructError ¶
ConstructError names the construct the check engine met and does not search.
func (*ConstructError) Error ¶
func (e *ConstructError) Error() string
Error names the engine and the construct.
type CountedText ¶ added in v0.11.0
CountedText is one distinct non-numeric value an observable took, spelled through its run's context, and how many completed runs produced it.
type Coverage ¶
type Coverage struct {
Covered bool
// Refusal names the construct, condition or absent process the engine
// cannot handle; nil when covered.
Refusal error
}
Coverage is what Covers answers: covered, or refused for a typed reason.
type Description ¶
type Description struct {
// Questions are the kinds the engine answers.
Questions []Kind
// Process names the external process the engine needs, empty for none.
Process string
// Bounds names the bounds the engine takes, in the order it reports them.
Bounds []string
// Replays reports whether the engine's witnesses replay through the interpreter.
Replays bool
// Authority is the strongest evidence the engine can ever produce.
Authority Strength
}
Description is an engine's capability declaration.
func (Description) Answers ¶
func (d Description) Answers(k Kind) bool
Answers reports whether the engine declares the kind.
type Disagreement ¶
type Disagreement struct {
// Stands names the engine whose witnessed result the composition kept.
Stands string
// Demoted names the engine whose result was demoted, and Claimed is that result as it answered.
Demoted string
Claimed Result
// Reason is the disagreement as the demoted result's Reason spells it.
Reason string
}
Disagreement is two engines contradicting each other about one question: a witnessed existential claim against a universal claim it refutes. The interpreter is normative, so the witness stands and the other result is demoted to not covered with the disagreement as its reason.
type DomainError ¶
type DomainError struct {
Engine string
Feature string
// Type is the declared type, as written; "" when the feature declares none.
Type string
// Reason says what the type lacks, when the engine can say more than its name.
Reason string
}
DomainError reports a free input of a type the engine has no domain for; the question is not covered, since ranging over an unconstrained variable would claim what the model does not say.
func (*DomainError) Error ¶
func (e *DomainError) Error() string
Error names the engine, the feature and its type.
type DryRun ¶ added in v0.9.2
type DryRun struct {
Tool, Version, Manifest, Executable, Protocol string
// Args are the argv entries after the executable, as the invocation block renders
// them; nil for an entry without one.
Args []string
// Env is the environment in NAME=value pairs, sorted; nil when the entry has no
// invocation block, in which case the whole environment is inherited. A variable
// taken from this process is spelt "NAME=<from this process>"; only the block's
// own entries show their rendered values.
Env []string
// Cwd is the working directory; empty inherits this process's.
Cwd string
// Stdin says what the process reads; StdinJSON for an entry without the block.
Stdin StdinFormat
// StdinData is what standard input carries.
StdinData []byte
// InputFile is the file the block's `inputFile` writes, nil when it has none.
InputFile *DryRunFile
// OutputDir marks that the entry uses {outputDir}.
OutputDir bool
// Inputs are the values the call sent the tool.
Inputs []runtime.ToolInput
// Outputs are the bindings the call expects back, sorted by variable.
Outputs []runtime.ToolOutput
// Reply is the entry's `reply` block; nil is the object protocol.
Reply *Reply
// ReplySource is where the reply is read, rendered like argv: stdout, or
// file:<template> with {outputDir} spelled <outputDir>.
ReplySource string
}
DryRun is what one tool call would be given, composed without starting the process.
type DryRunFile ¶ added in v0.9.2
type DryRunFile struct {
Name string
Format InputFormat
Data []byte
}
DryRunFile is the input file a dry run would write: its name, format and contents.
type DryRunner ¶ added in v0.9.2
type DryRunner struct {
// contains filtered or unexported fields
}
DryRunner answers every call with the call's preview instead of the tool's run, remembering the first preview it made for the surfaces to read.
func (*DryRunner) Reached ¶ added in v0.9.2
func (d *DryRunner) Reached() (*ToolDryRunError, bool)
Reached is the first preview RunTool made, when a call reached the tool: a call an objective's condition made ends the run with no error to read.
func (*DryRunner) RunTool ¶ added in v0.9.2
RunTool walks the selection's candidates in the order the real runner consults them, probing only tool entries: a non-tool candidate ahead of the tool's own is undecided under auto, and refusing or not a tool entry under a named selection. Under all every covering engine runs, so an engine ahead of the tool is passed — one refusing the call never runs, one covering it runs beside the tool; only when no entry of the tool's name is registered does an engine that covers the call, or an external one that cannot be probed and may, leave the preview undecided.
type DuplicateEngineError ¶
type DuplicateEngineError struct {
Name string
}
DuplicateEngineError reports a second registration under one name.
func (*DuplicateEngineError) Error ¶
func (e *DuplicateEngineError) Error() string
Error names the engine.
func (*DuplicateEngineError) Is ¶
func (e *DuplicateEngineError) Is(target error) bool
Is matches ErrDuplicateEngine.
type Engine ¶
type Engine interface {
// Name is the engine's stable identity.
Name() string
// Describe reports what the engine can do, fixed at registration.
Describe() Description
// Covers says, before any work, whether the engine can answer q for this model;
// a refusal names what it cannot handle and is never a result.
Covers(model *Model, q Question) Coverage
// Run answers q within the budget, in a context of its own. It never
// mutates model; it stops when ctx is done and reports how far it got.
Run(ctx context.Context, model *Model, q Question, budget Budget) (Result, error)
}
Engine is one registered way of answering questions about a model.
type EngineEntry ¶
type EngineEntry struct {
// File is the entry read; Dir its directory, which a relative command is confined to.
File string
Dir string
// Kind is engine, policy or sampler.
Kind EntryKind
// Name is the engine's registered name, as -engine selects it.
Name string
Version string
// Command is the executable and its arguments as written; Executable the resolved path
// of Command[0], confined to Dir when relative.
Command []string
Executable string
// Transport is stdio or grpc; Address is where a grpc engine listens.
Transport string
Address string
// Module is a WebAssembly module in place of Command; defined, served by a later stage.
Module string
// Protocol is the version of the message set the engine speaks.
Protocol int
// Answers, Subjects, Bounds and Witness are the engine's Description. Subjects are
// declaration kinds as the notation spells them without def (action, state, calc);
// empty means any subject.
Answers []Kind
Subjects []string
Bounds []string
Witness WitnessKind
// Model names the forms of the model the engine reads; sources is always sent.
Model []ModelForm
// Authority is the strongest strength the engine says it produces for a universal claim.
Authority Strength
// Concurrent says whether one process may hold several run requests open at once.
Concurrent bool
}
EngineEntry is one `engine`, `policy` or `sampler` entry of a manifest, as the framework's Description written down: the fields the host checks before any process runs.
func (EngineEntry) Description ¶
func (e EngineEntry) Description() Description
Description is the entry as the framework describes an engine.
func (EngineEntry) Forms ¶
func (e EngineEntry) Forms() []ModelForm
Forms are the model forms a run carries: sources always, then what the entry asked for.
func (EngineEntry) Origin ¶
func (e EngineEntry) Origin() Origin
Origin is where the entry comes from, as a listing prints it.
func (EngineEntry) Present ¶
func (e EngineEntry) Present() error
Present checks the entry's program is there without running it: a regular file, executable by someone for a command. It is the one check a listing makes of the file system.
func (EngineEntry) Program ¶
func (e EngineEntry) Program() string
Program is the resolved executable or module path the entry runs, empty for a grpc engine.
func (EngineEntry) Served ¶
func (e EngineEntry) Served() error
Served reports whether this build runs the entry, and the typed reason when it does not: strategies, WebAssembly modules, the grpc transport and the rdf form are later stages.
type EngineExitedError ¶
type EngineExitedError struct {
Engine string
Process string
// Started reports whether the process had answered describe before it ended.
Started bool
Err error
Stderr string
}
EngineExitedError reports the process ending: at start, or during a request. Stderr is what it wrote to standard error, within the output bound.
func (*EngineExitedError) Error ¶
func (e *EngineExitedError) Error() string
Error names the engine, the process and how it ended.
func (*EngineExitedError) Is ¶
func (e *EngineExitedError) Is(target error) bool
Is matches ErrEngineExited.
func (*EngineExitedError) Unwrap ¶
func (e *EngineExitedError) Unwrap() error
Unwrap is the process error.
type EngineFaultError ¶
EngineFaultError is the engine's error answer: its code and message.
func (*EngineFaultError) Error ¶
func (e *EngineFaultError) Error() string
Error names the engine, the code and the message.
func (*EngineFaultError) Is ¶
func (e *EngineFaultError) Is(target error) bool
Is matches ErrEngineFault.
type EngineRefusalError ¶
EngineRefusalError is the engine's own refusal of a question, with the reason it gave.
func (*EngineRefusalError) Error ¶
func (e *EngineRefusalError) Error() string
Error names the engine and its reason.
func (*EngineRefusalError) Is ¶
func (e *EngineRefusalError) Is(target error) bool
Is matches ErrEngineRefusal.
type EngineTimeoutError ¶
EngineTimeoutError reports a request unanswered within the timeout: describe or covers within the round-trip bound, or a cancelled run within the grace after cancel.
func (*EngineTimeoutError) Error ¶
func (e *EngineTimeoutError) Error() string
Error names the engine, the request and the bound.
func (*EngineTimeoutError) Is ¶
func (e *EngineTimeoutError) Is(target error) bool
Is matches ErrEngineTimeout.
type EngineWithheldError ¶
type EngineWithheldError struct {
Name string
}
EngineWithheldError names the engine a service withholds.
func (*EngineWithheldError) Error ¶
func (e *EngineWithheldError) Error() string
Error reads `engine 'spin-bridge' is not served by this service`.
func (*EngineWithheldError) Is ¶
func (e *EngineWithheldError) Is(target error) bool
Is matches ErrEngineWithheld.
type EntryKind ¶
type EntryKind string
EntryKind is what a manifest entry registers: a tool the model names, an engine, or a strategy a later build serves.
const ( // KindTool is an executable a ToolExecution names; the default when `kind` is absent. KindTool EntryKind = "tool" // KindEngine is an external analysis engine answering questions over the protocol. KindEngine EntryKind = "engine" // KindPolicy is an external scheduling policy, not served in this build. KindPolicy EntryKind = "policy" // KindSampler is an external sweep sampler, not served in this build. KindSampler EntryKind = "sampler" )
type Evaluation ¶
type Evaluation struct {
// Name is the feature, output, row or query the evaluation is of.
Name string
// Value is a feature value or output.
Value runtime.Value
// Row is one row of a sweep.
Row *sweep.SweepRow
// Explored is the outcome set an exploration reached.
Explored *runtime.Exploration
// Solved is a solver's answer to one query.
Solved *solve.Result
// Checked is what a search of an action's schedules found, with its witnesses written.
Checked *Checked
// Err is what failed this unit.
Err error
}
Evaluation is one thing the question asked for, as the engine established it: exactly one of Value, Row, Explored, Solved and Checked is set, or Err when this unit failed.
func OutputValues ¶
func OutputValues(outputs []runtime.CalcOutputValue) []Evaluation
OutputValues is a case's or calculation's outputs as evaluations.
type External ¶
type External interface {
Engine
// Process names the process found (`z3 at /usr/bin/z3`), or reports its
// absence as the typed error Covers refuses with.
Process() (string, error)
}
External is an engine that needs a process outside the build, and reports whether it found one.
func ExternalsFromEnv ¶
ExternalsFromEnv reads both manifests the environment names as engines: one `tool:<name>` per tool entry and one engine per engine, policy or sampler entry, in manifest then entry order, each whether or not its program is found or this build serves it; none when both are unset. A manifest that cannot be read is a ManifestError.
func NewSolve ¶
NewSolve returns the solve engine over the solver discover finds; nil discovers as solve.Discover does.
type Freedom ¶
type Freedom int
Freedom is what a question leaves free; a set of the flags below.
type FreedomError ¶
FreedomError reports a question leaving free what the engine fixes: inputs to one that runs concrete values only, the schedule to one that runs under one policy.
func (*FreedomError) Error ¶
func (e *FreedomError) Error() string
Error names the engine and what it cannot leave free.
type HandshakeError ¶
HandshakeError reports the field of describe that differs from the manifest entry.
func (*HandshakeError) Error ¶
func (e *HandshakeError) Error() string
Error names the engine, the field and both spellings.
type HoldsAsk ¶
type HoldsAsk struct {
// Behavior is the action definition or usage whose schedules are asked about.
Behavior *symbols.Symbol
// Scope is the scope Behavior's body resolves in; Behavior's own when nil.
Scope *symbols.Scope
// Conditions are the requirements and constraints asked to hold at every
// move, each as `-check-property` names it; none asks only that no schedule deadlocks.
Conditions []*symbols.Symbol
// Start begins one run of Behavior in a fresh context, as an explored run is
// begun: the executor made, on the object performing it when there is one.
Start Start
// Inputs names features of Behavior or its performer to leave free although
// the model binds them, as `-check-input` spells them.
Inputs []string
// Assume are the constraints or requirements assumed over the initial state.
Assume []*symbols.Symbol
// Diverge names the features whose final values a Sensitive question compares
// across the complete schedules, as `-check-diverge` spells them; none compares
// the action's own attributes, and the performing object's when one performs it.
Diverge []string
// Performer names the object performing Behavior, "" when the action runs on
// its own; a witness file is named after the subject and it.
Performer string
// WitnessDir is where a violation's or a sensitivity's witnesses are written, "" for nowhere.
WitnessDir string
}
HoldsAsk is the behavior a Holds or Sensitive question is about, the conditions asked to hold over its schedules, the features whose final values a Sensitive question compares across them, and how one run of it begins in a fresh context.
type InconsistentResultError ¶
InconsistentResultError reports a result whose claim and strength the scale does not admit together: a defect in the engine, never an answer.
func (*InconsistentResultError) Error ¶
func (e *InconsistentResultError) Error() string
Error names the pair, and the engine when known.
func (*InconsistentResultError) Is ¶
func (e *InconsistentResultError) Is(target error) bool
Is matches ErrInconsistentResult.
type Input ¶
type Input struct {
// Name is the feature as the performance holds it.
Name string
// Type is the declared type, as written; "" when the feature declares none.
Type string
// Sort is the solver sort the feature's values range over (Int, Real, Bool, an
// enumeration's datatype).
Sort string
// Domain says what the sort is narrowed to (`>= 0`, the constructors, an
// interval); "" when the sort alone is the domain.
Domain string
// Free reports whether the engine ranged over the domain; false pins Value.
Free bool
// Optional reports a free input whose multiplicity admits no value (`[0..1]`):
// the engine ranged over its absence too, which a witness spells `null`.
Optional bool
// Value is the value pinned, or the one a witness chose for a free input,
// spelled as the witness file's input line spells it; "" for a free input
// of a claim with no witness, or a pinned one held without a value.
Value string
}
Input is one feature of the behavior or its performer an engine ranged over or pinned in the initial state: free in the domain its declared type narrows the sort to, or fixed at the value the model binds it to.
type InputError ¶
InputError reports a named input the engine refuses to leave free, and why.
func (*InputError) Error ¶
func (e *InputError) Error() string
Error names the engine, the feature and the reason.
type InputFile ¶ added in v0.9.2
type InputFile struct {
Format InputFormat `json:"format"`
Name string `json:"name"`
}
InputFile is the `inputFile` field: the format and the bare file name written into the invocation's temporary directory.
type InputFormat ¶ added in v0.9.2
type InputFormat string
InputFormat is what an input file holds.
const ( // InputJSON is the protocol's request object. InputJSON InputFormat = "json" // InputCSV is one header row and one row of the inputs sent. InputCSV InputFormat = "csv" )
type InputNotFreeError ¶
InputNotFreeError names the input an engine's witness fixed that the question had bound.
func (*InputNotFreeError) Error ¶
func (e *InputNotFreeError) Error() string
Error names the engine and the input.
func (*InputNotFreeError) Is ¶
func (e *InputNotFreeError) Is(target error) bool
Is matches ErrInputNotFree.
type Invocation ¶ added in v0.9.2
type Invocation struct {
// Args are the argv entries after the executable, each one template.
Args []string `json:"args,omitempty"`
// Env are variables added to the minimal base environment, each value one template.
Env map[string]string `json:"env,omitempty"`
// Cwd is the working directory: absolute, or relative to the manifest directory and
// confined to it. Empty inherits this process's.
Cwd string `json:"cwd,omitempty"`
// Stdin says what the process reads: the JSON request by default.
Stdin StdinSpec `json:"stdin"`
// InputFile, when set, is written into the invocation's temporary directory before the
// process starts; `{inputFile}` names its path.
InputFile *InputFile `json:"inputFile,omitempty"`
// contains filtered or unexported fields
}
Invocation is a tool entry's `invocation` block: how the process is composed from one call's values. Absent, the executable starts as before: no arguments, the JSON request.
type JobsError ¶
JobsError reports a jobs setting no plan can run under: the value as written and where it was written, the variable or the flag.
type Kind ¶
type Kind int
Kind is what a question asks of its subject.
const ( // Evaluate asks for one execution under stated bindings and a stated // scheduling policy: a calc, a case, a behavior, or a condition on a subject. Evaluate Kind = iota // Outcomes asks what a behavior can do over every schedule. Outcomes // Holds asks whether a condition holds over a behavior or a case, with the // schedule and/or the unbound inputs free within stated bounds. Holds // Sensitive asks whether a behavior's result depends on its schedule. Sensitive // Satisfiable asks whether some assignment to the unbound features meets a // set of conditions. Satisfiable // Sweep asks a calc or case once per row of a domain the rows enumerate or sample. Sweep // Compute asks an external tool once, as an action annotated ToolExecution names it. Compute )
func CheckKind ¶
CheckKind is what a check asks: Sensitive once a feature is named to compare across the schedules; else Holds once a property or condition is stated, an input released, an assumption made or the unroll bound set (what a symbolic engine alone answers or reads); else Outcomes.
type Linearization ¶
Linearization runs the behavior once in a fresh context under the context's schedule, in the shape runtime.Explore drives.
type Listing ¶
type Listing struct {
Status
Description
Origin
// Withheld is the typed reason the registry lists the engine but does not run it; nil
// when it is served.
Withheld error
}
Listing is one engine as -engines, %engines and ListEngines report it: its capability declaration beside the state of its process and where it comes from.
func (Listing) OriginText ¶
OriginText is the manifest entry's source line, empty for a built-in engine: `spin-bridge 1.4.0: engine from /etc/opensysml/engines/spin-bridge.json, runs /opt/spin-bridge/bin/spin-bridge, not admitted`.
func (Listing) Ready ¶
Ready reports whether the engine can run: it is served, and it needs no process or its process is found.
func (Listing) Served ¶
Served reports whether the registry runs the engine when a question reaches it.
func (Listing) StatusText ¶
StatusText is the engine's state in a word: `ready`, `ready (z3 at /usr/bin/z3)`, `unavailable: <why>` or `withheld: <why>`.
type MalformedQuestionError ¶
type MalformedQuestionError struct {
Kind Kind
// Missing names the field the kind needs.
Missing string
}
MalformedQuestionError reports a question whose kind's ask is missing.
func (*MalformedQuestionError) Error ¶
func (e *MalformedQuestionError) Error() string
Error names the kind and the field.
func (*MalformedQuestionError) Is ¶
func (e *MalformedQuestionError) Is(target error) bool
Is matches ErrMalformedQuestion.
type Manifest ¶
type Manifest struct {
// Dir is the directory read.
Dir string
// Env names the variable that named Dir.
Env string
// Tools are the `tool` entries.
Tools []ToolEntry
// Engines are the `engine`, `policy` and `sampler` entries.
Engines []EngineEntry
}
Manifest is what one manifest directory registers, each list in name order.
func ManifestsFromEnv ¶
ManifestsFromEnv reads both manifest directories the environment names, OPENSYSML_TOOLS then OPENSYSML_ENGINES, skipping one unset and refusing one under a workspace; a manifest that cannot be read is a ManifestError.
func ReadManifest ¶
ReadManifest reads the manifest in dir, named by the environment variable env: every `.json` file is one entry of the kind its `kind` field says, `tool` when absent. Every fault is a ManifestError; a duplicate name among entries of one kind is one too. A dir under one of the workspaces is refused unread: a manifest comes from the environment, never from a workspace or a model.
type ManifestError ¶
type ManifestError struct {
// Env names the variable that named the directory; ToolsEnv when empty.
Env string
// Path is the directory or the entry file at fault.
Path string
// Detail is what is wrong.
Detail string
// Err is the fault as the file system or the decoder reported it, when one did.
Err error
}
ManifestError reports one fault in a manifest: the directory or entry it is in and what is wrong with it.
func (*ManifestError) Error ¶
func (e *ManifestError) Error() string
Error names the variable, the path and the fault.
func (*ManifestError) Unwrap ¶
func (e *ManifestError) Unwrap() error
Unwrap returns the underlying report.
type Manifested ¶
Manifested is an engine registered from a manifest entry, which reports its origin.
func NewEngine ¶
func NewEngine(entry EngineEntry) Manifested
NewEngine is the engine of a manifest entry: registered whether or not this build serves it, listing the typed reason through Process and refusing every question through Covers.
type Mode ¶
type Mode int
Mode is how a plan chooses the engines it puts a question to.
const ( // SelectAuto puts the question to the strongest covering engine, and to the // next on a not-covered result; the plan names each. SelectAuto Mode = iota // SelectNamed puts the question to exactly one engine; its refusal or // not-covered result is the result. SelectNamed // SelectAll puts the question to every covering engine, in name order, and // composes what they answered. SelectAll )
type Model ¶
type Model struct {
// Context is the surface's own runtime over the model; nil when the surface holds none.
Context func() (*runtime.Context, error)
// Semantics builds a worker's own model-derived part — resolver, semantic model and
// the runtime's memo tables — over the shared frozen index.
Semantics func() (*runtime.Model, error)
// Fresh builds a run's own context on a worker, under the surface's limits.
Fresh func(*Worker) (*runtime.Context, error)
// contains filtered or unexported fields
}
Model is the model a question is about, reached through the runtime contexts a surface builds over it: an evaluation runs in the surface's own where it holds one, every other run in a context of the run's own, on the worker the plan builds (see Worker).
func Held ¶
Held is the model as a surface reaches it through a context it holds: an execution runs in ctx, under its limits, and no run of its own is built.
func (*Model) NewContext ¶
NewContext builds a run's own context on the plan's first worker, taking the budget's Steps as MaxSteps and Memory as MaxElements; a zero field, like every other bound, keeps Fresh's.
func (*Model) NewContextOn ¶
NewContextOn builds a run's own context on the plan's worker for job, under the budget as NewContext takes it.
type ModelForm ¶
type ModelForm string
ModelForm is one form of the model an engine reads.
func GraphsForm ¶
GraphsForm is the `graphs:<v>` form at version v.
func (ModelForm) GraphsVersion ¶
GraphsVersion reads the version of a `graphs:<v>` form; false for any other form.
type ModelSeed ¶
ModelSeed is a seed for the modeled draws of a question's runs, and whether one is set.
func ModelSeedOf ¶
ModelSeedOf is the model seed set on ctx, none when ctx is nil or has none.
type NoEngineError ¶
type NoEngineError struct {
Kind Kind
}
NoEngineError reports a kind no registered engine declares.
type NoReplayError ¶
NoReplayError names the question a schedule witness cannot be replayed for.
func (*NoReplayError) Error ¶
func (e *NoReplayError) Error() string
Error names the engine and the question's kind.
type NoRuntimeError ¶
type NoRuntimeError struct {
Engine string
}
NoRuntimeError reports an engine refusing a model that builds no context its runs need.
type NotAToolEntryError ¶ added in v0.9.2
type NotAToolEntryError struct {
Engine string
}
NotAToolEntryError is the dry runner's refusal of a call whose engine answers Compute questions but is no tool manifest entry.
func (*NotAToolEntryError) Error ¶ added in v0.9.2
func (e *NotAToolEntryError) Error() string
Error names the engine.
type NotAskedError ¶
NotAskedError reports a question of a kind the engine does not answer.
func (*NotAskedError) Error ¶
func (e *NotAskedError) Error() string
Error names the engine and the kind.
type NotExternalError ¶
type NotExternalError struct {
Name string
// Known lists the manifest engines that can be served.
Known []string
}
NotExternalError reports a name asked to be served that names no manifest engine: a built-in, a tool or nothing at all.
func (*NotExternalError) Error ¶
func (e *NotExternalError) Error() string
Error names the engine and the ones that could have been meant.
func (*NotExternalError) Is ¶
func (e *NotExternalError) Is(target error) bool
Is matches ErrNotExternal.
type NotServedError ¶
type NotServedError struct {
Name string
Kind EntryKind
// Reason names what the entry needs that this build does not have.
Reason string
}
NotServedError reports an entry a later build serves: listed with the reason, never run.
func (*NotServedError) Error ¶
func (e *NotServedError) Error() string
Error names the entry and the reason.
type ObservableSummary ¶ added in v0.11.0
type ObservableSummary struct {
Name string
Unit string
Numbers int
MixedUnits bool
Distribution *runtime.Distribution
Counted []CountedText
}
ObservableSummary is one observable over a table's completed runs: the distribution of the numbers it produced, in Unit, and the count of each distinct value that is not a number. MixedUnits reports numbers in more than one unit, which have no distribution.
func Summarize ¶ added in v0.11.0
func Summarize(table sweep.SweepTable, name string, text func(*runtime.Context, runtime.Value) string) ObservableSummary
Summarize reads one observable off the completed rows; text spells a value that is not a number through the row's context.
func (ObservableSummary) Lines ¶ added in v0.11.0
func (s ObservableSummary) Lines() []string
Lines is the summary as the CLI prints it: the distribution line and its histogram, then the distinct values with their counts.
type Origin ¶
type Origin struct {
// Kind is the manifest entry's kind; empty for a built-in engine.
Kind EntryKind
// Version is the entry's.
Version string
// File is the manifest entry; Command the executable it resolved to.
File string
Command string
// Transport and Protocol are an engine entry's; empty and zero for a tool.
Transport string
Protocol int
// Exchange is a tool's ToolEntry.Protocol; empty for an engine entry.
Exchange string
}
Origin is where an engine comes from: the build for one built in, otherwise the manifest entry that registered it and what it runs.
func (Origin) KindText ¶
KindText names the origin's kind as a listing prints it: `built-in` for the build's own.
func (Origin) ProtocolText ¶
ProtocolText names how the engine is spoken to: `-` for one built in, `object` for a tool's one JSON object each way, `argv+<stdin>` for one composed from its invocation block — the reply's format alone or `argv+<stdin>/<format>` when it is not `object` — and `<transport>/<protocol>` for an engine entry.
type OverclaimError ¶
OverclaimError reports a result whose strength exceeds what its engine's Description says it can earn: a defect in the engine, never a stronger answer.
func (*OverclaimError) Error ¶
func (e *OverclaimError) Error() string
Error names the engine and the two strengths.
type Performance ¶
Performance makes one execution in the given context and reports what it established. An error is a fault, not a failed execution, which is an Answer claiming nothing.
type Plan ¶
type Plan struct {
Question Question
Selection Selection
Steps []Step
// Result is the first covered answer under auto or a named engine, and the
// composition of every finished engine's answer under all; when no engine
// covered the question it is the last not-covered result, or one naming
// every refusal.
Result Result
// Disagreements are the contradictions the composition under all resolved,
// each in the interpreter's favor; empty under auto or a named engine.
Disagreements []Disagreement
// Tools is every tool call the plan's runs made when the plan ended, in call order.
Tools []ToolUse
// Workers is how many workers the plan built over every fleet its engines ran on, and
// Warming the time building them took, summed.
Workers int
Warming time.Duration
// contains filtered or unexported fields
}
Plan is how a question was answered: the selection made, every engine consulted in the order the selection ranks them, and the answer that stood.
func Perform ¶
func Perform[T any]( ctx context.Context, r *Registry, req Request, call func(*runtime.Context) (T, error), answer func(T, error) Answer, ) (T, Plan, error)
Perform puts one execution (call, in the request's model's context) to the registry; answer says what it established. A dispatch fault or refusal is the execution's error, and the plan is how it was answered.
func (Plan) Refused ¶
Refused is the typed error for a plan no engine ran: every refusal it met. It is nil when some engine ran, whatever it answered.
func (Plan) Results ¶
Results is every result the plan's engines answered, in step order, a demoted one as demoted; nil when no engine ran.
func (Plan) Standing ¶
Standing is the plan's result's standing, followed by the plan when it consulted more than one engine or was made under all: `; all: run holds (observed), solve refused (…)`.
func (Plan) ToolMark ¶ added in v0.9.2
ToolMark is the count of tool calls made so far: a mark taken before a point — a Monte Carlo conclusion's run in a row's context — bounds the calls before it.
func (Plan) ToolTexts ¶ added in v0.9.2
ToolTexts is what every tool call the plan made ran, as ToolUse spells it, including calls a run's context made after the plan ended.
func (Plan) ToolTextsIn ¶ added in v0.9.2
ToolTextsIn is the texts of the calls made from ctx, nil for a nil ctx.
type PreviewUndecidedError ¶ added in v0.9.2
PreviewUndecidedError is the dry runner's answer when a higher-ranked engine may answer the call first and cannot be probed without a model or a process.
func (*PreviewUndecidedError) Error ¶ added in v0.9.2
func (e *PreviewUndecidedError) Error() string
Error names the engine consulted before the tool.
type Prober ¶
Prober is an engine that can start its process once to check it against its manifest, as -engines -probe asks; Probe answers as Process does, after the handshake.
type ProcessAbsentError ¶
type ProcessAbsentError struct {
Engine string
// Process is what the engine needs, as its Description names it.
Process string
// Err is the probe's own report of the absence.
Err error
}
ProcessAbsentError reports an external engine whose process was not found.
func (*ProcessAbsentError) Error ¶
func (e *ProcessAbsentError) Error() string
Error is the probe's own report, which already names what is absent and how to supply it; without one, Engine and Process say whose need it is.
func (*ProcessAbsentError) Is ¶
func (e *ProcessAbsentError) Is(target error) bool
Is matches ErrProcessAbsent.
func (*ProcessAbsentError) Unwrap ¶
func (e *ProcessAbsentError) Unwrap() error
Unwrap returns the probe's report.
type ProgressReport ¶
type ProgressReport struct {
Engine string
Progress enginewire.ProgressParams
}
ProgressReport is one coalesced progress notification of an external engine's run.
type ProtocolError ¶
ProtocolError reports a line the host could not take as a message: not JSON, no jsonrpc member, no id, a member of the wrong type, an error code outside the protocol's, a line or standard error over the output bound, a witness of the wrong kind. The session is ended with it.
func (*ProtocolError) Error ¶
func (e *ProtocolError) Error() string
Error names the engine and what broke.
type Question ¶
type Question struct {
Kind Kind
// Subject names the element asked about, as the surface spelled it.
Subject string
// Schedule is the scheduling policy the question states: the one an
// evaluation runs under, or the exploring one whose budget bounds outcomes.
Schedule runtime.SchedulePolicy
// ModelSeed is the seed the runs' modeled draws come from when one is set
// apart from the schedule (runtime.Context.SetModelSeed).
ModelSeed ModelSeed
// Draws is how the runs resolve their RandomFunctions draws: at random from
// the seeded stream, or at each call's min, max or average (runtime.Context.SetDrawPolicy).
Draws runtime.DrawPolicy
// ClockStep is the step the runs' clock ticks by, in seconds, on which their
// waits come due; 0 is a continuous clock (runtime.Context.SetClockStep).
ClockStep float64
// Free is what the question leaves open.
Free Freedom
// Perform makes the one execution an Evaluate question asks for.
Perform Performance
// Linearize makes one run of the behavior an Outcomes question asks about,
// in a context of the run's own.
Linearize Linearization
// Sweep is the domain and the row of a Sweep question.
Sweep *SweepAsk
// Solve is the queries of a Satisfiable question and how each is asked.
Solve *SolveAsk
// Holds is the behavior, the condition and the start of one run of a Holds question.
Holds *HoldsAsk
// Compute is the tool invocation a Compute question asks for.
Compute *ComputeAsk
// Check is the action an Outcomes or Holds question asks the check engine to
// search the schedules of, with what must hold and what may not diverge.
Check *CheckAsk
}
Question is what is asked, independently of who answers it: a subject, what is asked of it, what is fixed and what is free, and the ask for its kind saying how one unit is made.
type RefusedError ¶
RefusedError reports a question every engine declaring its kind refused.
func (*RefusedError) Error ¶
func (e *RefusedError) Error() string
Error is the one refusal's text when one engine refused, else every refusal named by its engine.
func (*RefusedError) Unwrap ¶
func (e *RefusedError) Unwrap() []error
Unwrap exposes each refusal to errors.Is and errors.As.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the engines one owner answers with. There is no package-level registry: a binary builds one with Default, a test with NewRegistry, and neither sees the other's.
func Default ¶
func Default() *Registry
Default returns a registry of the framework's own engines: run, explore, check, sweep and solve. Solve registers whether or not a solver is found and refuses through Covers. The build's registry, which adds the engines of other packages, is engines.Default.
func DefaultFromEnv ¶
DefaultFromEnv returns the default registry with every entry of the manifests OPENSYSML_TOOLS and OPENSYSML_ENGINES name: one `tool:<name>` engine per tool entry and one engine per engine, policy or sampler entry. A manifest that cannot be read, or lies under one of the workspaces, is a ManifestError. Each registers whether or not its executable is found or this build serves it, and refuses through Covers; a name registered twice across the manifests is a DuplicateEngineError.
func (*Registry) Answer ¶
func (r *Registry) Answer(ctx context.Context, model *Model, q Question, budget Budget) (Plan, error)
Answer answers q under `auto`: engines of q's kind strongest first, a refusal or a not-covered result advancing (and kept in the plan), an error from Run stopping the plan. A Deadline in the budget bounds the plan through ctx; meeting it is an error like any other, checked before each engine is consulted and before an answer is taken from it. The plan works on a copy of model, so its worker is its own and model is never written.
func (*Registry) AnswerWith ¶
func (r *Registry) AnswerWith(ctx context.Context, model *Model, q Question, budget Budget, selection Selection) (Plan, error)
AnswerWith answers q under the selection: as Answer does under auto; putting it to one engine alone under a named selection, whose refusal or not-covered result is the result; and under all to every covering engine, up to the budget's Jobs of them at once with the Jobs shared out among them, composing what they answered as if they had run one after another in name order. Under all a deadline met cancels the engine that met it and every one not finished, each named in the plan with the bound it reached, and the finished engines' results stand composed; only a plan no engine finished fails with the deadline. The plan works on copies of model, one fleet of workers per engine under all, so model is never written.
func (*Registry) Check ¶
func (r *Registry) Check(ctx context.Context, req Request, kind Kind, free Freedom, check *CheckAsk, holds *HoldsAsk, run Linearization) (Plan, error)
Check puts an action's schedules to the registry as a question of kind, free being what the asker leaves open beside them: check is the explicit-state search's ask, holds the symbolic one, and run performs the action once for an engine exploring it. A Holds or Sensitive question over a start leaving an input unbound has the inputs free too.
func (*Registry) DryRunner ¶ added in v0.9.2
DryRunner is a runtime.ToolRunner that previews the first tool call the selection's engines reach and fails the performance with ToolDryRunError.
func (*Registry) Explore ¶
Explore puts a behavior's outcomes to the registry: run performs it once per linearization the request's schedule asks for, each in a context its model makes. The plan's result holds the Exploration reached.
func (*Registry) External ¶
func (r *Registry) External() []Manifested
External is the engine's manifest entries: every Manifested engine that is not a tool.
func (*Registry) Listings ¶
Listings lists every engine in name order with its description, status and origin; no process is started.
func (*Registry) Probed ¶
Probed lists as Listings does, but starts each external engine's process once and checks its handshake against its manifest, reporting the outcome as the status.
func (*Registry) Prove ¶ added in v0.9.2
Prove puts an element's violation queries to the registry as a Holds question: an unsat proves the claim holds for every assignment of the free features — a proved one when the evaluator rounds the conditions — and a sat witnesses a violation. The plan's result holds the answers in order, and the error is an absent solver.
func (*Registry) Register ¶
Register adds an engine; a second engine with the same name is a typed error, not a silent replacement.
func (*Registry) Select ¶
Select parses a selection and checks that a named engine is registered and served, so a misspelling or a withheld engine is refused where it is written rather than run as a refusal.
func (*Registry) Serving ¶
Serving returns the registry as a service runs it: every manifest engine not named is withheld — listed, refused when selected or reached — and `all` names every one. A name that is not a manifest engine is a NotExternalError; tools and built-ins are served as they are.
func (*Registry) Solve ¶
func (r *Registry) Solve(ctx context.Context, req Request, queries []*solve.Query, ask Asking) (Plan, error)
Solve puts an element's condition sets to the registry under the request's selection, ask being the operation made of each; the request's model is what an engine outside the process is sent, nil when there is none. The plan's result holds the answers in order, and the error is an absent solver.
func (*Registry) Statuses ¶
Statuses lists every engine in name order with the state of its process.
func (*Registry) Sweep ¶
func (r *Registry) Sweep(ctx context.Context, req Request, plan sweep.SweepPlan, row sweep.SweepRun) (Plan, error)
Sweep puts a domain to the registry: row runs the subject once per row of the plan, each in a context of its own the request's model builds; the answered plan's result tables the rows.
func (*Registry) ToolRunner ¶
func (r *Registry) ToolRunner(ctx context.Context, held *runtime.Context, budget Budget, selection Selection) runtime.ToolRunner
ToolRunner is the runner a surface attaches to a context it drives outside any plan — the prompt's action debugger — so a tool-computed action it steps is put to the registry as a Compute question under the selection, as one performed inside a plan is. Divergence between equal-input answers is remembered for as long as the runner is attached.
type Reply ¶ added in v0.9.2
type Reply struct {
// Format names how the reply is read; empty reads the `object` protocol.
Format ReplyFormat `json:"format,omitempty"`
// Source is `stdout` or `file:<template>`; the template may name {outputDir} alone.
Source string `json:"source,omitempty"`
// Outputs maps each tool variable to the selector finding its value; required for
// every format but `object`.
Outputs map[string]*ReplyOutput `json:"outputs,omitempty"`
// Header is whether the first CSV record names the columns; default true.
Header *bool `json:"header,omitempty"`
// Delimiter is the CSV field separator, one rune; default a comma.
Delimiter string `json:"delimiter,omitempty"`
// Regex is an RE2 expression whose named groups are the `lines` outputs.
Regex string `json:"regex,omitempty"`
// Success are the `exitcode` statuses that render true; default [0].
Success []int `json:"success,omitempty"`
// ErrorPath is a `json` pointer to the tool's own refusal message.
ErrorPath string `json:"errorPath,omitempty"`
// ErrorColumn is the `csv` column holding the same.
ErrorColumn *Column `json:"errorColumn,omitempty"`
// ErrorKey is the `lines` key holding the same.
ErrorKey string `json:"errorKey,omitempty"`
// contains filtered or unexported fields
}
Reply is a tool entry's `reply` block: where the reply is read from and where each output is found in it. Absent, or `format: "object"`, the reply is the protocol's JSON object.
type ReplyFormat ¶ added in v0.9.2
type ReplyFormat string
ReplyFormat is how a tool's reply is read once the process has run.
const ( // ReplyObject is the protocol's one JSON object, the default. ReplyObject ReplyFormat = "object" // ReplyJSON reads each output by an RFC 6901 pointer into one JSON value. ReplyJSON ReplyFormat = "json" // ReplyCSV reads each output as a cell of a CSV record. ReplyCSV ReplyFormat = "csv" // ReplyLines reads each output as the value of a `key = value` line or a regex group. ReplyLines ReplyFormat = "lines" // ReplyExitCode is the process's exit status as the one output. ReplyExitCode ReplyFormat = "exitcode" )
type ReplyOutput ¶ added in v0.9.2
type ReplyOutput struct {
// Path is the `json` RFC 6901 pointer to the value; the empty pointer names the document.
Path *string `json:"path,omitempty"`
// Column is the `csv` column: a header name or a zero-based index.
Column *Column `json:"column,omitempty"`
// Row selects among the CSV data records: `first`, `last` or a zero-based index.
Row *Row `json:"row,omitempty"`
// Key is the `lines` key; default the variable's name.
Key string `json:"key,omitempty"`
// Type is what the text is read as; default `number` (`exitcode`: `boolean`).
Type ValueType `json:"type,omitempty"`
// Unit is the value's unit as a fixed expression.
Unit string `json:"unit,omitempty"`
// UnitPath is a `json` pointer to a string holding the unit.
UnitPath string `json:"unitPath,omitempty"`
// UnitColumn is the `csv` column holding the unit, read from the same row.
UnitColumn *Column `json:"unitColumn,omitempty"`
}
ReplyOutput is one output's selector; which fields are read depends on the format.
type Reporter ¶
type Reporter func(ProgressReport)
Reporter takes the progress reports a plan's external engines send, at most one per ProgressInterval per open run; the surface that installs one prints them.
func ReporterFrom ¶
ReporterFrom is the reporter WithReporter installed, nil when none was.
type Request ¶
type Request struct {
Model *Model
Subject string
Schedule runtime.SchedulePolicy
ModelSeed ModelSeed
Draws runtime.DrawPolicy
ClockStep float64
Budget Budget
Selection Selection
}
Request is what every question put to the registry carries: the model it is asked of, the subject, schedule, model seed, draw policy and clock step it runs under, and the budget and selection it is answered with.
type Result ¶
type Result struct {
Question Question
// Engine names who answered, and its version where it has one.
Engine string
// Claim is what is asserted.
Claim Claim
// Strength is how the claim is supported.
Strength Strength
// Bounds is every bound the run took, and which were reached.
Bounds Bounds
// Witness is a schedule the interpreter replays, when the claim has one.
Witness *Witness
// Contrast is the second schedule of a sensitivity: replayed beside Witness, it gives the
// named feature another value. Nil for every other claim.
Contrast *Witness
// Executions are the concrete executions a universal claim was observed on when an
// engine chose them and the interpreter replayed each; nil when none were.
Executions []Witness
// Inputs are the features of the initial state a symbolic engine ranged over
// or pinned, each with its domain and, for a witness, its value.
Inputs []Input
// Assumptions name the constraints assumed over the initial state.
Assumptions []string
// Reason says why, when nothing is claimed: the construct, the unknown,
// the budget, the disagreement.
Reason string
// Scope is the reasons the claim was observed short of the run's quiescence: it
// holds at that point, and its strength stands.
Scope []runtime.ObservationReason
// Values are the feature values, outputs, rows or answers the question asked for.
Values []Evaluation
// Reply is the canonical rendering of every output an external process answered when
// the engine ran one for a Compute; invocations of equal inputs compare by it.
Reply string
Elapsed time.Duration
// Workers is how many workers the plan built for the engine's runs, and Warming the
// time building them took; a plan in the surface's own context builds none.
Workers int
Warming time.Duration
}
Result is what one engine answered to one question.
func (Result) Exploration ¶
func (r Result) Exploration() *runtime.Exploration
Exploration is the outcome set an Outcomes result reached, nil for any other result.
func (Result) Standing ¶
Standing is the line a report prints after a verdict: the claim, the strength it earned, and what earned it — `holds (observed: 1 run under reverse)`, `not covered (<reason>)`.
func (Result) Table ¶
func (r Result) Table() sweep.SweepTable
Table is the rows of a Sweep result as runtime.RunSweep tables them.
type Row ¶ added in v0.9.2
Row selects among the CSV data records.
func (Row) MarshalJSON ¶ added in v0.9.2
MarshalJSON writes the row as it is read: a name, or the index as a JSON integer.
func (*Row) UnmarshalJSON ¶ added in v0.9.2
UnmarshalJSON reads `first`, `last`, `all` or a zero-based index.
type Selection ¶
type Selection struct {
Mode Mode
// Engine is the one engine a SelectNamed selection puts the question to.
Engine string
}
Selection is the engine choice a surface makes: `auto`, `all`, or one engine by name.
func ParseSelection ¶
ParseSelection reads a selection as a flag spells it; empty is `auto`, which is what an unset field means on the wire.
type SessionEndedError ¶
SessionEndedError reports a request after the session ended, with why it ended.
func (*SessionEndedError) Error ¶
func (e *SessionEndedError) Error() string
Error names the engine and the end.
func (*SessionEndedError) Is ¶
func (e *SessionEndedError) Is(target error) bool
Is matches ErrSessionEnded.
func (*SessionEndedError) Unwrap ¶
func (e *SessionEndedError) Unwrap() error
Unwrap is why the session ended.
type SolveAsk ¶
SolveAsk is the queries a satisfiability question puts to a solver, one per condition set, and how each is asked.
type Start ¶
type Start func(*runtime.Context) (*runtime.ActionExecutor, error)
Start begins one run of a behavior in the given context and returns the executor about to run it. An error is a fault of the start, not an outcome of the run.
type Status ¶
type Status struct {
Engine string
// Process names the process found; empty for an in-process engine or an absent one.
Process string
// Err is the absence of the process, nil when the engine can run.
Err error
}
Status is an engine as the registry lists it: for one that needs a process, the process found or the typed error for its absence.
type StdinFormat ¶ added in v0.9.2
type StdinFormat string
StdinFormat is what a tool with an invocation block reads on standard input.
const ( // StdinJSON is the protocol's request object, as a tool without the block reads. StdinJSON StdinFormat = "json" // StdinNone writes nothing. StdinNone StdinFormat = "none" // StdinCSV writes one header row and one row of the inputs sent. StdinCSV StdinFormat = "csv" // StdinTemplate writes the manifest's template, rendered for the call. StdinTemplate StdinFormat = "template" )
type StdinSpec ¶ added in v0.9.2
type StdinSpec struct {
Format StdinFormat
Template string
}
StdinSpec is the `stdin` field: one of the format names as a string, or `{"template": "..."}` for text composed from the call.
func (StdinSpec) MarshalJSON ¶ added in v0.9.2
MarshalJSON writes the spec as it is read.
func (*StdinSpec) UnmarshalJSON ¶ added in v0.9.2
UnmarshalJSON reads the format name or the template object.
type Step ¶
type Step struct {
Engine string
// Refusal is why Covers refused, nil when the engine ran.
Refusal error
// Result is what Run answered, nil when the engine refused, faulted or was cancelled.
Result *Result
// Err is the fault that stopped the plan at this engine: what Run reported, or the
// context's error when it was met before the engine ran or before its answer was taken.
Err error
// Cancelled marks an engine the plan under all stopped before it answered: the one
// that met the deadline, and every one not finished by then.
Cancelled bool
// Bounds is the bound a cancelled engine reached: the plan's deadline, when one was set.
Bounds Bounds
}
Step is one engine's part in a plan: a refusal before running, the result it answered, the fault that stopped the plan, or its cancellation under all.
type Strength ¶
type Strength int
Strength is how a claim is supported, ranked so a greater Strength is never weaker evidence: Proved > Bounded > Witnessed (the one strength of an existential) > Observed > NotCovered.
const ( // NotCovered claims nothing: a refusal, a solver unknown, a budget reached // without completing, a witness that did not replay. NotCovered Strength = iota // Observed means the claim held on the concrete executions that were run, // which fixed something the question left free. Observed // Witnessed means a concrete execution exhibits the claim and the // interpreter has replayed it. Witnessed // Bounded means the claim holds for everything free within the stated // bounds, which the result names. Bounded // Proved means the claim holds for everything the question left free, with // no bound reached. Proved )
func ParseStrength ¶
ParseStrength reads a strength as Strength.String spells it.
type SubjectError ¶
SubjectError reports a question about a subject whose declaration kind is outside the entry's subjects; Family is the kind found, empty for a subject the model does not declare.
func (*SubjectError) Error ¶
func (e *SubjectError) Error() string
Error names the engine, the subject with its kind, and the kinds the engine answers for.
type ToolAbsentError ¶
ToolAbsentError reports a registered tool whose executable is not found.
func (*ToolAbsentError) Error ¶
func (e *ToolAbsentError) Error() string
Error names the tool and its executable.
func (*ToolAbsentError) Is ¶
func (e *ToolAbsentError) Is(target error) bool
Is matches ErrToolAbsent.
func (*ToolAbsentError) Unwrap ¶
func (e *ToolAbsentError) Unwrap() error
Unwrap returns the lookup's report.
type ToolDryRunError ¶ added in v0.9.2
type ToolDryRunError struct {
// Preview is what the call would have been given.
Preview DryRun
// Action is the ToolExecution-annotated action the call was made for.
Action string
}
ToolDryRunError fails the performance a dry run reached a tool call in; surfaces read the preview from it.
func (*ToolDryRunError) Error ¶ added in v0.9.2
func (e *ToolDryRunError) Error() string
Error says the tool was previewed, not run.
func (*ToolDryRunError) Is ¶ added in v0.9.2
func (e *ToolDryRunError) Is(target error) bool
Is matches ErrToolDryRun.
type ToolEntry ¶
type ToolEntry struct {
// File is the manifest entry the tool was read from; empty for one built in code.
File string `json:"-"`
// Kind is `tool` or absent.
Kind EntryKind `json:"kind,omitempty"`
// ToolName is what a ToolExecution's toolName names.
ToolName string `json:"toolName"`
// Version is the tool's, reported beside its executable.
Version string `json:"version,omitempty"`
// Executable runs the tool: an absolute path, a path relative to the manifest directory,
// or a name looked up on PATH.
Executable string `json:"executable"`
// Variables are the ToolVariable names the tool accepts.
Variables []string `json:"variables"`
// Invocation composes the process from the call; nil runs the executable bare with the
// JSON request on standard input.
Invocation *Invocation `json:"invocation,omitempty"`
// Reply says how the process's reply is read; nil reads the protocol's one JSON object
// from standard output.
Reply *Reply `json:"reply,omitempty"`
}
ToolEntry is one entry of the tool manifest: the tool a ToolExecution names, its version, the executable that answers for it, and the tool-variable names it accepts.
func LoadManifest ¶
LoadManifest reads the tool entries of the manifest in dir: every `.json` file is one entry. A directory that cannot be read, an entry that is not one JSON object of its kind's fields, an entry without a toolName, executable or variables, one listing a variable twice, or two entries naming one tool is a ManifestError. Entries come back in tool-name order; entries of the other kinds are read and checked but not returned.
func (ToolEntry) Preview ¶ added in v0.9.2
Preview composes the call for the entry without making a temporary directory or starting anything: {inputFile} and {outputDir} spell their names in angle brackets.
func (ToolEntry) Protocol ¶ added in v0.9.2
Protocol names how the tool is spoken to, as an engine listing reports it: `object` for one JSON object each way, `argv+<stdin>` for a process composed from an invocation block, and for a reply of another format the format alone or `argv+<stdin>/<format>`.
type ToolUse ¶ added in v0.9.2
type ToolUse struct {
Tool, Version, File, Executable string
// Args are the argv entries after the executable, nil for an entry without an
// invocation block.
Args []string
// Stdin is the request an entry without an invocation block read.
Stdin []byte
// Failed is the failure the call ended with, empty when it answered.
Failed string
// contains filtered or unexported fields
}
ToolUse is one tool call a plan made: the entry it went to and what was run.
type ToolVariableError ¶
ToolVariableError reports the tool variables a call uses that the tool's entry does not list.
func (*ToolVariableError) Error ¶
func (e *ToolVariableError) Error() string
Error names the tool and the variables.
func (*ToolVariableError) Is ¶
func (e *ToolVariableError) Is(target error) bool
Is matches ErrToolVariable.
type UnansweredRunError ¶
type UnansweredRunError struct {
Engine string
Progress enginewire.ProgressParams
Err error
}
UnansweredRunError is why a run ended unanswered, with the last progress it reported.
func (*UnansweredRunError) Error ¶
func (e *UnansweredRunError) Error() string
Error names the end and the last progress.
func (*UnansweredRunError) Is ¶
func (e *UnansweredRunError) Is(target error) bool
Is matches ErrUnansweredRun.
func (*UnansweredRunError) Unwrap ¶
func (e *UnansweredRunError) Unwrap() error
Unwrap is the end itself.
type UnknownEngineError ¶
type UnknownEngineError struct {
Name string
// Known is every registered name, so the message can list the choices.
Known []string
}
UnknownEngineError reports a selection naming an engine the registry does not hold.
func (*UnknownEngineError) Error ¶
func (e *UnknownEngineError) Error() string
Error names the engine and lists the registered ones.
func (*UnknownEngineError) Is ¶
func (e *UnknownEngineError) Is(target error) bool
Is matches ErrUnknownEngine.
type ValueType ¶ added in v0.9.2
type ValueType string
ValueType is what an output's text is read as.
const ( // TypeNumber is an Integer when the text is one, else a finite Real. TypeNumber ValueType = "number" // TypeInteger is an Integer alone. TypeInteger ValueType = "integer" // TypeReal is a finite Real, an integer literal included. TypeReal ValueType = "real" // TypeBoolean is `true`/`false`, case-insensitive. TypeBoolean ValueType = "boolean" // TypeString is the text as written. TypeString ValueType = "string" )
type WireValueError ¶
WireValueError names a value the protocol does not carry.
func (*WireValueError) Error ¶
func (e *WireValueError) Error() string
Error names the value and what it holds.
type Witness ¶
type Witness struct {
Schedule runtime.SchedulePolicy
Inputs []runtime.InputTaken
// Draws are the random values the execution drew, in the order drawn.
Draws []runtime.DrawTaken
Choices []runtime.ChoiceTaken
// Written is the file the witness was written to, "" when none was asked for.
Written string
}
Witness is an execution the interpreter replays to exhibit a claim: the policy it ran under, the inputs it fixed before its first move and the choices it took.
type WitnessKind ¶
type WitnessKind string
WitnessKind is the shape of witness an engine's manifest declares it produces.
const ( // WitnessNone declares no replayable witness; an existential claim is then not covered. WitnessNone WitnessKind = "none" // WitnessSchedule declares schedule witnesses in the replay format. WitnessSchedule WitnessKind = "schedule" // WitnessAssignment declares assignment witnesses: values of the free features. WitnessAssignment WitnessKind = "assignment" )
type Worker ¶
type Worker struct {
Model *runtime.Model
// Warming is the time building the worker took: the cost of one more worker.
Warming time.Duration
}
Worker is one model-derived runtime part — resolver, semantic model and the runtime's memo tables — over the shared frozen index; all memoize into plain maps, so a worker serves one plan's runs, one at a time, and never another plan's.
type WrongToolError ¶
WrongToolError reports a Compute question put to the engine of a tool it does not name.
func (*WrongToolError) Error ¶
func (e *WrongToolError) Error() string
Error names the engine and the tool the call named.
Source Files
¶
- ask.go
- check.go
- checklines.go
- checkprops.go
- compose.go
- dispatch.go
- doc.go
- dryrun.go
- engine.go
- engine_entry.go
- explore.go
- external.go
- external_question.go
- external_standing.go
- invocation.go
- jobs.go
- jobs_memory.go
- listing.go
- manifest.go
- process.go
- question.go
- registry.go
- reply.go
- result.go
- run.go
- runs.go
- selection.go
- session.go
- session_unix.go
- solve.go
- standing.go
- sweep.go
- tool.go
- tool_runner.go
- withheld.go
- worker.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package enginewire is the message set an external engine and the host exchange over standard input and output: JSON-RPC 2.0 objects, one per line.
|
Package enginewire is the message set an external engine and the host exchange over standard input and output: JSON-RPC 2.0 objects, one per line. |
|
Package modelform is the forms of a model an external engine reads: the sources form and the versioned graphs:1 form of the lowered action and state graphs.
|
Package modelform is the forms of a model an external engine reads: the sources form and the versioned graphs:1 form of the lowered action and state graphs. |
|
Package record generates the SysML declarations that record an analysis run, a sweep or a Monte-Carlo sample into the model it ran on, as usages of the bundled AnalysisRecords library.
|
Package record generates the SysML declarations that record an analysis run, a sweep or a Monte-Carlo sample into the model it ran on, as usages of the bundled AnalysisRecords library. |