{"modulePath":"github.com/Agent-Field/codeaf","version":"v0.8.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package callrows\n\nPackage callrows reads the model-call log this build always writes (\\`~/.codeaf/logs/calls.jsonl\\`, internal/calllog) back into rows.\n\nIT IS ONE READER BECAUSE THERE IS ONE FILE. Two instruments now read it — cmd/codeaf-census, which prints what went wrong, and cmd/codeaf-replay, which asks what a different chooser would have done — and a second reader is a second answer to \"was this attempt a failure\", \"which of these two rows is the same call\" and \"what does a torn last line mean\". The census had all three in its own package and the first replay bench (\\`internal/lane/replay\\_bench\\_test.go\\`, deleted with this package's first caller) had its own copy of the first two, already disagreeing about whether a hedge's losing arm is a failure. So the reading lives here, once, and an instrument built next week starts from the same rows.\n\nWHAT IS NOT HERE is anything that turns a row into a JUDGEMENT. Which family a failure belongs to, which signature it shares with another, what a regret is — those are each instrument's own argument about the same bytes, and they stay where the argument is made.\n\n## Constants\n\n```go\nconst TimeLayout = \"2006-01-02T15:04:05.000Z07:00\"\n```\nTimeLayout is how internal/calllog spells Record.Time.\n\n## Functions\n\n```go\nfunc SaidStatus(said string) int\n```\nSaidStatus is the status a router's own sentence carries — \\`API error (429): …\\` — and zero when it carries none.\n\nIT IS READ BECAUSE THE COLUMN CANNOT BE TRUSTED TO HOLD IT. A refusal delivered inside an opened 200 stream has a 200 in its status column and a 429 in its words, and no upstream 5xx in ten days of this log ever reached the column at all. internal/provider's velocity.go states the same rule as a law for the live path: a refusal is acted on from what it SAYS and never from where it was read.\n\n```go\nfunc Unspellable(line string) bool\n```\nUnspellable reports whether a line that would not decode carried a float JSON has no spelling for. Go's decoder refuses the whole object on one of these, so the row is lost — which is the defect internal/calllog's finite.go exists to prevent and an instrument exists to notice if it ever comes back.\n\n## Types\n\n```go\ntype Row struct {\n\tcalllog.Record\n\t// HazardCeilingLegacy is `deadline_ms` as builds before 2026-09-10 wrote it.\n\t// It was never a deadline — it is the moment the wait controller was going\n\t// to think about a second request — and it is read here under its old name\n\t// so a reading of a mixed log does not silently lose ten days of it.\n\tHazardCeilingLegacy int64 `json:\"deadline_ms,omitempty\"`\n\n\t// At is Time parsed, and zero when the row carried no readable stamp.\n\tAt time.Time\n\t// Raw is the line as it arrived, kept only long enough for the checks that\n\t// are about the bytes rather than about the values — a float JSON has no\n\t// spelling for reaches a reader as a decode failure, not as a number.\n\tRaw string\n}\n```\nRow is one line of the log, decoded.\n\nIT EMBEDS THE RECORD THE WRITER WRITES rather than restating its fields, so that a field added to internal/calllog is readable here the day it lands and the two can never disagree about a name. What is added beside it is the one thing an embedding cannot carry: a field a wave RENAMED, which ten days of already-written rows still spell the old way.\n\n```go\nfunc Read(path string) ([]Row, error)\n```\nRead reads every line of a log into rows, in time order, skipping the ones that are not JSON at all.\n\nA LINE THAT WILL NOT DECODE IS COUNTED AND NEVER FATAL. A log is appended to by a live process; the last line of a file read while a call is landing can be half a line, and an instrument that refused to run over it would be an instrument nobody could use while the thing it measures is running.\n\n```go\nfunc (r Row) Exhaust() bool\n```\nExhaust reports whether this row is the losing arm of a hedge this build won.\n\nIT IS NOT A FAILURE AND COUNTING IT AS ONE MEASURES OUR OWN HEDGING POLICY. The arm really was sent and really was cut off, so its row says \\`context canceled\\` and reads exactly like a caller walking away: 1,204 of 3,906 bad rows in the first census, the largest cause family in it, every one of them the price of a race that ended with an answer.\n\nThe sentence is read as well as the field because the rows already in the log have only the sentence — internal/provider wrote the note for one wave while this field was landing, and a reading that could not see it would show the finding disappearing on the day of the rebuild rather than on the day the build changed.\n\n```go\nfunc (r Row) Failed() bool\n```\nFailed reports whether this attempt produced no usable answer — which is NOT the same as a status outside the 200s, and that is the whole point of reading the log at all. A refusal delivered inside an opened 200 stream is a 200 in every dashboard and a failure to the person waiting.\n\n```go\nfunc (r Row) Finished() bool\n```\nFinished reports whether this row is the end of an attempt rather than its beginning. A start row omits nothing and says so in one word; everything else is an outcome (internal/calllog's PhaseStart).\n\n```go\nfunc (r Row) HazardCeiling() int64\n```\nHazardCeiling is how long this attempt had before the wait controller would have acted on its silence, whichever build wrote the row.\n\n```go\nfunc (r Row) Lost() bool\n```\nLost is a line that was written and could not be read back: a float JSON has no spelling for took the whole object with it. It is kept as a row so a reader can count it, and it is not an attempt — nothing about the call it was about survived.\n\n","path":"github.com/Agent-Field/codeaf/internal/callrows","name":"callrows","synopsis":"Package callrows reads the model-call log this build always writes (`~/.codeaf/logs/calls.jsonl`, internal/calllog) back into rows.","isRedistributable":true}
