report

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package report turns a reconcile's failures into a compact, styled end-of-run summary: the real (primary) errors shown once, every cascaded failure folded under the root that caused it, and any deferred log lines in a quiet footer. It exists so a single missing or failed dependency reads as one root cause with a list of what it blocked — not a wall of nested, repeated "dependencies failed: A: dependencies failed: B: …" chains.

The model is built from orchestrator data (Result.Failed + Result.Blocked) and is pure/deterministic; rendering is gated on a color bool so it is plain and testable off a TTY. Styling reuses internal/style, the vocabulary the live status bar and `flate test` report already speak.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MessageLines

func MessageLines(s string) []string

MessageLines splits a stored failure message into trimmed, non-empty lines. Shared with the test runner so a multi-line build/template diagnostic renders the same way on both surfaces.

func Roots

Roots inverts a blocked graph into root cause → the resources that trace to it. blocked maps each derived failure to the immediate dependencies that blocked it; a root is any id reached by walking those blockers that is not itself blocked (a primary failure, or a dependency missing from the graph). Shared by Build and the test runner so both fold a cascade under the same root with identical walk semantics.

Types

type Missing

type Missing struct {
	ID         manifest.NamedResource
	RequiredBy []manifest.NamedResource
}

Missing is a dependency that never rendered (absent from the store) yet was required by one or more resources — the other kind of root cause. RequiredBy lists the resources blocked on it (sorted).

type Model

type Model struct {
	Primary []Primary
	Missing []Missing
	Notes   []Note
	// Blocked is the count of distinct derived (cascaded) failures. It is the
	// verdict's "N blocked" figure — distinct resources, not the sum of the
	// per-root Blocks/RequiredBy lists, which can overlap when one resource
	// traces to more than one root (e.g. a failed parent AND a missing dep).
	Blocked int
}

Model is the partitioned, deterministic view the renderer consumes.

func Build

func Build(failed map[manifest.NamedResource]store.StatusInfo, blocked map[manifest.NamedResource][]manifest.NamedResource, notes []Note) Model

Build partitions failures into primary errors and root-grouped cascades. failed is Result.Failed (sentinel-trimmed messages); blocked is Result.Blocked (a failed id → the immediate deps that blocked it, empty for primaries); notes are the deferred log lines for the footer.

A blocked resource is folded into the root(s) it traces to: walking its blockers until reaching a primary failure (a failed id that is not itself blocked) or a missing id (absent from failed). Cascaded resources never get their own line — they appear only in a root's Blocks / RequiredBy list.

func (Model) Empty

func (m Model) Empty() bool

Empty reports whether there is nothing to render.

func (Model) Write

func (m Model) Write(w io.Writer, color bool, elapsed time.Duration) error

Write renders the model to w. color gates ANSI styling; elapsed, when > 0, closes the verdict line.

type Note

type Note struct {
	Text  string
	Count int
}

Note is one deferred log line for the footer, collapsed by identical text with a repeat count.

type Primary

type Primary struct {
	ID     manifest.NamedResource
	Msg    string
	Blocks []manifest.NamedResource
}

Primary is a resource that failed on its own — a real render/template/build error. Blocks lists the resources whose failure cascaded from it (sorted).

Jump to

Keyboard shortcuts

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