Help us shape the future of Go! Take the 2026 Go Developer Survey

report

package
v0.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteJSON

func WriteJSON(w io.Writer, r Run) error

WriteJSON writes r as indented JSON. Durations are written as milliseconds (duration_ms, grace_ms).

func WriteJUnit

func WriteJUnit(w io.Writer, r Run) error

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

func WriteMarkdown(w io.Writer, r Run) error

WriteMarkdown writes r as a Markdown summary (for digests, PR comments and CI job summaries).

func WriteText

func WriteText(w io.Writer, r Run) error

WriteText writes r as indented plain lines: a header, the node tree, then warnings, notes and the abort reason.

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.

func (Abort) MarshalJSON

func (a Abort) MarshalJSON() ([]byte, error)

MarshalJSON adds grace_ms.

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

func (a Attempt) MarshalJSON() ([]byte, error)

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.

func (Hook) MarshalJSON

func (h Hook) MarshalJSON() ([]byte, error)

MarshalJSON adds duration_ms.

type Lane

type Lane struct {
	Label string `json:"label"`
	Nodes []Node `json:"nodes"`
}

Lane is one group of a container's children.

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
	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).

func (Node) MarshalJSON

func (n Node) MarshalJSON() ([]byte, error)

MarshalJSON adds duration_ms.

type Note

type Note struct {
	Path string `json:"path"`
	Text string `json:"text"`
}

Note is the text of a note node.

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"`
	Status     string        `json:"status"`
	Seed       uint64        `json:"seed"`
	Started    time.Time     `json:"started,omitzero"`
	Duration   time.Duration `json:"-"`
	Nodes      []Node        `json:"nodes"`
	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).

func (Run) Find

func (r Run) Find(path string) (Node, bool)

Find returns the node with path, searching lanes and hooks.

func (Run) Leaves

func (r Run) Leaves() []Node

Leaves returns every non-container node, depth-first in list order. Nodes inside hooks belong to their request node and are not included.

func (Run) MarshalJSON

func (r Run) MarshalJSON() ([]byte, error)

MarshalJSON adds duration_ms.

type VersionUse

type VersionUse struct {
	Path        string `json:"path"`
	RequestID   string `json:"request_id"`
	RequestPath string `json:"request_path"`
	Version     string `json:"version"`
	Source      string `json:"source"`
}

VersionUse records which version of a request a node ran.

Jump to

Keyboard shortcuts

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