Crew panel: peer reviewer stats, and pausing a reviewer

Per reviewer: verdicts, agreement with the other reviewers of the same
function and with the human decision, and the share of verdicts given within
10 seconds of the previous one; flags for never/mostly objecting and very fast
reviewers. Admins can pause an account's peer reviews (its verdicts so far
stay) and allow them again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RNwtXPYqFu3oKaaXwYwNWW
This commit is contained in:
Saty 2026-10-18 11:01:33 +02:00
commit 7cbd56a4ea
6 changed files with 101 additions and 3 deletions

View file

@ -11,6 +11,7 @@ import { fixture, FN_ADDR, CALLEE_ADDR, GLOBAL_ADDR } from './helpers.js';
import { openServer, createApp } from '../src/server/app.js';
import { Store, now } from '../src/server/db.js';
import { STATUS } from '../src/shared/compare.js';
import { reviewerStats } from '../src/server/reviewers.js';
const ROOT = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
let dataDir, ctx, server, base;
@ -449,6 +450,19 @@ test('five agreeing peers and no objection accept a function without human revie
}
});
test('reviewer stats and pausing a reviewer', async () => {
// The auto-accept test left verdicts from aapeer1..5; aapeer1 objected on the contested function.
const stats = Object.fromEntries(reviewerStats(ctx.store).map((r) => [r.name, r]));
assert.ok(stats.aapeer2.reviews >= 2);
assert.equal(stats.aapeer1.different, 1);
assert.ok(stats.aapeer2.peerCompared >= 1);
const peer = ctx.accounts.byName('aapeer6');
ctx.store.run('UPDATE users SET peer_review_blocked = 1 WHERE id = ?', peer.id);
assert.deepEqual(ctx.peers.available(peer), [], 'a paused reviewer gets no reviews');
ctx.store.run('UPDATE users SET peer_review_blocked = 0 WHERE id = ?', peer.id);
});
test('the crew view is public and shows no account details', async () => {
const token = await activeUser('crewview');
await call('GET', '/api/tasks', null, token); // the agent checks in