flowrun

package
v1.138.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package flowrun draws one run of a script on the flow graph of the version it executed (#1907): which cards the run reached, the audited calls each made and how long they took, what each wrote, and the card the run failed at. Calls are attributed by their call site (internal/scriptcallsite), which the graph records on each card and the run records on each call.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call struct {
	CallSite      []string
	Tool          string
	DurationMS    int64
	Success       bool
	Error         string
	ResponseChars int
	// At is when the call started.
	At time.Time
}

Call is one audited tool call a run made, as the overlay reads it.

type NodeRun

type NodeRun struct {
	// Calls is the audited tool calls attributed to the card, and DurationMS
	// their total time. ResponseChars is the size of what they answered.
	Calls         int   `json:"calls"`
	DurationMS    int64 `json:"duration_ms"`
	ResponseChars int   `json:"response_chars"`
	// Outputs, Rows and Bytes are what the card wrote, from the run's outputs.
	Outputs int `json:"outputs"`
	Rows    int `json:"rows"`
	// FailedCalls counts the card's calls that did not succeed, which a run
	// can outlive: a rate-limited call is refused and made again. The last
	// one's message is LastError.
	FailedCalls int    `json:"failed_calls"`
	LastError   string `json:"last_error,omitempty"`
	// Reached is true when the run made the card's call at least once.
	Reached bool `json:"reached"`
	// Failed is true on the card the run failed at, with Error its message.
	Failed bool   `json:"failed"`
	Error  string `json:"error,omitempty"`
}

NodeRun is what one card did in one run.

type OtherCall

type OtherCall struct {
	Tool       string   `json:"tool"`
	DurationMS int64    `json:"duration_ms"`
	Success    bool     `json:"success"`
	Error      string   `json:"error,omitempty"`
	CallSite   []string `json:"call_site,omitempty"`
}

OtherCall is an audited call the diagram has no card for: a tool the source computes, a call a run made before call sites were recorded, or a call from a lambda.

type Overlay

type Overlay struct {
	Nodes map[string]NodeRun `json:"nodes"`
	// Other lists the audited calls no card made, so the calls on the diagram
	// and Other always add up to the run's audited calls.
	Other []OtherCall `json:"other_calls"`
	// Calls is the run's audited tool calls, every one of them.
	Calls int `json:"calls"`
	// FailedNode is the card the run failed at, empty when it did not fail at
	// a platform call (or did not fail).
	FailedNode string `json:"failed_node,omitempty"`
	// StructureFailed is the Structure view's node or box the run failed at
	// (#1972): the fail() or the call its backtrace ends in, or else the
	// innermost helper expansion the failing line is in.
	StructureFailed string `json:"structure_failed,omitempty"`
	// Unplaced is true when the run made calls and none of them recorded
	// where in the script it was made (a run made before call sites were
	// recorded), so no call can be drawn on a card.
	Unplaced bool `json:"unplaced"`
	// Timeline is every audited call in the order it was made, for the
	// Timeline view (#1972), and RunMS the run's length.
	Timeline []TimedCall `json:"timeline"`
	RunMS    int64       `json:"run_ms"`
}

Overlay is one run drawn on its version's graph (#1907).

func Draw

func Draw(g scriptflow.Graph, calls []Call, facts RunFacts) Overlay

Draw attributes a run's audited calls, outputs and failure to the cards of its version's graph.

type RunFacts

type RunFacts struct {
	Status string
	Cause  string
	// Error is the run's failure text: a script failure's backtrace, which
	// names where it failed.
	Error      string
	Outputs    []script.RunOutput
	StateSaved bool
	HasResult  bool
	// StartedAt and FinishedAt bound the run in time; zero when it has not
	// started or not finished.
	StartedAt  time.Time
	FinishedAt time.Time
}

RunFacts is what the run record says about how the run went.

type TimedCall added in v1.138.1

type TimedCall struct {
	StartMS       int64    `json:"start_ms"`
	DurationMS    int64    `json:"duration_ms"`
	Tool          string   `json:"tool"`
	Success       bool     `json:"success"`
	Error         string   `json:"error,omitempty"`
	ResponseChars int      `json:"response_chars"`
	CallSite      []string `json:"call_site,omitempty"`
	// Node is the card the call was attributed to, empty for an other call.
	Node string `json:"node,omitempty"`
}

TimedCall is one call placed in time: StartMS after the run started.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL