benchmark

package
v0.1.50 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package benchmark parses and validates code-review benchmark suites.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalid means a benchmark suite is malformed or violates the schema.
	ErrInvalid = errors.New("benchmark: invalid")
)

Functions

func Normalize

func Normalize(suite *SuiteFile)

Normalize trims user-facing scalar fields in a suite document.

func Select

func Select(suite SuiteFile, candidateIDs, caseIDs []string) ([]Candidate, []Case, error)

Select returns suite-order candidates and cases after optional ID filtering.

func Validate

func Validate(suite SuiteFile, cfg config.File) error

Validate checks suite schema and profile/case compatibility without running reviews.

Types

type Anchor

type Anchor struct {
	ID    string `yaml:"id" json:"id"`
	File  string `yaml:"file" json:"file"`
	Side  string `yaml:"side" json:"side"`
	Lines []int  `yaml:"lines" json:"lines"`
}

Anchor is optional non-scoring placement metadata for a case.

type Candidate

type Candidate struct {
	ID             string   `yaml:"id" json:"id"`
	Profile        string   `yaml:"profile" json:"profile"`
	Model          string   `yaml:"model,omitempty" json:"model,omitempty"`
	Effort         string   `yaml:"effort,omitempty" json:"effort,omitempty"`
	AgentDirs      []string `yaml:"agent_dirs,omitempty" json:"agent_dirs,omitempty"`
	MaxAgents      int      `yaml:"max_agents,omitempty" json:"max_agents,omitempty"`
	MaxConcurrency int      `yaml:"max_concurrency,omitempty" json:"max_concurrency,omitempty"`
	// contains filtered or unexported fields
}

Candidate is one review configuration to try against each selected case.

func (*Candidate) UnmarshalYAML

func (c *Candidate) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML accepts the canonical agent_dirs field and the draft agents_dir alias, but rejects documents that use both on the same candidate.

type Case

type Case struct {
	ID              string   `yaml:"id" json:"id"`
	PR              string   `yaml:"pr" json:"pr"`
	ExpectedBaseSHA string   `yaml:"expected_base_sha,omitempty" json:"expected_base_sha,omitempty"`
	ExpectedHeadSHA string   `yaml:"expected_head_sha,omitempty" json:"expected_head_sha,omitempty"`
	Anchors         []Anchor `yaml:"anchors,omitempty" json:"anchors,omitempty"`
	// contains filtered or unexported fields
}

Case is one pull request to review during a benchmark.

func (*Case) UnmarshalYAML

func (c *Case) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML tracks optional SHA field presence so explicitly blank values can be rejected after normalization.

type Suite

type Suite struct {
	ID      string `yaml:"id" json:"id"`
	Name    string `yaml:"name,omitempty" json:"name,omitempty"`
	Version int    `yaml:"version,omitempty" json:"version,omitempty"`
}

Suite identifies a collection of benchmark cases and candidates.

type SuiteFile

type SuiteFile struct {
	Path       string      `yaml:"-" json:"-"`
	Suite      Suite       `yaml:"suite" json:"suite"`
	Candidates []Candidate `yaml:"candidates" json:"candidates"`
	Cases      []Case      `yaml:"cases" json:"cases"`
}

SuiteFile is one benchmark suite document.

func Load

func Load(data []byte) (SuiteFile, error)

Load parses a benchmark suite document.

func LoadFile

func LoadFile(path string) (SuiteFile, error)

LoadFile reads and parses a benchmark suite file.

Jump to

Keyboard shortcuts

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