gate

package
v0.1.44 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gate holds the gate of the bench: the gate file, which names what the gate's numbers were recorded on — the commits of the libraries, the pinned packages, the versions the workspace chose and the go lines — and the bands; the gate's cells and numbers; the checks of a run against the file; and the recording of the bands anew.

Index

Constants

View Source
const Learners = 250

Learners are the learners of each cell of the gate: the first of the working set. The slowest job of the gate, at a caller that keeps no cache of Go, is to take at most twelve minutes, three short of the job's budget of fifteen, with a margin beyond that for the runner's spread; the gate keeps the budget by a change of sim, not of the time.

Variables

View Source
var ErrModules = errors.New("gate: modules")

ErrModules is a comparison or a run of the gate of modules the bench refuses.

View Source
var Populations = []string{"G0", "G1", "G2", "G2-half", "G3", "F-model", "W-shock", "A-linked", "E-base", population.GoalTwin, "T-area", "T-skill"}

Populations are the populations of the gate, each on every graph it runs on, in the order of population. A-linked runs on the two published maths together, since olympiad maths rests skills on school maths, and so do the populations of the goal for the tutor: T-none with the empty goal, T-area and T-skill its learners with one item set.

Functions

func Cells

func Cells() []string

Cells gives the cells of the gate: every population on each of its graphs.

func Config

func Config(part bench.Part, commits map[string]string) bench.Config

Config gives the run of the gate, or a part of it: its learners under the engine, each run twice for I1, the libraries named by the commits the recipe gives.

func ModulesConfig

func ModulesConfig(part bench.Part, commits map[string]string, packages []bench.Package) bench.Config

ModulesConfig gives the run of the gate of modules, or a part of it: the gate's run, on the packages of a pull request in place of the pinned ones, so on the graphs they cover alone.

func Numbers

func Numbers(population string) []string

Numbers gives the numbers of the gate of a population: its own, then the share of learners stuck and the share of the choices of nothing while the pool has a task to give.

func ReadPackages

func ReadPackages(packages []Package) ([]bench.Package, error)

ReadPackages reads the packages of a pull request as a run takes them, in place of the pinned ones: each checked against its inventory and translated.

func Verify

func Verify(f *File, info *debug.BuildInfo, goVersion string, modules []Module) []string

Verify gives every way the build of the gate departs from the gate file: a library not built from the workspace, a shared dependency the workspace chose at another version, a module whose go line is another than the recorded or newer than the Go that built the gate, sim's go.mod requiring a library at another point than the file names — the tag of its release, or the pseudo-version of its commit while it is in none —, and packages other than those the bench embeds.

Types

type Band

type Band struct {
	Cell   string  `json:"cell"`
	Number string  `json:"number"`
	Read   bool    `json:"read"`
	Value  float64 `json:"value"`
	Half   float64 `json:"half"`
}

Band is the band of one number of the gate on one cell: its recorded value and the half-width of its 95 % interval; a number the recording could not read is recorded as not read.

type Bands

type Bands struct {
	Reason  string `json:"reason"`
	Numbers []Band `json:"numbers"`
}

Bands are the bands of the gate and why they were recorded.

type Change

type Change struct {
	State           State
	Module, Version string
	Against         string
	Folder          string
	Read            *bench.Package
	// With is, for a package that did not change, the module that changed and brings it into the run:
	// a graph of a population of the gate holds the two together (Runs).
	With string
}

Change is a package of a pull request and what it is: its module and version, and the published version it was compared with, if any. Read is the package read, when the bench reads its format.

func Changes

func Changes(idx *formatv0.ModuleIndex, pub, packages []Package) ([]Change, error)

Changes tells, for each package of a pull request, whether what the bench reads of it changed against the newest published version of its module that is not withdrawn — the one api gives —, by their canonical texts (pack.Module.Text). idx is the index of the newest release of modules, which release-verify has accepted, and pub the packages of its versions, each checked by the chain of digests from it; with no index, there is no release yet, and every package is new. A package of another version of the format than that version is a transition, whose content the bench does not compare across the formats, and of whose published version it reads only the version of the format its entry names; a package of a version of the format the bench does not read, which is no transition, is refused: a newer one wants a newer tag of sim, and one older than pack.Format, which module-kit no longer builds, is refused against any release. A package that is broken is refused: a server part apart from its inventory, a transition too, since the inventory keeps server_part in every version, and a manifest of another module in a version the bench reads.

func Runs added in v0.1.2

func Runs(changes []Change, all bool) []Change

Runs gives the packages of a pull request the gate of modules runs on, in their order: the changed and new ones, or with all every one but a transition of the format; and with them each package that did not change but shares a graph of a population of the gate with one that runs, so that the graph runs on the packages of the pull request — A-linked on both maths when either changed. Such a package names in With the module that brings it.

type File

type File struct {
	Libraries    map[string]Library `json:"libraries"`
	Modules      Modules            `json:"modules"`
	Dependencies map[string]string  `json:"dependencies"`
	Go           map[string]string  `json:"go"`
	Bands        Bands              `json:"bands"`
}

