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 ¶
const ( VerdictPass = "pass" VerdictPassExplained = "pass after named causes" )
The verdicts of a line that passed.
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.
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 ¶
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 ¶
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.
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 ¶
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 ¶
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 ¶
GoSource is the Go file that compiles the record into a release, as Built. The same record always gives the same bytes.