test: review-dispatch-compare has a free lane; review-depth fixtures registered free; resumed max_rounds case off the old default

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-10-27 23:27:27 +00:00
1 parent 636776fcf6
commit 2684974602
3 files changed
+45 -3

No files matched your search

+3 -3
View File
@@ -64,10 +64,10 @@ describe('round budget', () => {
test('a resumed run keeps the max_rounds it persisted', () => {
const s = start();
fs.writeFileSync(path.join(s.out, 'run.json'), JSON.stringify({ ...readRunJson(s.out), max_rounds: 3 }, null, 2) + '\n');
fs.writeFileSync(path.join(s.out, 'run.json'), JSON.stringify({ ...readRunJson(s.out), max_rounds: 1 }, null, 2) + '\n');
expect(r.ap(['resume', '--out', s.out]).status).toBe(0);
expect(readRunJson(s.out).max_rounds).toBe(3);
expect(r.ap(['status', '--out', s.out]).stdout).toMatch(/^ROUNDS: ceo=1\/3 eng=1\/3 max_rounds=3 /m);
expect(readRunJson(s.out).max_rounds).toBe(1);
expect(r.ap(['status', '--out', s.out]).stdout).toMatch(/^ROUNDS: ceo=1\/1 eng=1\/1 max_rounds=1 /m);
});
});
+1
View File
@@ -189,6 +189,7 @@ export const FREE_FIXTURES: Readonly<Record<string, readonly string[]>> = {
'test/fixtures/pty-idle-turn-end.json': ['test/helpers/claude-pty-runner.runners.unit.test.ts', 'test/helpers/claude-pty-runner.screen.unit.test.ts'],
'test/fixtures/redact-diagram/**': ['test/redact-context-exemptions.test.ts'],
'test/fixtures/remote-identity-vectors.json': ['test/bin-context-windows-slug.test.ts', 'test/gstack-slug-parity.test.ts', 'test/remote-identity-vectors.test.ts'],
'test/fixtures/review-depth/**': ['test/review-dispatch-compare.test.ts'],
'test/fixtures/review-design-lite-reports-ci-36633323521.json': ['test/review-finalization-budget.test.ts'],
'test/fixtures/review-gate-integrity-opus-reports.json': ['test/gate-integrity-templates.test.ts'],
'test/fixtures/session-update-heartbeat.sh': ['test/session-update-heartbeat.test.ts'],
+41
View File
@@ -0,0 +1,41 @@
import { describe, expect, test } from 'bun:test';
import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
import { runScriptSync } from '../lib/script-invocation';
const ROOT = path.join(import.meta.dir, '..');
const SCRIPT = path.join(ROOT, 'scripts', 'review-dispatch-compare.ts');
const FIXTURES = ['test/fixtures/review-depth/docs-only.json', 'test/fixtures/review-depth/code.json'].map(f => path.join(ROOT, f));
const run = (args: string[]) => {
const r = runScriptSync(SCRIPT, [...FIXTURES.flatMap(f => ['--fixture', f]), ...args], { cwd: ROOT, encoding: 'utf8', timeout: 120_000 });
expect(r.status).toBe(0);
return r.stdout as string;
};
describe('scripts/review-dispatch-compare.ts', () => {
test('the new policy never dispatches more reviewers than the legacy one, and a docs diff costs under a third', () => {
const out = JSON.parse(run(['--json']));
expect(out.tokens_source).toBe('DEFAULT');
expect(out.ship.length).toBe(10);
for (const row of out.ship) {
expect(row.new_dispatches).toBeLessThanOrEqual(row.legacy_dispatches);
expect(row.new_tokens).toBeLessThanOrEqual(row.legacy_tokens);
}
for (const row of out.ship.filter((r: any) => r.class === 'docs')) expect(row.ratio).toBeLessThan(0.34);
for (const f of out.autoplan) for (const r of f.runs) expect(r.next).toBeLessThanOrEqual(r.legacy);
});
test('--tokens replaces the default output estimates and the table says which it used', () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'dispatch-compare-'));
try {
const tok = path.join(dir, 'measured.json');
fs.writeFileSync(tok, JSON.stringify({ specialist: { full: 6929, light: 5446 } }));
const table = run(['--tokens', tok]);
expect(table).toContain(`TOKENS: measured (${tok})`);
expect(table).toMatch(/^SHIP_TOKEN_RATIO: median=0\.\d+ min=0\.\d+ max=\d\.\d+ \(n=10\)$/m);
} finally {
fs.rmSync(dir, { recursive: true, force: true });
}
});
});