report

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package report renders scan and classification results for humans and machines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadJSON

func ReadJSON(r io.Reader, v any) error

ReadJSON deserialises a previously written report.

func WriteDigest

func WriteDigest(w io.Writer, res ClassifiedResult, windowDays int) error

WriteDigest renders a short periodic summary, the format intended for a scheduled workflow that posts into an issue or a chat channel.

Deliberately compact: a weekly digest that nobody reads is worse than none, so it leads with the single number that matters and the worst offenders.

func WriteIssue

func WriteIssue(w io.Writer, res ClassifiedResult) error

WriteIssue renders a ready-to-paste GitHub issue body.

Grouped by category rather than listed flat: a maintainer triaging flakes wants "here are the four network timeouts" as one decision, not four separate ones. Within a group the highest-confidence occurrence leads.

func WriteJSON

func WriteJSON(w io.Writer, v any) error

WriteJSON serialises any result type as indented JSON.

func WriteMarkdown

func WriteMarkdown(w io.Writer, res ClassifiedResult) error

WriteMarkdown renders a full classification report.

Types

type Classified

type Classified struct {
	Occurrence detector.FlakyOccurrence `json:"occurrence"`
	Verdict    verdict.Verdict          `json:"verdict"`
	StepName   string                   `json:"step_name"`
	ExcerptLen int                      `json:"excerpt_len"`
	// Error records a classification that failed, so a partial run is still
	// reportable rather than being thrown away entirely.
	Error string `json:"error,omitempty"`
}

Classified pairs an occurrence with the verdict returned for it.

type ClassifiedResult

type ClassifiedResult struct {
	Repo        string    `json:"repo"`
	Source      string    `json:"source"`
	GeneratedAt time.Time `json:"generated_at"`
	Provider    string    `json:"provider"`
	Model       string    `json:"model"`
	// Baseline marks output produced by the rule-based provider, so no report
	// can present it as a language model's work.
	Baseline bool         `json:"baseline"`
	Items    []Classified `json:"items"`
}

ClassifiedResult is what `flakehunter classify` writes and `report` consumes.

func (ClassifiedResult) CountsByCategory

func (r ClassifiedResult) CountsByCategory() map[verdict.Category]int

CountsByCategory tallies verdicts for summary tables.

func (ClassifiedResult) ProviderLabel

func (r ClassifiedResult) ProviderLabel() string

ProviderLabel describes the classifier for report headers, marking the baseline explicitly.

type ScanResult

type ScanResult struct {
	Repo        string                     `json:"repo"`
	Source      string                     `json:"source"`
	GeneratedAt time.Time                  `json:"generated_at"`
	WindowDays  int                        `json:"window_days"`
	Summary     detector.Summary           `json:"summary"`
	Occurrences []detector.FlakyOccurrence `json:"occurrences"`
}

ScanResult is what `flakehunter scan` writes and `classify` consumes.

Jump to

Keyboard shortcuts

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