preprocess

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package preprocess provides filters and transformations for workflow run data that must be applied before any statistical analysis.

Index

Constants

View Source
const (
	CategoryPR   = "pr"
	CategoryMain = "main"
	CategoryAll  = "all"
)

Run trigger categories for FilterByEventCategory — the shared vocabulary of the app layer's BranchCategory option and the CLI's --branch-category flag.

Variables

This section is empty.

Functions

func ComputeRerunStats

func ComputeRerunStats(details []model.RunDetail) map[int64]RerunStats

ComputeRerunStats computes per-workflow retry statistics from unfiltered data. Must be called before DeduplicateRetries. Returns only workflows that had at least one retry.

func DeduplicateRetries

func DeduplicateRetries(details []model.RunDetail) []model.RunDetail

DeduplicateRetries keeps only the latest attempt for each run ID. GitHub Actions creates new run_attempt numbers for re-runs but keeps the same run ID.

func ExcludeFailures

func ExcludeFailures(details []model.RunDetail) []model.RunDetail

ExcludeFailures keeps only runs with conclusion "success".

func ExcludeRerunAttempts added in v0.27.0

func ExcludeRerunAttempts(details []model.RunDetail) []model.RunDetail

ExcludeRerunAttempts keeps only first attempts.

func FilterByBranch

func FilterByBranch(details []model.RunDetail, branch string) []model.RunDetail

FilterByBranch keeps only runs from the specified branch.

func FilterByEventCategory added in v0.27.0

func FilterByEventCategory(details []model.RunDetail, category string) []model.RunDetail

FilterByEventCategory selects runs by trigger category: CategoryPR keeps pull_request-event runs, CategoryMain keeps everything else (pushes, schedules, manual dispatches — the default-branch style of traffic).

func ParseMatrixJobName

func ParseMatrixJobName(name string) (base, variant string)

ParseMatrixJobName splits a job name like "test (ubuntu-latest, 20)" into base="test" and variant="ubuntu-latest, 20". If there are no parentheses, variant is empty.

func Run

func Run(details []model.RunDetail, opts Options) (result []model.RunDetail, warnings []diag.Diagnostic)

Run applies all preprocessing steps in order and returns the filtered results.

Types

type Options

type Options struct {
	Branch          string // filter to this branch (empty = no filter)
	IncludeFailures bool   // if false, exclude non-success conclusions
}

Options controls which preprocessing steps are applied.

type RerunStats

type RerunStats struct {
	UniqueRuns    int     // distinct run IDs
	RetriedRuns   int     // runs with more than 1 attempt
	ExtraAttempts int     // total extra attempts (sum of max_attempt - 1 per retried run)
	RerunRate     float64 // fraction of unique runs that were retried
}

RerunStats holds retry statistics for a workflow.

Jump to

Keyboard shortcuts

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