Documentation
¶
Overview ¶
Package report holds the result of a run as a tree — nodes, their hooks and attempts, container lanes — and writes it as JSON, JUnit XML, Markdown or plain text. It is pure data and formatting: the engine builds the tree from its events; this package never imports it.
Everything in a report is already masked by whoever built it.
Index ¶
- func WriteJSON(w io.Writer, r Run) error
- func WriteJUnit(w io.Writer, r Run) error
- func WriteMarkdown(w io.Writer, r Run) error
- func WriteMermaid(w io.Writer, r Run) error
- func WriteText(w io.Writer, r Run) error
- type Abort
- type Attempt
- type Diagnostic
- type Hook
- type Lane
- type Node
- type Note
- type OutputValue
- type Run
- type Sequence
- type SequenceStep
- type VersionUse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteJSON ¶
WriteJSON writes r as indented JSON. Durations are written as milliseconds (duration_ms, grace_ms).
func WriteJUnit ¶
WriteJUnit writes r as JUnit XML. Statuses map as: failed → <failure>, error and aborted → <error>, skipped and cancelled → <skipped>. Handled failures pass, with their diagnostics in <system-err>.
func WriteMarkdown ¶
WriteMarkdown writes r as a Markdown summary (for digests, PR comments and CI job summaries).
func WriteMermaid ¶
WriteMermaid writes r as a Mermaid sequence diagram of what actually happened: Flowi and one participant for each host it called, an arrow out and an arrow back for each attempt (with its status and time), and a note for a step that is not a call and failed. It is the living picture of a run, drawn from the report, so it cannot drift from the flow the way a hand-drawn diagram does. Only the host and path of a URL are shown: the query string can hold a credential.
Types ¶
type Abort ¶
type Abort struct {
Reason string `json:"reason"`
Grace time.Duration `json:"-"`
Inflight []string `json:"inflight"`
}
Abort says why a cancelled run was forced to stop.
type Attempt ¶
type Attempt struct {
N int `json:"n"`
Method string `json:"method"`
URL string `json:"url"`
Status int `json:"status,omitempty"`
Error string `json:"error,omitempty"`
Duration time.Duration `json:"-"`
}
Attempt is one HTTP attempt of a request.
func (Attempt) MarshalJSON ¶
MarshalJSON adds duration_ms.
type Diagnostic ¶
type Diagnostic struct {
Code string `json:"code"`
Severity string `json:"severity,omitempty"`
Message string `json:"message"`
File string `json:"file,omitempty"`
Line int `json:"line,omitempty"`
Column int `json:"column,omitempty"`
}
Diagnostic is a diagnostic with its message already rendered.
type Hook ¶
type Hook struct {
Phase string `json:"phase"`
Level string `json:"level"`
Step string `json:"step"`
Index int `json:"index"`
Status string `json:"status"`
Duration time.Duration `json:"-"`
Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
Nodes []Node `json:"nodes,omitempty"`
}
Hook is one API hook step of a request node.
type Node ¶
type Node struct {
Path string `json:"path"`
ID string `json:"id"`
Type string `json:"type"`
Name string `json:"name,omitempty"`
Status string `json:"status"`
Handled bool `json:"handled,omitempty"` // failed, but on_error let the run continue
Reason string `json:"reason,omitempty"` // why a skipped node was skipped, when the person chose it
Started time.Time `json:"started,omitzero"`
Duration time.Duration `json:"-"`
Outputs map[string]any `json:"outputs,omitempty"`
Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
Attempts []Attempt `json:"attempts,omitempty"`
Hooks []Hook `json:"hooks,omitempty"`
Lanes []Lane `json:"lanes,omitempty"`
}
Node is one node instance. Containers group their children in Lanes (batch iterations, parallel branches, the chosen condition branch).
type OutputValue ¶
type OutputValue struct {
Name string `json:"name"`
Type string `json:"type,omitempty"`
Value any `json:"value"`
}
OutputValue is one declared output of a finished run.
type Run ¶
type Run struct {
ID string `json:"id"`
Kind string `json:"kind"` // "flow" or "send"
FlowID string `json:"flow_id,omitempty"`
FlowPath string `json:"flow_path,omitempty"`
FlowName string `json:"flow_name,omitempty"`
Collection string `json:"collection,omitempty"`
Env string `json:"env,omitempty"`
// Overlay is the run-level flowi overlay the run was started with, if any.
Overlay string `json:"overlay,omitempty"`
Status string `json:"status"`
Seed uint64 `json:"seed"`
Started time.Time `json:"started,omitzero"`
Duration time.Duration `json:"-"`
Nodes []Node `json:"nodes"`
// Vars are the flow's variables when the run ended, masked: what a later
// partial run needs to carry on from here.
Vars map[string]any `json:"vars,omitempty"`
// Outputs are the flow's declared outputs as the run ended, in declared
// order and masked. One that could not be worked out (the run failed
// before it had its value) is left out, never filled with a wrong value.
Outputs []OutputValue `json:"outputs,omitempty"`
Warnings []Diagnostic `json:"warnings,omitempty"`
Notes []Note `json:"notes,omitempty"`
Versions []VersionUse `json:"versions,omitempty"`
Aborted *Abort `json:"aborted,omitempty"`
}
Run is the report of one run (a flow run or a standalone send).
type Sequence ¶
type Sequence struct {
Title string
Hosts []string // the hosts the run called, in the order it first called them; Flowi is implied
Steps []SequenceStep
}
Sequence is a run drawn as a sequence diagram, as data: a window can draw it, WriteMermaid writes it as text.
func SequenceOf ¶
SequenceOf draws the run: every attempt of every request in the order it happened, loops and hooks included.
type SequenceStep ¶
SequenceStep is one arrow or note. Kind is "call" (Flowi to Host), "reply" (Host back to Flowi) or "note" (Host is -1). Failed marks a refusal, an error or a step that failed.