Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/pool/record/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ const rowSchema = 1
// 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, the size of the crew, and the day.
// the door the run came in by (task, do, exec or run), the size of the crew,
// and the day.
type Row struct {
Schema int `json:"schema"`
Metric string `json:"metric"`
Expand Down
4 changes: 4 additions & 0 deletions relay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ It serves, all under `/pool/`: `POST /pool/v1/rows` for submissions,
its signature, and `GET /pool/healthz`; every other path answers 404 with an
empty body.

A submitted row is one NDJSON line per scored seat, and its `door` is the door
the run came in by — one of `task`, `do`, `exec` or `run`. A door the wire does
not know is refused.

## Priming

The first published index was primed once, from the same measured runs the
Expand Down
6 changes: 3 additions & 3 deletions relay/src/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
// {"schema":1,"day":"YYYY-MM-DD","nonce":"<32 lowercase hex>","payload":{...}}
// The payload is the record.Row fields:
// {"schema":1,"metric":"role_quality","role":...,"model":...,"score":...,
// "judge":...,"door":...,"size":...,"day":"YYYY-MM-DD"}
// "judge":...,"door":"task"|"do"|"exec"|"run","size":...,"day":"YYYY-MM-DD"}
//
// Everything here is pure: no KV, no fetch, no clock of its own.

// The one metric the client records.
const METRIC = 'role_quality';

const ROLES = new Set(['worker', 'high', 'mastermind']);
const DOORS = new Set(['task', 'do']);
const DOORS = new Set(['task', 'do', 'exec', 'run']);
const SIZES = new Set(['S', 'M', 'L']);

// A model id is "<vendor>/<id>". The Go side draws both halves from a closed
Expand Down Expand Up @@ -97,7 +97,7 @@ export function validateRow(line, now = new Date()) {
return fail('judge must be <vendor>/<id>');
}
if (!DOORS.has(payload.door)) {
return fail('door must be task or do');
return fail('door must be task, do, exec or run');
}
if (!SIZES.has(payload.size)) {
return fail('size must be S, M or L');
Expand Down
15 changes: 15 additions & 0 deletions relay/test/worker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,21 @@ test('submit folds a batch into sheets and answers 202', async () => {
assert.equal(e.POOL.map.get(`quota/${INSTALL}/2026-09-17`), '2');
});

test('a row on the exec or run door is accepted and folded, and a row on a door outside the four is refused naming them', async () => {
const e = env();
const body = line({ door: 'exec' }) + '\n' + line({ door: 'run' }) + '\n';
const res = await worker.fetch(post(body, { 'X-Codeaf-Install': INSTALL }), e);
assert.equal(res.status, 202);
assert.deepEqual(await res.json(), { accepted: 2 });
const cell = `sheet/${INSTALL}/2026-09-17/worker|z-ai/glm-5.3-flash|anthropic/claude-opus-5|`;
assert.deepEqual(JSON.parse(e.POOL.map.get(`${cell}exec|M`)), { n: 1, s: 50, s2: 2500 });
assert.deepEqual(JSON.parse(e.POOL.map.get(`${cell}run|M`)), { n: 1, s: 50, s2: 2500 });

const refused = await worker.fetch(post(line({ door: 'shell' }), { 'X-Codeaf-Install': INSTALL }), env());
assert.equal(refused.status, 400);
assert.match((await refused.json()).error, /door must be task, do, exec or run/);
});

test('submit refuses a batch past the daily quota and stores nothing', async () => {
const e = env({ ROWS_PER_INSTALL_PER_DAY: '1' });
const body = line() + '\n' + line() + '\n';
Expand Down