record

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package record turns a judge's seat scores into the two records an install keeps of them: additive cells in a tally sheet on disk, and one row per score in an outbox.

THE MECHANISM. Recorder.Record takes the scores judge.Judge answered and does two things with them. Every valid one is observed into the sheet the recorder holds, under the role_quality metric, and one row is appended to the recorder's outbox when it holds one. A score whose role is not one of the judged seats, or that is not on the 0-100 scale, is skipped and named in the error; the others are recorded however the round went, and the sheet is observed whatever the outbox does. A nil outbox records locally only.

The sheet an install keeps of its own scores is its own evidence: it is saved under the pool directory (OwnSheetName) and read back as cells (Cells) — which `codeaf pool` lists beside the index's.

Index

Constants

View Source
const Metric = "role_quality"

Metric is the sheet metric a judged seat score is observed under.

View Source
const OwnSheetName = "own.json"

OwnSheetName is the file the install's own sheet is kept as, under the pool directory.

Variables

This section is empty.

Functions

func ExampleRowJSON added in v0.4.0

func ExampleRowJSON(now time.Time) string

ExampleRowJSON is one row as the relay would receive it, on the day given, with placeholder slugs where a real row carries the model that held the seat and the model that judged it — the bytes a person can read before any row exists. `codeaf telemetry show` printed it until 2026-10-01; its readers are the tests and the disclosure now. It is marshalled from Row, so it cannot spell a key a real row would not.

func LoadSheet

func LoadSheet(path string) (*tally.Sheet, error)

LoadSheet reads the sheet at path. A path with no file answers an empty sheet and no error — an install that has recorded nothing yet is not a fault; bytes that are there and do not parse as a sheet document are.

func OwnSheetPath

func OwnSheetPath(poolDir string) string

OwnSheetPath is where the install's own sheet lives for the pool directory given.

func SaveSheet

func SaveSheet(path string, s *tally.Sheet) error

SaveSheet writes the sheet to a temporary file in the path's own directory and renames it into place, so a reader mid-write never sees half a document. The file is mode 0600 and its parent directory is created with mode 0700 when it is missing.

Types

type Cell

type Cell struct {
	Role  string
	Model string
	Mean  float64
	N     int
}

Cell is one seat's measured quality on a sheet: the seat, the model, the mean of its 0-100 scores and how many stand behind it.

func Cells

func Cells(s *tally.Sheet) []Cell

Cells reads the sheet's own role_quality cells — the ones recorded with no dim labels — sorted by seat then model, so the answer is a property of the sheet and never of the order it was observed in. A nil sheet answers no cells.

type Recorder

type Recorder struct {
	// Sheet holds the install's own tallies; a recorder without one has
	// nowhere to put what it is given, and refuses.
	Sheet *tally.Sheet
	// Outbox is the rows' way out. A nil Outbox keeps the scores locally
	// only.
	Outbox *outbox.Outbox
}

Recorder turns judge scores into the two records an install keeps: the sheet observed locally and, when one is held, the outbox rows that leave.

func (*Recorder) Record

func (r *Recorder) Record(scores []judge.Score, judgeModel, door, size, day string) error

Record observes every score it is given into the sheet, and appends one row per score to the outbox when the recorder holds one. THE SHEET IS OBSERVED WHATEVER THE OUTBOX DOES: every score is observed before the first row is appended, so an append that fails costs the install nothing of its own evidence, and the first append error is returned once every score has been observed. A score whose role is not one of the judged seats, or whose score is not on the 0-100 scale, is skipped and named in the error beside the others that were recorded.

type Row

type Row struct {
	Schema int     `json:"schema"`
	Metric string  `json:"metric"`
	Role   string  `json:"role"`
	Model  string  `json:"model"`
	Score  float64 `json:"score"`
	Judge  string  `json:"judge"`
	Door   string  `json:"door"`
	Size   string  `json:"size"`
	Day    string  `json:"day"`
}

Row is one judged seat score as it leaves the install: what was scored — the metric, the seat and the model that held it, the score on the 0-100 scale — and the facts of the run it was read from, the judge that answered, the door the run came in by (task, do, exec or run), the size of the crew, and the day.

func RowsOf

func RowsOf(scores []judge.Score, judgeModel, door, size, day string) []Row

RowsOf reads judge scores into rows, one per score. Every row carries schema 1 and the role_quality metric; the day is spelled by the caller, the way the outbox spells its own.

Jump to

Keyboard shortcuts

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