Webhook-driven central review service for Granthi forges: HMAC-verified push/pull_request webhooks, per-repo serialization with global LLM concurrency 1, shre-router powered rubric review (8 axes, strict JSON, tolerant extractor + retry), commit statuses + PR scorecard comments, sqlite attribution ledger with Co-Authored-By trailer parsing, per-repo HTML history dashboard, nightly per-agent digests, fail-open-with- visibility when the router is unavailable. Posture: BLOCK on confirmed critical/high correctness+security findings; admin merge is the human override. Co-Authored-By: Claude Fable 5 <[email protected]>
43 lines
1.6 KiB
JavaScript
43 lines
1.6 KiB
JavaScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { parseTrailers, agentSlug } from '../src/lib/trailers.js';
|
|
|
|
test('parses standard Co-Authored-By trailer', () => {
|
|
const msg = 'fix: thing\n\nCo-Authored-By: Claude Fable 5 <[email protected]>';
|
|
assert.deepEqual(parseTrailers(msg), [{ name: 'Claude Fable 5', email: '[email protected]' }]);
|
|
});
|
|
|
|
test('case-insensitive and tolerant spacing', () => {
|
|
const msg = 'x\nco-authored-by: Codex Bot <[email protected]> ';
|
|
assert.deepEqual(parseTrailers(msg), [{ name: 'Codex Bot', email: '[email protected]' }]);
|
|
});
|
|
|
|
test('multiple distinct trailers', () => {
|
|
const msg = 'x\nCo-Authored-By: A <[email protected]>\nCo-Authored-By: B <[email protected]>';
|
|
assert.equal(parseTrailers(msg).length, 2);
|
|
});
|
|
|
|
test('dedupes identical trailers', () => {
|
|
const msg = 'x\nCo-Authored-By: A <[email protected]>\nCo-authored-by: A <[email protected]>';
|
|
assert.equal(parseTrailers(msg).length, 1);
|
|
});
|
|
|
|
test('trailer without email', () => {
|
|
const msg = 'x\nCo-Authored-By: Mystery Agent';
|
|
assert.deepEqual(parseTrailers(msg), [{ name: 'Mystery Agent', email: '' }]);
|
|
});
|
|
|
|
test('ignores non-trailer lines', () => {
|
|
assert.deepEqual(parseTrailers('Co-Authored-By appears in prose but not as trailer: nope\nplain line'), []);
|
|
assert.deepEqual(parseTrailers(''), []);
|
|
assert.deepEqual(parseTrailers(null), []);
|
|
});
|
|
|
|
test('agentSlug from email localpart', () => {
|
|
assert.equal(agentSlug({ name: 'Claude Fable 5', email: '[email protected]' }), 'noreply');
|
|
});
|
|
|
|
test('agentSlug from name when no email', () => {
|
|
assert.equal(agentSlug({ name: 'My Agent!', email: '' }), 'my-agent');
|
|
});
|