File is the gate file: the libraries by module path, the packages, the versions of the shared dependencies the workspace chose, the go line of each module by its path, and the bands.

func Read

func Read(r io.Reader) (*File, error)

Read reads a gate file; a field it does not know is a mistake.

func Record

func Record(f *File, results *bench.File, reason string) (*File, error)

Record gives the gate file with the bands of a run of the gate, recorded for a reason: the value of every number and the half-width of its interval. The run must be on the commits the file names: bands of a caller's code are no record.

func (*File) Write

func (f *File) Write(w io.Writer) error

Write writes a gate file, indented, its keys in order; a number in the shortest form that reads back to the same bits.

type Held

type Held struct {
	Cell, Number string
	Most         bool
	Limit        float64
	Now          Value
	OK           bool
}

Held is one number of the gate of modules against its threshold.

type Library

type Library struct {
	Repository string `json:"repository"`
	Commit     string `json:"commit"`
	Version    string `json:"version"`
}

Library is a library the gate builds the bench on: its repository, the full SHA of its commit, and the tag of the release on that commit, empty while it is in none.

type Module

type Module struct {
	Path     string
	Go       string
	Requires map[string]string
}

Module is a module of the gate's workspace as its go.mod says: its path, its go line, and the versions it requires, by path.

func ParseGoMod

func ParseGoMod(data []byte) (Module, error)

ParseGoMod reads the module path, the go line and the requirements of a go.mod.

type Modules

type Modules struct {
	Release  string              `json:"release"`
	Index    string              `json:"index"`
	Packages []published.Package `json:"packages"`
}

Modules are the packages the gate runs on: the release of modules and the digest of its index, and each package by its module, version and package digest.

type Package

type Package struct {
	Folder            string
	Inventory, Server []byte
}

Package is a package as a folder holds it: the folder, and its inventory.json and server.json.

type Report

type Report struct {
	Rows    []Row
	Reasons []string
	Exact   bool // the numbers are held to the last bit, not to their bands
}

Report is the gate's verdict: every number against its band, and why it is red, if it is.

func Check

func Check(f *File, results *bench.File, exact bool) (*Report, error)

Check checks a run of the gate against the gate file: the run is the gate's whole run, no learner breaks an invariant, and every number is within its band — two half-widths of the recorded value, the edges included —, or, held exactly, the recorded value to the last bit. A number the recording could not read is held as not read. The populations with no published graph are not run, and the report names them.

func (*Report) OK

func (r *Report) OK() bool

OK tells whether the gate is green.

func (*Report) Write

func (r *Report) Write(w io.Writer) error

Write writes the report in Markdown: the table of every number against its band, then the reasons the gate is red, or that it is green.

type Row

type Row struct {
	Cell, Number string
	Band         *Band // nil: the gate file has no band for it
	Now          Value
	InBand       bool
	Exact        bool // the number is the recorded one to the last bit
}

Row is one number of the gate against its band.

type State

type State string

State is what a package of a pull request is against the published versions of its module.

const (
	// New is a module with no published version, or with none to compare when there is no release
	// yet: it changed whole.
	New State = "new"
	// Changed is a package whose canonical text differs from that of the newest published version.
	Changed State = "changed"
	// Same is a package the bench reads the same of as the newest published version.
	Same State = "same"
	// Transition is a package of another version of the format than the newest published version:
	// a transition of the format, where the bench does not run.
	Transition State = "transition"
)

type ThresholdReport

type ThresholdReport struct {
	Packages  []published.Package
	Rows      []Held
	Reasons   []string
	Uncovered []string
	// Partial are the cells of the gate on a module of the run that did not run, for want of a package
	// of another module of their graph: each with the modules it wanted.
	Partial []string
}

ThresholdReport is the verdict of the gate of modules: every number against its threshold, why it is red, if it is, and the modules on which no cell of the gate runs.

func Thresholds

func Thresholds(f *File, results *bench.File) (*ThresholdReport, error)

Thresholds checks a run of the gate of modules against the thresholds, their limits from the gate file: the run is the gate's on packages, on the commits of the libraries the file names, with every cell the packages cover and all its learners; no learner breaks an invariant; every number with a threshold is within it, the edges included, and a number the run could not read is not. A package on which no cell of the gate runs — a module the bench has no population on — is named, not red: populations on a new graph are a change of sim. So is a cell of the gate on a module of the run that did not run because the run has no package of another module of its graph: the CI of modules gives every module it builds, and so a module it does not give is one it does not build, or a transition of the format.

func (*ThresholdReport) OK

func (r *ThresholdReport) OK() bool

OK tells whether the gate of modules is green.

func (*ThresholdReport) Write

func (r *ThresholdReport) Write(w io.Writer) error

Write writes the report in Markdown: the packages, the table of every number against its threshold, the modules no cell runs on, then the reasons the gate is red, or that it is green.

type Value

type Value struct {
	Cell, Number string
	measure.Value
}

Value is a number of the gate read off a run, on its cell.

func Values

func Values(results *bench.File) ([]Value, error)

Values reads the numbers of the gate off a run of it, in the order of its cells and numbers.

Jump to

Keyboard shortcuts

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