finding

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package finding is Veritix's report currency: one problem found in a dataset, with the evidence that proves it.

Every finding carries a re-runnable query. That is the whole design: a deterministic check and an agent-authored observation produce the same kind of object, and both can be verified by running their evidence again. A finding whose evidence no longer reproduces is dropped rather than reported, which is what makes an agentic auditor trustworthy instead of merely plausible.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Evidence

type Evidence struct {
	// CountQuery re-measures the finding. Required.
	CountQuery string
	// RowQuery retrieves the affected rows for a human to inspect.
	RowQuery string
	// Expected describes what should have been true, in words.
	Expected string
	// Observed describes what was actually found, in words.
	Observed string
}

Evidence is the proof behind a finding.

CountQuery must return exactly one row and one integer column: the number of affected rows or values. It is what Verify re-runs. RowQuery, when set, returns the offending rows themselves; it is never run automatically, because its results are raw customer data.

type Finding

type Finding struct {
	// Rule identifies the check, e.g. "column.mixed_date_formats". Stable
	// across releases so that findings can be suppressed and tracked.
	Rule     string
	Severity Severity
	Origin   Origin

	// Title is one specific line: what is wrong, with numbers.
	Title string
	// Detail explains why it matters, in terms of what will go wrong
	// downstream rather than in terms of the check that fired.
	Detail string
	// Remedy is what to do about it.
	Remedy string

	Location Location

	// Count is how many rows or values are affected, and Total is how many
	// there were. Both feed the report and Verify.
	Count int64
	Total int64

	Evidence Evidence

	// Verified records that the evidence was re-run and reproduced.
	Verified bool
}

Finding is one problem, with its evidence.

func (Finding) ID

func (f Finding) ID() string

ID is a stable, URL-safe handle for a finding.

It is a digest of the same key that de-duplicates findings, so it depends on what the finding is about and not on where it landed in a list. That matters because the API addresses findings by id — `/findings/{id}/rows` — and a positional id would point at a different problem after a re-run that found one more error. It is a digest rather than the key itself because the key contains customer column names, and an id ends up in URLs and access logs.

func (Finding) Share

func (f Finding) Share() float64

Share is the affected proportion, for reports.

type Location

type Location struct {
	// Table is the SQL name of the table.
	Table string
	// Display is the human-readable origin, e.g. "sales.xlsx#Q1".
	Display string
	// Column is the column, when the finding is about one.
	Column string
	// File is the path relative to the dataset root.
	File string
	// Line is a line number in the source file, where one applies.
	Line int64
}

Location says where in the dataset a finding sits.

func (Location) String

func (l Location) String() string

String renders a location compactly.

type Origin

type Origin string

Origin records what produced a finding, so a reader can weigh it.

const (
	// OriginCheck is one of Veritix's built-in deterministic checks.
	OriginCheck Origin = "check"
	// OriginRule is a rule the customer wrote.
	OriginRule Origin = "rule"
	// OriginAgent is a model-proposed finding. It is still backed by
	// evidence, and that evidence is re-run before it is reported.
	OriginAgent Origin = "agent"
)

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set accumulates findings and keeps them ordered and unique.

func NewSet

func NewSet() *Set

NewSet returns an empty set.

func (*Set) Add

func (s *Set) Add(f Finding)

Add records a finding, keeping the more severe of any duplicate pair.

func (*Set) AddAll

func (s *Set) AddAll(fs []Finding)

AddAll records several findings.

func (*Set) All

func (s *Set) All() []Finding

All returns the findings, most severe first, then by location so that two runs over the same data produce the same report.

func (*Set) Counts

func (s *Set) Counts() map[Severity]int

Counts totals the findings by severity.

func (*Set) Len

func (s *Set) Len() int

Len is how many findings the set holds.

func (*Set) Max

func (s *Set) Max() (Severity, bool)

Max returns the highest severity present, and whether there were any findings at all.

func (*Set) Verify

func (s *Set) Verify(ctx context.Context, e *engine.Engine) (dropped []Finding, err error)

Verify re-runs every finding's count query and marks those that reproduce.

Findings that no longer reproduce are removed. This is what lets Veritix accept observations from a language model without accepting its arithmetic: the model chooses what to look at, but a number only reaches the report if the engine produces it.

type Severity

type Severity int

Severity is how much a finding matters.

const (
	// Info is worth knowing but not necessarily wrong.
	Info Severity = iota
	// Warning is likely wrong, or right but fragile.
	Warning
	// Error is data that cannot be correct.
	Error
)

func ParseSeverity

func ParseSeverity(s string) (Severity, error)

ParseSeverity reads a severity name, for the --fail-on flag and rule files.

func (Severity) MarshalText

func (s Severity) MarshalText() ([]byte, error)

MarshalText renders a severity in JSON.

func (Severity) String

func (s Severity) String() string

String renders a severity for reports.

func (*Severity) UnmarshalText

func (s *Severity) UnmarshalText(b []byte) error

UnmarshalText parses a severity from JSON or YAML.

Jump to

Keyboard shortcuts

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