diagnostics

package
v0.0.0-...-2de61a9 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package diagnostics defines the Diagnostic type, severity levels, and the deterministic sort/format rules used to report configuration and generation problems across every validation stage of the pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(d Diagnostic) string

Format renders a single Diagnostic in the textual shape documented by contracts/diagnostics-contract.md's example:

error: contexts.content.models.User.operations.insert

query CreateUser uses :exec, but the default insert lifecycle requires
:one so the persisted row can hydrate generated fields.

Hint: add RETURNING ... and change the annotation to :one, or select an
explicit non-hydrating insert policy when that policy becomes supported.

func FormatAll

func FormatAll(diags []Diagnostic) string

FormatAll renders a sorted diagnostic list as the plugin's full textual error output, one diagnostic per paragraph.

func HasError

func HasError(diags []Diagnostic) bool

HasError reports whether diags contains at least one SeverityError diagnostic. Any single error means zero files are emitted for the run (FR-017) — this is the atomicity check used by internal/plan and the top-level generation pipeline.

Types

type Diagnostic

type Diagnostic struct {
	Severity Severity
	Path     string
	Context  string
	Model    string
	Relation string
	Query    string
	Message  string
	Hint     string
}

Diagnostic reports a single problem found by any validation stage in the pipeline. See contracts/diagnostics-contract.md for the authoritative shape and failure semantics.

func Sort

func Sort(diags []Diagnostic) []Diagnostic

Sort orders diagnostics deterministically by (Path, Context, Model, Query) ascending, per contracts/diagnostics-contract.md's Ordering section. It sorts in place and also returns the slice for convenience.

type Severity

type Severity uint8

Severity classifies a Diagnostic as blocking (Error) or advisory (Warning).

const (
	SeverityWarning Severity = iota
	SeverityError
)

func (Severity) String

func (s Severity) String() string

Jump to

Keyboard shortcuts

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