accuracy

package
v1.0.0-alpha.34 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 7 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 accuracy holds the record of Costroid's own accuracy test that a release carries: the lines of the accuracy page, docs/accuracy.md, for the page's last Window days, as the page stood when the release was built. The comment quotes it. Nothing in it is read from a network or a setting.

The record is written by `go run ./scripts/accuracy -write`, from the same lines it writes the page from, and a test refuses a record that differs from the page.

Index

Constants

View Source
const (
	VerdictPass          = "pass"
	VerdictPassExplained = "pass after named causes"
)

The verdicts of a line that passed.

View Source
const NoTokenError = "n/a"

NoTokenError is a line's token error when a class has no count on the provider's side, so no percentage exists.

View Source
const Window = 14

Window is how many of the page's last days the record holds: the page's own standard of consecutive days.

Variables

View Source
var Built = Record{Lines: []Line{
	{Day: "2026-11-06", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "token miss, class dollar miss, writer is no release", TokenError: "239150/6567"},
	{Day: "2026-11-07", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "token miss, class dollar miss, writer is no release", TokenError: "48120/1219"},
	{Day: "2026-11-08", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "token miss, class dollar miss, dollar miss", TokenError: "5848400/119051"},
	{Day: "2026-11-09", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "token miss, class dollar miss", TokenError: "2697500/27513"},
	{Day: "2026-11-10", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "token miss, class dollar miss, key used outside Costroid, day names no writer", TokenError: "1150700/12583"},
	{Day: "2026-11-11", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "token miss, class dollar miss, key used outside Costroid, day names no writer", TokenError: "2014300/21611"},
	{Day: "2026-11-12", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}, {Name: "opencode", Version: "1.19.4"}}, Verdict: "pass", TokenError: "0"},
	{Day: "2026-11-13", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "pass", TokenError: "0"},
	{Day: "2026-11-14", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "pass", TokenError: "0"},
	{Day: "2026-11-15", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "pass", TokenError: "0"},
	{Day: "2026-11-16", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "pass", TokenError: "0"},
	{Day: "2026-11-17", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "pass", TokenError: "0"},
	{Day: "2026-11-18", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "pass", TokenError: "0"},
	{Day: "2026-11-19", Sources: []string{"anthropic"}, Agents: []Agent{{Name: "claude-code", Version: "2.1.316"}}, Verdict: "pass", TokenError: "0"},
}}

Built is the accuracy page's lines for its last Window days, as the page stood when this release was built.

Functions

func ProviderName

func ProviderName(source string) (string, bool)

ProviderName is the name the line gives a source, false for a source outside the closed list.

Types

type Agent

type Agent struct {
	Name, Version string
}

Agent is an agent and its version, as a row's tags name them. Version is empty when the rows state none.

type Count

type Count struct {
	Agent, Source string
	// Versions are the agent's versions the counted days name, in order.
	Versions []string
	// First and Last are the first and the last day of the record's window,
	// whatever days the agent ran.
	First, Last string
	// Ran counts the days in the window with a line that names the agent and
	// the source, failed days included. Passed counts those whose every such
	// line passed.
	Ran, Passed int
	// TokenError is the largest token error, in percent, on a line of a day
	// that passed. It is nil when no such line compared tokens.
	TokenError *big.Rat
}

Count is what the record says of one agent on one source.

type Line

type Line struct {
	// Day is the UTC day, as YYYY-MM-DD.
	Day string
	// Sources are the providers the line names, as the page writes them.
	Sources []string
	// Agents are the agents the line's rows name, each with its version.
	Agents []Agent
	// Verdict is the page's verdict: "pass", "pass after named causes", or
	// the failures, apart by a comma.
	Verdict string
	// TokenError is the largest token class's error, in percent, as an exact
	// fraction such as "1/1000". It reads "n/a" when a class has no count on
	// the provider's side, and is empty when the line compares no tokens.
	TokenError string
}

Line is one line of the page's table of days: one reconciliation of one credential on one UTC day, or a day nothing reconciled.

func (Line) Passed

func (l Line) Passed() bool

Passed reports whether the page judged the line to pass.

type Record

type Record struct {
	Lines []Line
}

Record is the page's lines for its last Window days, in the page's order.

func (Record) Count

func (r Record) Count(agent, source string) Count

Count counts the days of the window on which the agent ran alone on the source's key. Every such day counts, the days that failed included. A day the agent shared with another agent counts for neither.

func (Record) Covers

func (r Record) Covers(agent, source string) bool

Covers reports whether a day of the record speaks for a run of one agent on one source: the agent ran alone on the source's key that day, and the source is one the line can name.

func (Record) GoSource

func (r Record) GoSource() ([]byte, error)

GoSource is the Go file that compiles the record into a release, as Built. The same record always gives the same bytes.

func (Record) Tested

func (r Record) Tested() []Tested

Tested lists, each once and in order, every agent and source the record holds a day of with the agent alone on the key, for a source the line can name. It is empty for a record that holds no such day.

func (Record) Window

func (r Record) Window() (first, last string)

Window is the first and the last day of the record, empty for a record that holds no line.

type Tested

type Tested struct {
	Agent, Source string
}

Tested is an agent the record holds a day of on one source, alone on the key.

Jump to

Keyboard shortcuts

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