audit

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package audit implements FR-CLI-07: an audit record of every run — trigger source, target, parameters, and timestamp — appended to a local, append-only JSONL file. It never leaves the local machine (see NFR-05); nothing in this package makes a network call.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(path string, e Entry) error

Append writes e as one JSON line to path, creating the file and its parent directory if needed. A failure here is deliberately non-fatal to the caller's run — see cmd/vegaload's run.go, which logs a warning rather than failing the run itself when Append errors, the same way memory/telemetry failures are treated as best-effort elsewhere.

func DefaultPath

func DefaultPath() string

DefaultPath is where a run's audit record is appended when the caller does not override it (cmd/vegaload's -audit-log flag). It lives under the user's home directory so it accumulates across projects/repos, the way a shell history file does.

Types

type Entry

type Entry struct {
	Time         time.Time     `json:"time"`
	Trigger      string        `json:"trigger"`
	Target       string        `json:"target,omitempty"`
	Protocol     string        `json:"protocol,omitempty"`
	ScenarioPath string        `json:"scenario_path,omitempty"`
	Executor     string        `json:"executor"`
	VUs          int           `json:"vus"`
	Duration     time.Duration `json:"duration_ns"`
	Rate         float64       `json:"rate,omitempty"`
	Outcome      string        `json:"outcome"` // "success" or "error"
	Error        string        `json:"error,omitempty"`
	Total        int64         `json:"total,omitempty"`
	Failed       int64         `json:"failed,omitempty"`

	// Thresholds are the pass/fail thresholds the run was given
	// (FR-CLI-11), as text, and whether they all passed.
	Thresholds       []string `json:"thresholds,omitempty"`
	ThresholdsPassed *bool    `json:"thresholds_passed,omitempty"`

	// Baseline is the report a run was compared with (FR-CLI-14), and
	// whether the run stayed within the allowed regression.
	Baseline       string `json:"baseline,omitempty"`
	BaselinePassed *bool  `json:"baseline_passed,omitempty"`
}

Entry is one audit record. Trigger identifies what started the run: "cli" for a human running vegaload directly, or "mcp:<session-id>" when the MCP server's run_test tool drove it (see internal/mcp, Phase 2) — either way it is the caller's job to set Trigger correctly, this package just records whatever it is given.

Jump to

Keyboard shortcuts

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