comparisons

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package comparisons coordinates fair same-model, multi-channel evaluations.

Index

Constants

View Source
const CurrentSnapshotSchemaVersion = 1

Variables

View Source
var (
	ErrInvalid         = errors.New("comparisons: invalid input")
	ErrNotReady        = errors.New("comparisons: selected channels are not comparable")
	ErrTargetUnmapped  = errors.New("comparisons: model is not mapped to a selected channel")
	ErrChannelNotReady = errors.New("comparisons: a selected channel is not ready")
)

Functions

This section is empty.

Types

type ChannelResult

type ChannelResult struct {
	ChannelID   string                        `json:"channel_id"`
	ChannelName string                        `json:"channel_name"`
	RunID       string                        `json:"run_id"`
	RunStatus   domain.RunStatus              `json:"run_status"`
	ReportReady bool                          `json:"report_ready"`
	Passed      bool                          `json:"passed"`
	Verdict     string                        `json:"verdict"`
	Metrics     map[string]domain.MetricValue `json:"metrics"`
}

type Clock

type Clock interface{ Now() time.Time }

type Dependencies

type Dependencies struct {
	Repository  Repository
	Runner      Runner
	Clock       Clock
	MetaFactory MetaFactory
}

type ExecutionRepository

type ExecutionRepository interface {
	GetComparison(context.Context, string) (domain.Comparison, error)
	IsLocalComparison(context.Context, string) (bool, error)
	UpdateComparison(context.Context, uint64, domain.Comparison) error
}

type History

type History struct {
	// contains filtered or unexported fields
}

func NewHistory

func NewHistory(repository HistoryRepository, refresher *Refresher) *History

func (*History) ComparisonHistory

func (service *History) ComparisonHistory(ctx context.Context, after string, ids []string) (HistoryPage, error)

type HistoryPage

type HistoryPage struct {
	SchemaVersion int       `json:"schema_version"`
	Comparisons   []Summary `json:"comparisons"`
	NextCursor    string    `json:"next_cursor"`
}

type HistoryRepository

type HistoryRepository interface {
	ComparisonHistory(context.Context, string, []string) (HistoryPage, error)
}

type MetaFactory

type MetaFactory func(time.Time) (domain.EntityMeta, error)

type PreparationDependencies

type PreparationDependencies struct {
	Repository  PreparationRepository
	Targets     TargetPreparer
	Clock       Clock
	MetaFactory MetaFactory
}

type PreparationRepository

type PreparationRepository interface {
	GetPlan(context.Context, string) (domain.Plan, error)
	ResolvePlanTargetSelection(
		context.Context,
		domain.Plan,
		string,
		string,
	) (domain.Model, domain.Channel, domain.ChannelModel, error)
}

PreparationRepository reads catalog definitions without creating execution facts.

type PreparedComparison

type PreparedComparison struct {
	Meta  domain.EntityMeta        `json:"meta"`
	Plan  domain.EntityRevisionRef `json:"plan"`
	Model domain.EntityRevisionRef `json:"model"`
	Runs  []runs.PreparedRun       `json:"runs"`
}

PreparedComparison freezes the whole group before any child is accepted.

func (PreparedComparison) Comparison

func (prepared PreparedComparison) Comparison() (domain.Comparison, error)

type Preparer

type Preparer struct {
	// contains filtered or unexported fields
}

func NewPreparer

func NewPreparer(dependencies PreparationDependencies) (*Preparer, error)

func (*Preparer) Build

func (preparer *Preparer) Build(
	ctx context.Context,
	command StartCommand,
) (PreparedComparison, map[string]*credentials.Lease, error)

type Refresher

type Refresher struct {
	// contains filtered or unexported fields
}

Refresher advances a complete group's state from execution facts alone. Both the node owner and desktop queries use this single aggregation rule. Mirrors return the node's committed state, including between journal pages.

func NewRefresher

func NewRefresher(dependencies RefresherDependencies) (*Refresher, error)

func (*Refresher) Refresh

func (service *Refresher) Refresh(ctx context.Context, comparisonID string) (domain.Comparison, error)

type RefresherDependencies

type RefresherDependencies struct {
	Repository ExecutionRepository
	Runs       RunReader
	Clock      Clock
}

type Repository

type Repository interface {
	PreparationRepository
	ExecutionRepository
	CreateComparison(context.Context, domain.Comparison) error
}

type RunReader

type RunReader interface {
	GetRun(context.Context, string) (domain.Run, error)
}

type Runner

type Runner interface {
	TargetPreparer
	AcceptPrepared(context.Context, runs.PreparedRun, *credentials.Lease) (string, error)
	ActivateRun(context.Context, string) error
	GetRun(context.Context, string) (domain.Run, error)
	CancelRun(context.Context, string) error
}

type Service

type Service struct {
	*Preparer
	*Refresher
	// contains filtered or unexported fields
}

func New

func New(dependencies Dependencies) (*Service, error)

func (*Service) Snapshot

func (service *Service) Snapshot(ctx context.Context) (Snapshot, error)

func (*Service) Start

func (service *Service) Start(ctx context.Context, command StartCommand) (string, error)

type Snapshot

type Snapshot struct {
	SchemaVersion int       `json:"schema_version"`
	Comparisons   []Summary `json:"comparisons"`
}

type StartCommand

type StartCommand struct {
	PlanID     string   `json:"plan_id"`
	ModelID    string   `json:"model_id"`
	ChannelIDs []string `json:"channel_ids"`
}

type Summary

type Summary struct {
	ID        string          `json:"id"`
	CreatedAt time.Time       `json:"created_at"`
	Status    string          `json:"status"`
	PlanID    string          `json:"plan_id"`
	PlanName  string          `json:"plan_name"`
	ModelID   string          `json:"model_id"`
	ModelName string          `json:"model_name"`
	Channels  []ChannelResult `json:"channels"`
}

type TargetPreparer

type TargetPreparer interface {
	BuildTarget(context.Context, runs.StartCommand) (runs.PreparedRun, *credentials.Lease, error)
}

Jump to

Keyboard shortcuts

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