minimizer

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package minimizer implements bounded, deterministic delta debugging over already captured and redacted artifacts. Live callers must provide their own network authorization and budget before constructing a Predicate.

Index

Constants

This section is empty.

Variables

View Source
var ErrBudgetExhausted = errors.New("minimization evaluation budget exhausted")

Functions

This section is empty.

Types

type Options

type Options struct {
	Attempts       int
	RequiredPasses int
	MaxEvaluations int
}

type Predicate

type Predicate[T any] func(context.Context, []T) (bool, error)

type Result

type Result[T any] struct {
	Items       []T    `json:"items"`
	Status      Status `json:"status"`
	ReasonCode  string `json:"reason_code,omitempty"`
	Evaluations int    `json:"evaluations"`
	Attempts    int    `json:"attempts"`
	Required    int    `json:"required_passes"`
}

func DDMin

func DDMin[T any](ctx context.Context, input []T, predicate Predicate[T], options Options) (Result[T], error)

DDMin removes contiguous partitions until no remaining complement reproduces. A candidate is accepted only when k-of-n predicate attempts reproduce; errors and mixed evidence are preserved as inconclusive.

func RemoveJSONObjectKeys

func RemoveJSONObjectKeys(ctx context.Context, input map[string]any, orderedKeys []string, predicate func(context.Context, map[string]any) (bool, error), options Options) (map[string]any, Result[string], error)

RemoveJSONObjectKeys applies DDMin to a stable list of JSON-object keys. The predicate receives a fresh shallow map for each evaluation.

type Status

type Status string
const (
	StatusMinimized    Status = "minimized"
	StatusUnchanged    Status = "unchanged"
	StatusInconclusive Status = "inconclusive"
)

Jump to

Keyboard shortcuts

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